|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r63166 - in branches/quickbook-1.5-spirit2: . test
From: daniel_james_at_[hidden]
Date: 2010-06-20 16:32:14
Author: danieljames
Date: 2010-06-20 16:32:11 EDT (Sun, 20 Jun 2010)
New Revision: 63166
URL: http://svn.boost.org/trac/boost/changeset/63166
Log:
Fix automatic heading ids.
Only with a version switch for 1.6. Also, clean up some other code
involving titles and ids.
Added:
branches/quickbook-1.5-spirit2/test/identifier_1_5.gold (contents, props changed)
branches/quickbook-1.5-spirit2/test/identifier_1_5.quickbook (contents, props changed)
branches/quickbook-1.5-spirit2/test/identifier_1_6.gold (contents, props changed)
branches/quickbook-1.5-spirit2/test/identifier_1_6.quickbook (contents, props changed)
Text files modified:
branches/quickbook-1.5-spirit2/block.hpp | 4 ++--
branches/quickbook-1.5-spirit2/block_actions.cpp | 15 +++++----------
branches/quickbook-1.5-spirit2/block_table_grammar.cpp | 4 ++--
branches/quickbook-1.5-spirit2/doc_info_actions.cpp | 3 +--
branches/quickbook-1.5-spirit2/gen_types.hpp | 2 +-
branches/quickbook-1.5-spirit2/test/Jamfile.v2 | 2 ++
branches/quickbook-1.5-spirit2/test/table_1_5.gold | 33 +++++++++++++++++++++++++++++++++
branches/quickbook-1.5-spirit2/test/table_1_5.quickbook | 5 +++++
branches/quickbook-1.5-spirit2/utils.hpp | 7 +++++++
9 files changed, 58 insertions(+), 17 deletions(-)
Modified: branches/quickbook-1.5-spirit2/block.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/block.hpp (original)
+++ branches/quickbook-1.5-spirit2/block.hpp 2010-06-20 16:32:11 EDT (Sun, 20 Jun 2010)
@@ -80,7 +80,7 @@
struct variablelist
{
- std::string title;
+ raw_string title;
std::vector<varlistentry> entries;
};
@@ -90,7 +90,7 @@
struct table
{
boost::optional<raw_string> id;
- std::string title;
+ raw_string title;
std::vector<table_row> rows;
};
Modified: branches/quickbook-1.5-spirit2/block_actions.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/block_actions.cpp (original)
+++ branches/quickbook-1.5-spirit2/block_actions.cpp 2010-06-20 16:32:11 EDT (Sun, 20 Jun 2010)
@@ -63,9 +63,7 @@
// TODO: This uses the generated title.
state.section_id.value = x.id ?
x.id->value :
- detail::make_identifier(
- x.content.raw.begin(),
- x.content.raw.end());
+ detail::make_identifier(x.content.raw);
if (state.section_level != 0) {
state.qualified_section_id.value += '.';
@@ -146,16 +144,13 @@
if (!new_style) // version 1.2 and below
{
r.id.value = state.section_id.value + "." +
- detail::make_identifier(
- x.content.content.begin(),
- x.content.content.end());
+ detail::make_identifier(x.content.content);
}
else // version 1.3 and above
{
raw_string id;
- id.value = detail::make_identifier(
- x.content.content.begin(),
- x.content.content.end());
+ id.value = qbk_version_n >= 106 ? detail::make_identifier(x.content.raw) :
+ detail::make_identifier(x.content.content);
r.linkend = r.id = fully_qualified_id(
state.doc_id, state.qualified_section_id, id);
@@ -206,7 +201,7 @@
}
else if(r.title) {
raw_string id;
- id.value = detail::make_identifier(x.title.begin(), x.title.end());
+ id.value = detail::make_identifier(x.title);
r.id = fully_qualified_id(state.doc_id,
state.qualified_section_id, id);
Modified: branches/quickbook-1.5-spirit2/block_table_grammar.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/block_table_grammar.cpp (original)
+++ branches/quickbook-1.5-spirit2/block_table_grammar.cpp 2010-06-20 16:32:11 EDT (Sun, 20 Jun 2010)
@@ -50,7 +50,7 @@
>> element_id [member_assign(&quickbook::table::id)]
) | qi::eps)
>> (&(*qi::blank >> qi::eol) | space)
- >> (*(qi::char_ - eol)) [member_assign(&quickbook::table::title)]
+ >> qi::raw[*(qi::char_ - eol)] [member_assign(&quickbook::table::title)]
>> +eol
>> (*table_row) [member_assign(&quickbook::table::rows)]
;
@@ -87,7 +87,7 @@
variablelist =
(&(*qi::blank >> qi::eol) | space)
- >> (*(qi::char_ - eol)) [member_assign(&quickbook::variablelist::title)]
+ >> qi::raw[*(qi::char_ - eol)] [member_assign(&quickbook::variablelist::title)]
>> +eol
>> (*varlistentry) [member_assign(&quickbook::variablelist::entries)]
;
Modified: branches/quickbook-1.5-spirit2/doc_info_actions.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/doc_info_actions.cpp (original)
+++ branches/quickbook-1.5-spirit2/doc_info_actions.cpp 2010-06-20 16:32:11 EDT (Sun, 20 Jun 2010)
@@ -55,8 +55,7 @@
state.doc_title = info.doc_title;
if(info.doc_id.empty())
- info.doc_id = detail::make_identifier(
- state.doc_title.begin(),state.doc_title.end());
+ info.doc_id = detail::make_identifier(state.doc_title);
if(state.doc_id.empty())
state.doc_id = info.doc_id;
Modified: branches/quickbook-1.5-spirit2/gen_types.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/gen_types.hpp (original)
+++ branches/quickbook-1.5-spirit2/gen_types.hpp 2010-06-20 16:32:11 EDT (Sun, 20 Jun 2010)
@@ -49,7 +49,7 @@
struct table2
{
boost::optional<raw_string> id;
- boost::optional<std::string> title;
+ boost::optional<raw_string> title;
int cols;
boost::optional<table_row> head;
std::vector<table_row> rows;
Modified: branches/quickbook-1.5-spirit2/test/Jamfile.v2
==============================================================================
--- branches/quickbook-1.5-spirit2/test/Jamfile.v2 (original)
+++ branches/quickbook-1.5-spirit2/test/Jamfile.v2 2010-06-20 16:32:11 EDT (Sun, 20 Jun 2010)
@@ -32,6 +32,8 @@
[ quickbook-test section_1_4 ]
[ quickbook-test section_1_5 ]
[ quickbook-test heading ]
+ [ quickbook-test identifier_1_5 ]
+ [ quickbook-test identifier_1_6 ]
[ quickbook-test para-test ]
[ quickbook-test table_1_5 ]
[ quickbook-test image_1_5 ]
Added: branches/quickbook-1.5-spirit2/test/identifier_1_5.gold
==============================================================================
--- (empty file)
+++ branches/quickbook-1.5-spirit2/test/identifier_1_5.gold 2010-06-20 16:32:11 EDT (Sun, 20 Jun 2010)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE article PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
+<article id="identifiers_in_quickbook_1_5" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Identifiers in quickbook 1.5</title>
+ <articleinfo>
+ </articleinfo>
+ <anchor id="identifiers_in_quickbook_1_5.test_heading_with__code__phrase_role__identifier__code__phrase___code_"/>
+ <bridgehead renderas="sect2">
+ <link linkend="identifiers_in_quickbook_1_5.test_heading_with__code__phrase_role__identifier__code__phrase___code_">Test
+ heading with <code><phrase role="identifier">code</phrase></code></link>
+ </bridgehead>
+</article>
Added: branches/quickbook-1.5-spirit2/test/identifier_1_5.quickbook
==============================================================================
--- (empty file)
+++ branches/quickbook-1.5-spirit2/test/identifier_1_5.quickbook 2010-06-20 16:32:11 EDT (Sun, 20 Jun 2010)
@@ -0,0 +1,5 @@
+[article Identifiers in quickbook 1.5
+ [quickbook 1.5]
+]
+
+[heading Test heading with `code`]
\ No newline at end of file
Added: branches/quickbook-1.5-spirit2/test/identifier_1_6.gold
==============================================================================
--- (empty file)
+++ branches/quickbook-1.5-spirit2/test/identifier_1_6.gold 2010-06-20 16:32:11 EDT (Sun, 20 Jun 2010)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE article PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
+<article id="identifiers_in_quickbook_1_6" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Identifiers in quickbook 1.6</title>
+ <articleinfo>
+ </articleinfo>
+ <anchor id="identifiers_in_quickbook_1_6.test_heading_with__code_"/>
+ <bridgehead renderas="sect2">
+ <link linkend="identifiers_in_quickbook_1_6.test_heading_with__code_">Test heading
+ with <code><phrase role="identifier">code</phrase></code></link>
+ </bridgehead>
+</article>
Added: branches/quickbook-1.5-spirit2/test/identifier_1_6.quickbook
==============================================================================
--- (empty file)
+++ branches/quickbook-1.5-spirit2/test/identifier_1_6.quickbook 2010-06-20 16:32:11 EDT (Sun, 20 Jun 2010)
@@ -0,0 +1,5 @@
+[article Identifiers in quickbook 1.6
+ [quickbook 1.6]
+]
+
+[heading Test heading with `code`]
\ No newline at end of file
Modified: branches/quickbook-1.5-spirit2/test/table_1_5.gold
==============================================================================
--- branches/quickbook-1.5-spirit2/test/table_1_5.gold (original)
+++ branches/quickbook-1.5-spirit2/test/table_1_5.gold 2010-06-20 16:32:11 EDT (Sun, 20 Jun 2010)
@@ -142,5 +142,38 @@
</tbody>
</tgroup>
</table>
+ <table frame="all" id="table_1_5.section1.a___b">
+ <title>A & B</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>
+ <para>
+ A
+ </para>
+ </entry>
+ <entry>
+ <para>
+ B
+ </para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>
+ a
+ </para>
+ </entry>
+ <entry>
+ <para>
+ b
+ </para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
</section>
</article>
Modified: branches/quickbook-1.5-spirit2/test/table_1_5.quickbook
==============================================================================
--- branches/quickbook-1.5-spirit2/test/table_1_5.quickbook (original)
+++ branches/quickbook-1.5-spirit2/test/table_1_5.quickbook 2010-06-20 16:32:11 EDT (Sun, 20 Jun 2010)
@@ -35,4 +35,9 @@
[[cell]]
]
+[table A & B
+ [[A][B]]
+ [[a][b]]
+]
+
[endsect]
\ No newline at end of file
Modified: branches/quickbook-1.5-spirit2/utils.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/utils.hpp (original)
+++ branches/quickbook-1.5-spirit2/utils.hpp 2010-06-20 16:32:11 EDT (Sun, 20 Jun 2010)
@@ -29,6 +29,13 @@
return out_name;
}
+ template <typename Container>
+ inline std::string
+ make_identifier(Container const& x)
+ {
+ return make_identifier(x.begin(), x.end());
+ }
+
// un-indent a code segment
void unindent(std::string& program);
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk