Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65141 - in branches/quickbook-1.5-spirit2: . doc test
From: dnljms_at_[hidden]
Date: 2010-08-30 19:52:33


Author: danieljames
Date: 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
New Revision: 65141
URL: http://svn.boost.org/trac/boost/changeset/65141

Log:
Merge some of the quickbook 1.5.3 changes from trunk.
Added:
   branches/quickbook-1.5-spirit2/test/code-block.gold
      - copied, changed from r64829, /trunk/tools/quickbook/test/code-block.gold
   branches/quickbook-1.5-spirit2/test/code-block.quickbook
      - copied unchanged from r64829, /trunk/tools/quickbook/test/code-block.quickbook
   branches/quickbook-1.5-spirit2/test/command_line_macro.gold
      - copied unchanged from r64829, /trunk/tools/quickbook/test/command_line_macro.gold
   branches/quickbook-1.5-spirit2/test/command_line_macro.quickbook
      - copied unchanged from r64829, /trunk/tools/quickbook/test/command_line_macro.quickbook
   branches/quickbook-1.5-spirit2/test/heading_1_6.gold
      - copied unchanged from r64829, /trunk/tools/quickbook/test/heading_1_6.gold
   branches/quickbook-1.5-spirit2/test/heading_1_6.quickbook
      - copied unchanged from r64829, /trunk/tools/quickbook/test/heading_1_6.quickbook
   branches/quickbook-1.5-spirit2/test/variablelist.gold
      - copied unchanged from r64831, /trunk/tools/quickbook/test/variablelist.gold
   branches/quickbook-1.5-spirit2/test/variablelist.quickbook
      - copied unchanged from r64831, /trunk/tools/quickbook/test/variablelist.quickbook
Properties modified:
   branches/quickbook-1.5-spirit2/ (props changed)
Text files modified:
   branches/quickbook-1.5-spirit2/block.hpp | 1
   branches/quickbook-1.5-spirit2/block_actions.cpp | 8
   branches/quickbook-1.5-spirit2/block_grammar.cpp | 33 +++-
   branches/quickbook-1.5-spirit2/block_section_grammar.cpp | 5
   branches/quickbook-1.5-spirit2/boostbook.cpp | 27 +++
   branches/quickbook-1.5-spirit2/code_grammar.cpp | 12 +
   branches/quickbook-1.5-spirit2/code_snippet_actions.cpp | 11 -
   branches/quickbook-1.5-spirit2/code_snippet_grammar.cpp | 4
   branches/quickbook-1.5-spirit2/doc/quickbook.qbk | 13 ++
   branches/quickbook-1.5-spirit2/grammar.cpp | 8
   branches/quickbook-1.5-spirit2/grammar.hpp | 2
   branches/quickbook-1.5-spirit2/grammar_impl.hpp | 4
   branches/quickbook-1.5-spirit2/template.cpp | 196 +++++++++++++++----------------
   branches/quickbook-1.5-spirit2/template.hpp | 26 ++-
   branches/quickbook-1.5-spirit2/template_grammar.cpp | 27 ++-
   branches/quickbook-1.5-spirit2/test/Jamfile.v2 | 4
   branches/quickbook-1.5-spirit2/test/code-block.gold | 2
   branches/quickbook-1.5-spirit2/test/heading.gold | 14 ++
   branches/quickbook-1.5-spirit2/test/heading.quickbook | 10 +
   branches/quickbook-1.5-spirit2/test/include_1_5.gold | 4
   branches/quickbook-1.5-spirit2/test/include_1_6-2.gold | 4
   branches/quickbook-1.5-spirit2/test/include_1_6.gold | 4
   branches/quickbook-1.5-spirit2/test/list_test.gold | 236 +++++++++++++++++++-------------------
   branches/quickbook-1.5-spirit2/test/quickbook-manual.gold | 242 ++++++++++++++++++++--------------------
   branches/quickbook-1.5-spirit2/test/quickbook-testing.jam | 5
   branches/quickbook-1.5-spirit2/test/section_1_4.gold | 8
   branches/quickbook-1.5-spirit2/test/section_1_5.gold | 6
   branches/quickbook-1.5-spirit2/test/table_1_5.gold | 2
   28 files changed, 506 insertions(+), 412 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-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -67,6 +67,7 @@
     struct heading
     {
         int level;
+ boost::optional<raw_string> id;
         title content;
     };
 

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-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -148,7 +148,9 @@
         else // version 1.3 and above
         {
             raw_string id;
- id.value = qbk_version_n >= 106 ? detail::make_identifier(x.content.raw) :
+ id.value =
+ x.id ? x.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(
@@ -175,7 +177,7 @@
     {
         state.paragraph_output();
 
- if(!state.templates.add(x)) {
+ if(!state.templates.add(x, state.templates.top_scope.get())) {
             detail::outerr(x.body.position.file, x.body.position.line)
                 << "Template Redefinition: " << x.id << std::endl;
             ++state.error_count;
@@ -402,7 +404,7 @@
 
         BOOST_FOREACH(define_template const& definition, storage)
         {
- if (!state.templates.add(definition))
+ if (!state.templates.add(definition, state.templates.top_scope.get()))
             {
                 detail::outerr(definition.body.position.file, definition.body.position.line)
                     << "Template Redefinition: " << definition.id << std::endl;

Modified: branches/quickbook-1.5-spirit2/block_grammar.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/block_grammar.cpp (original)
+++ branches/quickbook-1.5-spirit2/block_grammar.cpp 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -36,16 +36,26 @@
         qi::rule<iterator, quickbook::hr()> hr;
         qi::rule<iterator> paragraph;
         qi::rule<iterator, quickbook::block_separator()> block_separator;
- qi::rule<iterator, quickbook::def_macro> command_line_macro_parse;
+ qi::rule<iterator, quickbook::def_macro()> command_line_macro_parse;
+ qi::rule<iterator, std::string()> command_line_macro_identifier;
     };
 
- void quickbook_grammar::impl::init_block()
+ void quickbook_grammar::impl::init_block(bool skip_initial_spaces)
     {
         block_grammar_local& local = store_.create();
 
- block_start =
- local.blocks >> blank
- ;
+ if (skip_initial_spaces)
+ {
+ block_start =
+ *(qi::blank | comment) >> local.blocks >> blank
+ ;
+ }
+ else
+ {
+ block_start =
+ local.blocks >> blank
+ ;
+ }
 
         local.blocks =
            *( local.block_markup
@@ -53,7 +63,7 @@
             | local.list [actions.process]
             | local.hr [actions.process]
             | local.block_separator [actions.process]
- | eol
+ | +eol
             | local.paragraph
             )
             ;
@@ -140,14 +150,17 @@
 
         local.command_line_macro_parse =
                 space
- >> macro_identifier
+ >> local.command_line_macro_identifier [member_assign(&quickbook::def_macro::macro_identifier)]
>> space
- >> ( '='
+ >> -( '='
>> space
- >> simple_phrase
+ >> phrase [member_assign(&quickbook::def_macro::content)]
>> space
                 )
- | qi::attr("")
+ ;
+
+ local.command_line_macro_identifier =
+ +(~qi::char_("=]") - qi::space)
             ;
 
         // Error

Modified: branches/quickbook-1.5-spirit2/block_section_grammar.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/block_section_grammar.cpp (original)
+++ branches/quickbook-1.5-spirit2/block_section_grammar.cpp 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -44,6 +44,7 @@
         local.begin_section =
                 space
>> element_id [member_assign(&quickbook::begin_section::id)]
+ >> space
>> local.title_phrase [member_assign(&quickbook::begin_section::content)]
             ;
 
@@ -66,6 +67,10 @@
         local.heading =
                 qi::attr(qi::_r1) [member_assign(&quickbook::heading::level)]
>> space
+ >> -( qi::eps(qbk_since(106u))
+ >> element_id [member_assign(&quickbook::heading::id)]
+ >> space
+ )
>> local.title_phrase [member_assign(&quickbook::heading::content)]
                 ;
 

Modified: branches/quickbook-1.5-spirit2/boostbook.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/boostbook.cpp (original)
+++ branches/quickbook-1.5-spirit2/boostbook.cpp 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -283,7 +283,28 @@
             it = x.entries.begin(); it != x.entries.end(); ++it)
         {
             state.block << m.pre;
- std::for_each(it->begin(), it->end(), encode_action(state, *this));
+
+ std::vector<quickbook::block_formatted>::const_iterator
+ it2 = it->begin(), end2 = it->end();
+
+ encode_action encode(state, *this);
+ for(;it2 != end2 && std::string(it2->type) == "varlistterm"; ++it2) {
+ encode(*it2);
+ }
+
+ if(it2 != end2) {
+ std::string type = "varlistitem";
+ boostbook_markup m2 = get_markup(type);
+ state.block << m2.pre;
+
+ for(;it2 != end2; ++it2) {
+ BOOST_ASSERT(type == it2->type);
+ state.block << it2->content;
+ }
+
+ state.block << m2.post;
+ }
+
             state.block << m.post;
         }
 
@@ -359,9 +380,9 @@
         for(std::vector<list_item2>::const_iterator
             it = x.items.begin(), end = x.items.end(); it != end; ++it)
         {
- state.block << "<listitem><simpara>\n" << it->content;
+ state.block << "<listitem><simpara>\n" << it->content << "\n</simpara>";
             if(!it->sublist.items.empty()) (*this)(state, it->sublist);
- state.block << std::string("\n</simpara></listitem>");
+ state.block << std::string("</listitem>");
         }
 
         state.block << std::string(x.mark == '#' ? "\n</orderedlist>" : "\n</itemizedlist>");

Modified: branches/quickbook-1.5-spirit2/code_grammar.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/code_grammar.cpp (original)
+++ branches/quickbook-1.5-spirit2/code_grammar.cpp 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -27,6 +27,7 @@
     {
         qi::rule<iterator, quickbook::code()> indented_code;
         qi::rule<iterator> code_line;
+ qi::rule<iterator> blank_line;
         qi::rule<iterator, quickbook::code()> code_block1;
         qi::rule<iterator, quickbook::code()> code_block2;
         qi::rule<iterator, quickbook::code()> inline_code;
@@ -44,9 +45,12 @@
         local.indented_code =
                 position [member_assign(&quickbook::code::position)]
                                                         [member_assign(&quickbook::code::flow, quickbook::code::block)]
- >> qi::raw[local.code_line >> *(*eol >> local.code_line)]
+ >> qi::raw[
+ local.code_line
+ >> *(*local.blank_line >> local.code_line)
+ ]
                                                         [member_assign(&quickbook::code::content)]
- >> +eol
+ >> *eol
             ;
 
         local.code_line =
@@ -55,6 +59,10 @@
>> eol
             ;
 
+ local.blank_line =
+ *qi::blank >> qi::eol
+ ;
+
         code_block = (local.code_block1 | local.code_block2) [actions.process];
 
         local.code_block1

Modified: branches/quickbook-1.5-spirit2/code_snippet_actions.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/code_snippet_actions.cpp (original)
+++ branches/quickbook-1.5-spirit2/code_snippet_actions.cpp 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -29,14 +29,11 @@
 
     void code_snippet_actions::process_action::operator()(callout const& x, unused_type, unused_type) const
     {
+ actions.code += "``[[callout" + boost::lexical_cast<std::string>(actions.callouts.size()) + "]]``";
+
         callout_source item;
- item.body = template_value(x.position, x.content);
+ item.body = template_body(x.content, x.position, true);
         item.role = x.role;
-
- actions.code += "``[[callout" +
- boost::lexical_cast<std::string>(actions.callouts.size()) +
- "]]``";
-
         actions.callouts.push_back(item);
     }
 
@@ -85,7 +82,7 @@
         }
 
         define_template d(x.identifier, params,
- template_value(x.position, actions.snippet));
+ template_body(actions.snippet, x.position, true));
         d.callouts = actions.callouts;
         actions.storage.push_back(d);
 

Modified: branches/quickbook-1.5-spirit2/code_snippet_grammar.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/code_snippet_grammar.cpp (original)
+++ branches/quickbook-1.5-spirit2/code_snippet_grammar.cpp 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -167,7 +167,7 @@
             ;
 
         inline_callout
- = repo::confix("/*<", ">*/")
+ = repo::confix("/*<" >> *qi::space, ">*/")
                 [ position [member_assign(&quickbook::callout::position)]
                                                 [member_assign(&quickbook::callout::role, "callout_bug")]
>> (*(qi::char_ - ">*/")) [member_assign(&quickbook::callout::content)]
@@ -175,7 +175,7 @@
             ;
 
         line_callout
- = repo::confix("/*<<", ">>*/" >> *qi::space)
+ = repo::confix("/*<<" >> *qi::space, ">>*/" >> *qi::space)
                 [ position [member_assign(&quickbook::callout::position)]
                                                 [member_assign(&quickbook::callout::role, "line_callout_bug")]
>> (*(qi::char_ - ">>*/")) [member_assign(&quickbook::callout::content)]

Modified: branches/quickbook-1.5-spirit2/doc/quickbook.qbk
==============================================================================
--- branches/quickbook-1.5-spirit2/doc/quickbook.qbk (original)
+++ branches/quickbook-1.5-spirit2/doc/quickbook.qbk 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -219,6 +219,19 @@
   * Correctly restore the quickbook version switch after including a file
     with a different version.
 
+[h3 Version 1.5.3 - Boost 1.45.0]
+
+* Fix command line flag for defining macros.
+* Fix a couple of issues with the code block parser:
+ * A comment with no indentation will now end a code block.
+ * Code blocks no longer have to be followed by a blank line.
+* Improved tracking of file position in templates and imported code blocks.
+* Better generated markup for callout lists.
+* In docbook, variable list entries can only have one `listitem`, so if an
+ entry has multiple values, merge them into one `listitem`.
+* Further work on quickbook 1.6, still not stable.
+ * Allow heading to have ids, using the syntax: `[heading:id title]`.
+
 [endsect]
 
 [section:syntax Syntax Summary]

Modified: branches/quickbook-1.5-spirit2/grammar.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/grammar.cpp (original)
+++ branches/quickbook-1.5-spirit2/grammar.cpp 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -56,8 +56,8 @@
         quickbook::actions& actions_;
     };
 
- quickbook_grammar::quickbook_grammar(quickbook::actions& a)
- : impl_(new impl(a))
+ quickbook_grammar::quickbook_grammar(quickbook::actions& a, bool skip_initial_spaces)
+ : impl_(new impl(a, skip_initial_spaces))
         , command_line_macro(impl_->command_line_macro, "command_line_macro")
         , phrase(impl_->common, "phrase")
         , simple_phrase(impl_->simple_phrase, "simple_phrase")
@@ -71,7 +71,7 @@
     {
     }
 
- quickbook_grammar::impl::impl(quickbook::actions& a)
+ quickbook_grammar::impl::impl(quickbook::actions& a, bool skip_initial_spaces)
         : actions(a)
         , no_eols(true)
         , store_()
@@ -79,7 +79,7 @@
         init_phrase();
         init_phrase_markup();
         init_phrase_image();
- init_block();
+ init_block(skip_initial_spaces);
         init_block_markup();
         init_block_section();
         init_block_table();

Modified: branches/quickbook-1.5-spirit2/grammar.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/grammar.hpp (original)
+++ branches/quickbook-1.5-spirit2/grammar.hpp 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -34,7 +34,7 @@
         qi::grammar<iterator> block;
         qi::grammar<iterator, quickbook::doc_info()> doc_info;
 
- quickbook_grammar(quickbook::actions&);
+ quickbook_grammar(quickbook::actions&, bool skip_initial_spaces = false);
         ~quickbook_grammar();
     };
 }

Modified: branches/quickbook-1.5-spirit2/grammar_impl.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/grammar_impl.hpp (original)
+++ branches/quickbook-1.5-spirit2/grammar_impl.hpp 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -53,14 +53,14 @@
         // doc_info
         qi::rule<iterator, quickbook::doc_info()> doc_info_details;
         
- impl(quickbook::actions&);
+ impl(quickbook::actions&, bool skip_initial_spaces);
 
     private:
 
         void init_phrase();
         void init_phrase_markup();
         void init_phrase_image();
- void init_block();
+ void init_block(bool skip_initial_spaces);
         void init_block_markup();
         void init_block_section();
         void init_block_table();

Modified: branches/quickbook-1.5-spirit2/template.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/template.cpp (original)
+++ branches/quickbook-1.5-spirit2/template.cpp 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -21,7 +21,7 @@
 
 namespace quickbook
 {
- namespace
+ namespace detail
     {
         int callout_id = 0;
     }
@@ -31,21 +31,18 @@
         template_symbol(
                 std::string const& identifier,
                 std::vector<std::string> const& params,
- bool is_block,
- template_value const& body,
+ template_body const& body,
                 quickbook::callouts const& callouts,
                 template_scope const* parent)
            : identifier(identifier)
            , params(params)
- , is_block(is_block)
            , body(body)
            , callouts(callouts)
            , parent(parent) {}
 
         std::string identifier;
         std::vector<std::string> params;
- bool is_block;
- template_value body;
+ template_body body;
         quickbook::callouts callouts;
         template_scope const* parent;
     };
@@ -123,20 +120,12 @@
             return false;
         }
 
- std::string::const_iterator
- iter = definition.body.content.begin(),
- end = definition.body.content.end();
- while (iter != end && ((*iter == ' ') || (*iter == '\t')))
- ++iter; // skip spaces and tabs
- bool is_block = (iter != end) && ((*iter == '\r') || (*iter == '\n'));
-
         template_symbol ts(
             definition.id,
             definition.params,
- is_block,
             definition.body,
             definition.callouts,
- parent ? parent : top_scope.get());
+ parent);
 
         top_scope->symbols.add(ts.identifier.c_str(), ts);
         
@@ -162,48 +151,53 @@
 
     namespace
     {
- std::string::size_type find_bracket_end(std::string const& str, std::string::size_type pos)
+ iterator find_bracket_end(iterator begin, iterator const& end)
         {
             unsigned int depth = 1;
 
             while(depth > 0) {
- pos = str.find_first_of("[]\\", pos);
- if(pos == std::string::npos) return pos;
+ char const* search_chars = "[]\\";
+ begin = std::find_first_of(begin, end, search_chars, search_chars + 3);
+ if(begin == end) return begin;
 
- if(str[pos] == '\\')
+ if(*begin == '\\')
                 {
- pos += 2;
+ if(++begin == end) return begin;
+ ++begin;
                 }
                 else
                 {
- depth += (str[pos] == '[') ? 1 : -1;
- ++pos;
+ depth += (*begin == '[') ? 1 : -1;
+ ++begin;
                 }
             }
 
- return pos;
+ return begin;
         }
 
- std::string::size_type find_first_seperator(std::string const& str)
+ iterator find_first_seperator(iterator const& begin, iterator const& end)
         {
             if(qbk_version_n < 105) {
- return str.find_first_of(" \t\r\n");
+ char const* whitespace = " \t\r\n";
+ return std::find_first_of(begin, end, whitespace, whitespace + 4);
             }
             else {
- std::string::size_type pos = 0;
+ iterator pos = begin;
 
                 while(true)
                 {
- pos = str.find_first_of(" \t\r\n\\[", pos);
- if(pos == std::string::npos) return pos;
+ char const* search_chars = " \t\r\n\\[";
+ pos = std::find_first_of(pos, end, search_chars, search_chars + 6);
+ if(pos == end) return pos;
 
- switch(str[pos])
+ switch(*pos)
                     {
                     case '[':
- pos = find_bracket_end(str, pos + 1);
+ pos = find_bracket_end(++pos, end);
                         break;
                     case '\\':
- pos += 2;
+ if(++pos == end) return pos;
+ ++pos;
                         break;
                     default:
                         return pos;
@@ -213,9 +207,9 @@
         }
     
         bool break_arguments(
- std::vector<template_value>& args
+ std::vector<template_body>& args
           , std::vector<std::string> const& params
- , file_position const& pos
+ , boost::spirit::classic::file_position const& pos
         )
         {
             // Quickbook 1.4-: If there aren't enough parameters seperated by
@@ -227,30 +221,29 @@
 
             if (qbk_version_n < 105 || args.size() == 1)
             {
- while (args.size() < params.size() )
+
+ while (args.size() < params.size())
                 {
                     // Try to break the last argument at the first space found
                     // and push it into the back of args. Do this
                     // recursively until we have all the expected number of
                     // arguments, or if there are no more spaces left.
 
- template_value& str = args.back();
- std::string::size_type l_pos = find_first_seperator(str.content);
- if (l_pos == std::string::npos)
+ template_body& body = args.back();
+ iterator begin(body.content.begin(), body.content.end(), body.position.file);
+ iterator end(body.content.end(), body.content.end());
+
+ iterator l_pos = find_first_seperator(begin, end);
+ if (l_pos == end)
                         break;
- template_value first(
- str.position,
- std::string(str.content.begin(), str.content.begin() + l_pos)
- );
- std::string::size_type r_pos = str.content.find_first_not_of(" \t\r\n", l_pos);
- if (r_pos == std::string::npos)
+ char const* whitespace = " \t\r\n";
+ char const* whitespace_end = whitespace + 4;
+ iterator r_pos = l_pos;
+ while(r_pos != end && std::find(whitespace, whitespace_end, *r_pos) != whitespace_end) ++r_pos;
+ if (r_pos == end)
                         break;
- // TODO: Work out position?
- template_value second(
- str.position,
- std::string(str.content.begin()+r_pos, str.content.end())
- );
- str = first;
+ template_body second(std::string(r_pos, end), begin.get_position(), false);
+ body.content = std::string(begin, l_pos);
                     args.push_back(second);
                 }
             }
@@ -271,17 +264,18 @@
 
         std::pair<bool, std::vector<std::string>::const_iterator>
         get_arguments(
- std::vector<template_value>& args
+ std::vector<template_body>& args
           , std::vector<std::string> const& params
           , template_scope const& scope
           , file_position const& pos
           , quickbook::state& state
         )
         {
- std::vector<template_value>::const_iterator arg = args.begin();
+ std::vector<template_body>::const_iterator arg = args.begin();
             std::vector<std::string>::const_iterator tpl = params.begin();
             std::vector<std::string> empty_params;
 
+
             // Store each of the argument passed in as local templates:
             while (arg != args.end())
             {
@@ -300,11 +294,9 @@
         }
 
         bool parse_template(
- bool is_block
- , std::string body
+ template_body const& body
+ , bool escape
           , std::string& result
- , file_position const& template_pos
- , bool template_escape
           , quickbook::state& state
         )
         {
@@ -312,57 +304,50 @@
             // a phrase? We apply a simple heuristic: if the body starts with
             // a newline, then we regard it as a block, otherwise, we parse
             // it as a phrase.
+ //
+ // Note: this is now done in the grammar.
             
- bool r = false;
-
- if (template_escape)
+ if (escape)
             {
                 // escape the body of the template
                 // we just copy out the literal body
- result = body;
- r = true;
+ result = body.content;
+ return true;
             }
- else if (!is_block)
+ else if (!body.is_block)
             {
                 quickbook::actions actions(state);
                 quickbook_grammar g(actions);
 
                 // do a phrase level parse
- iterator first(body.begin(), body.end(), state.filename.native().c_str());
- first.set_position(template_pos);
- iterator last(body.end(), body.end());
- r = boost::spirit::qi::parse(first, last, g.simple_phrase) && first == last;
+ iterator first(body.content.begin(), body.content.end(), body.position);
+ iterator last(body.content.end(), body.content.end());
+ bool r = boost::spirit::qi::parse(first, last, g.simple_phrase) && first == last;
+ // do a phrase level parse
                 std::string phrase;
                 state.phrase.swap(phrase);
                 result = phrase;
+ return r;
             }
             else
             {
                 quickbook::actions actions(state);
- quickbook_grammar g(actions);
+ quickbook_grammar g(actions, true);
 
                 // do a block level parse
                 // ensure that we have enough trailing newlines to eliminate
                 // the need to check for end of file in the grammar.
- body += "\n\n";
-
- iterator first(body.begin(), body.end(), state.filename.native().c_str());
- first.set_position(template_pos);
- iterator last(body.end(), body.end());
-
- while (first != last && ((*first == ' ') || (*first == '\t')))
- ++first; // skip spaces and tabs
- while (first != last && ((*first == '\r') || (*first == '\n')))
- ++first; // skip initial newlines
-
- r = boost::spirit::qi::parse(first, last, g.block) && first == last;
+
+ std::string content = body.content + "\n\n";
+ iterator first(content.begin(), content.end(), body.position);
+ iterator last(content.end(), content.end());
+ bool r = boost::spirit::qi::parse(first, last, g.block) && first == last;
                 state.paragraph_output();
                 std::string block;
                 state.block.swap(block);
                 result = block;
+ return r;
             }
-
- return r;
         }
     }
 
@@ -399,7 +384,7 @@
             if (qbk_version_n >= 105)
                 state.templates.top_scope->parent_scope = x.symbol->parent;
 
- std::vector<template_value> args = x.args;
+ std::vector<template_body> args = x.args;
     
             ///////////////////////////////////
             // Initialise the arguments
@@ -428,17 +413,21 @@
                     args.clear();
                 }
 
- BOOST_ASSERT(x.symbol->params.size() == x.symbol->callouts.size());
- unsigned int size = x.symbol->callouts.size();
+ unsigned int size = x.symbol->params.size();
 
                 for(unsigned int i = 0; i < size; ++i)
                 {
- template_value value;
- value.content = "[[callout]" + x.symbol->callouts[i].role + " " +
- state.doc_id.value +
- boost::lexical_cast<std::string>(callout_id + i) +
- "]";
- args.push_back(value);
+ std::string callout_id = state.doc_id.value +
+ boost::lexical_cast<std::string>(detail::callout_id + i);
+
+ std::string code;
+ code += "[[callout]";
+ code += x.symbol->callouts[i].role;
+ code += " ";
+ code += callout_id;
+ code += "]";
+
+ args.push_back(template_body(code, x.position, false));
                 }
             }
 
@@ -460,10 +449,12 @@
             ///////////////////////////////////
             // parse the template body:
 
- if (!parse_template(x.symbol->is_block, x.symbol->body.content, result, x.symbol->body.position, x.escape, state))
+ if (!parse_template(x.symbol->body, x.escape, result, state))
             {
                 detail::outerr(x.position.file,x.position.line)
- << "Expanding template:" << x.symbol->identifier << std::endl
+ << "Expanding "
+ << (x.symbol->body.is_block ? "block" : "phrase")
+ << " template:" << x.symbol->identifier << std::endl
                     << std::endl
                     << "------------------begin------------------" << std::endl
                     << x.symbol->body.content
@@ -487,29 +478,32 @@
         }
 
         state.pop(); // restore the state
- --state.template_depth;
 
         if(x.symbol->callouts.size()) {
             callout_list list;
             BOOST_FOREACH(callout_source const& c, x.symbol->callouts) {
- callout_item item;
- item.identifier = state.doc_id.value +
- boost::lexical_cast<std::string>(callout_id++);
-
+ std::string callout_id = state.doc_id.value +
+ boost::lexical_cast<std::string>(detail::callout_id++);
+
+ std::string callout_value;
                 state.push();
                 // TODO: adjust the position?
- bool r = parse_template(true, c.body.content, item.content, c.body.position, false, state);
+ bool r = parse_template(c.body, false, callout_value, state);
                 state.pop();
 
                 if(!r)
                 {
                     detail::outerr(c.body.position.file, c.body.position.line)
- << "Error expanding callout."
+ << "Expanding callout."
                         << std::endl;
+ --state.template_depth;
                     ++state.error_count;
                     return;
                 }
 
+ callout_item item;
+ item.identifier = callout_id;
+ item.content = callout_value;
                 list.push_back(item);
             }
 
@@ -522,14 +516,14 @@
             state.pop();
         }
 
- if(x.symbol->is_block) {
+ --state.template_depth;
+
+ if(x.symbol->body.is_block) {
             state.paragraph_output();
             state.block << result;
         }
         else {
             state.phrase << result;
         }
-
- return;
     }
 }

Modified: branches/quickbook-1.5-spirit2/template.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/template.hpp (original)
+++ branches/quickbook-1.5-spirit2/template.hpp 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -23,19 +23,23 @@
     struct template_scope;
     struct template_symbol;
 
- struct template_value
+ struct template_body
     {
- template_value() {}
- template_value(
+ template_body() {}
+ template_body(
+ std::string const& content,
             quickbook::file_position position,
- std::string const& content)
+ bool is_block
+ )
         :
+ content(content),
             position(position),
- content(content)
+ is_block(is_block)
         {}
     
- quickbook::file_position position;
         std::string content;
+ quickbook::file_position position;
+ bool is_block;
     };
 
     struct callout_link {
@@ -45,7 +49,7 @@
 
     struct callout_source {
         std::string role;
- template_value body;
+ template_body body;
     };
     
     struct callout_item {
@@ -63,7 +67,7 @@
         define_template(
             std::string id,
             std::vector<std::string> params,
- template_value body
+ template_body const& body
             )
         :
             id(id), params(params), body(body)
@@ -71,7 +75,7 @@
 
         std::string id;
         std::vector<std::string> params;
- template_value body;
+ template_body body;
         quickbook::callouts callouts;
     };
 
@@ -79,7 +83,7 @@
         file_position position;
         bool escape;
         template_symbol const* symbol;
- std::vector<template_value> args;
+ std::vector<template_body> args;
     };
 
     struct template_stack
@@ -114,7 +118,7 @@
         template_symbol const* find_top_scope(std::string const& symbol) const;
         // Add the given template symbol to the current scope.
         // If a parent scope isn't supplied, uses the current scope.
- bool add(define_template const&, template_scope const* parent = 0);
+ bool add(define_template const&, template_scope const* parent);
         void push();
         void pop();
 

Modified: branches/quickbook-1.5-spirit2/template_grammar.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/template_grammar.cpp (original)
+++ branches/quickbook-1.5-spirit2/template_grammar.cpp 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -10,6 +10,7 @@
 
 #include <boost/spirit/include/qi_core.hpp>
 #include <boost/spirit/include/qi_eps.hpp>
+#include <boost/spirit/include/qi_eol.hpp>
 #include <boost/spirit/repository/include/qi_confix.hpp>
 #include "grammar_impl.hpp"
 #include "template.hpp"
@@ -26,14 +27,14 @@
     {
         qi::rule<iterator, quickbook::define_template()> define_template;
         qi::rule<iterator, std::vector<std::string>()> define_template_params;
- qi::rule<iterator, quickbook::template_value()> template_body;
+ qi::rule<iterator, quickbook::template_body()> template_body;
         qi::rule<iterator> template_body_recurse;
         qi::rule<iterator, std::string()> template_id;
         qi::rule<iterator, quickbook::call_template()> call_template;
- qi::rule<iterator, std::vector<quickbook::template_value>()> template_args;
- qi::rule<iterator, quickbook::template_value()> template_arg_1_4;
+ qi::rule<iterator, std::vector<quickbook::template_body>()> template_args;
+ qi::rule<iterator, quickbook::template_body()> template_arg_1_4;
         qi::rule<iterator> brackets_1_4;
- qi::rule<iterator, quickbook::template_value()> template_arg_1_5;
+ qi::rule<iterator, quickbook::template_body()> template_arg_1_5;
         qi::rule<iterator> brackets_1_5;
     };
 
@@ -57,9 +58,11 @@
             ;
 
         local.template_body =
- position [member_assign(&quickbook::template_value::position)]
+ position [member_assign(&quickbook::template_body::position)]
+ >> qi::matches[&(*qi::blank >> qi::eol)]
+ [member_assign(&quickbook::template_body::is_block)]
>> qi::raw[local.template_body_recurse]
- [member_assign(&quickbook::template_value::content)]
+ [member_assign(&quickbook::template_body::content)]
             ;
 
         local.template_body_recurse =
@@ -93,9 +96,11 @@
             qi::eps(qbk_since(105u)) >> -(local.template_arg_1_5 % "..");
 
         local.template_arg_1_4 =
- position [member_assign(&quickbook::template_value::position)]
+ position [member_assign(&quickbook::template_body::position)]
+ >> qi::matches[&(*qi::blank >> qi::eol)]
+ [member_assign(&quickbook::template_body::is_block)]
>> qi::raw[+(local.brackets_1_4 | ~qi::char_(']') - "..")]
- [member_assign(&quickbook::template_value::content)]
+ [member_assign(&quickbook::template_body::content)]
             ;
 
         local.brackets_1_4 =
@@ -104,9 +109,11 @@
             ;
 
         local.template_arg_1_5 =
- position [member_assign(&quickbook::template_value::position)]
+ position [member_assign(&quickbook::template_body::position)]
+ >> qi::matches[&(*qi::blank >> qi::eol)]
+ [member_assign(&quickbook::template_body::is_block)]
>> qi::raw[+(local.brackets_1_5 | '\\' >> qi::char_ | ~qi::char_("[]") - "..")]
- [member_assign(&quickbook::template_value::content)]
+ [member_assign(&quickbook::template_body::content)]
             ;
 
         local.brackets_1_5 =

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-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -12,6 +12,7 @@
 
 test-suite quickbook.test :
     [ quickbook-test quickbook-manual ]
+ [ quickbook-test code-block ]
     [ quickbook-test code-block-1 ]
     [ quickbook-test code-block-2 ]
     [ quickbook-test code-block-3 ]
@@ -35,9 +36,11 @@
     [ quickbook-test section_1_4 ]
     [ quickbook-test section_1_5 ]
     [ quickbook-test heading ]
+ [ quickbook-test heading_1_6 ]
     [ quickbook-test identifier_1_5 ]
     [ quickbook-test identifier_1_6 ]
     [ quickbook-test para-test ]
+ [ quickbook-test variablelist ]
     [ quickbook-test table_1_5 ]
     [ quickbook-test image_1_5 ]
     [ quickbook-test list_test ]
@@ -51,6 +54,7 @@
     [ quickbook-test xml-escape_1_2 ]
     [ quickbook-test xml-escape_1_5 ]
     [ quickbook-test blocks ]
+ [ quickbook-test command_line_macro : : : <quickbook-define>__macro__=*bold* ]
     [ quickbook-fail-test fail-include ]
     [ quickbook-fail-test fail-import ]
     [ quickbook-fail-test fail-template-arguments1 ]

Copied: branches/quickbook-1.5-spirit2/test/code-block.gold (from r64829, /trunk/tools/quickbook/test/code-block.gold)
==============================================================================
--- /trunk/tools/quickbook/test/code-block.gold (original)
+++ branches/quickbook-1.5-spirit2/test/code-block.gold 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -36,7 +36,7 @@
   
 <programlisting>First code block.
 </programlisting>
-
+
 <programlisting>Second code block.
 [/ Comment in second code block]
 Still second code block.

Modified: branches/quickbook-1.5-spirit2/test/heading.gold
==============================================================================
--- branches/quickbook-1.5-spirit2/test/heading.gold (original)
+++ branches/quickbook-1.5-spirit2/test/heading.gold 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -11,4 +11,18 @@
   <para>
     Testing headers without sections.
   </para>
+ <anchor id="header._not_an_id"/>
+ <bridgehead renderas="sect2">
+ <link linkend="header._not_an_id">:Not an Id</link>
+ </bridgehead>
+ <para>
+ Paragraph.
+ </para>
+ <anchor id="header._not_an_id_again"/>
+ <bridgehead renderas="sect3">
+ <link linkend="header._not_an_id_again">:Not an Id again</link>
+ </bridgehead>
+ <para>
+ Paragraph.
+ </para>
 </article>

Modified: branches/quickbook-1.5-spirit2/test/heading.quickbook
==============================================================================
--- branches/quickbook-1.5-spirit2/test/heading.quickbook (original)
+++ branches/quickbook-1.5-spirit2/test/heading.quickbook 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -5,4 +5,12 @@
 
 [heading Header Test]
 
-Testing headers without sections.
\ No newline at end of file
+Testing headers without sections.
+
+[heading:Not an Id]
+
+Paragraph.
+
+[h3:Not an Id again]
+
+Paragraph.
\ No newline at end of file

Modified: branches/quickbook-1.5-spirit2/test/include_1_5.gold
==============================================================================
--- branches/quickbook-1.5-spirit2/test/include_1_5.gold (original)
+++ branches/quickbook-1.5-spirit2/test/include_1_5.gold 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -6,13 +6,13 @@
   <articleinfo>
   </articleinfo>
   <section id="include_test_sub_document.test">
- <title><link linkend="include_test_sub_document.test"> Test</link></title>
+ <title><link linkend="include_test_sub_document.test">Test</link></title>
     <para>
       Just testing.
     </para>
   </section>
   <section id="foo.test">
- <title><link linkend="foo.test"> Test</link></title>
+ <title><link linkend="foo.test">Test</link></title>
     <para>
       Just testing.
     </para>

Modified: branches/quickbook-1.5-spirit2/test/include_1_6-2.gold
==============================================================================
--- branches/quickbook-1.5-spirit2/test/include_1_6-2.gold (original)
+++ branches/quickbook-1.5-spirit2/test/include_1_6-2.gold 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -6,13 +6,13 @@
   <articleinfo>
   </articleinfo>
   <section id="include-test.test">
- <title><link linkend="include-test.test"> Test</link></title>
+ <title><link linkend="include-test.test">Test</link></title>
     <para>
       Just testing.
     </para>
   </section>
   <section id="foo.test">
- <title><link linkend="foo.test"> Test</link></title>
+ <title><link linkend="foo.test">Test</link></title>
     <para>
       Just testing.
     </para>

Modified: branches/quickbook-1.5-spirit2/test/include_1_6.gold
==============================================================================
--- branches/quickbook-1.5-spirit2/test/include_1_6.gold (original)
+++ branches/quickbook-1.5-spirit2/test/include_1_6.gold 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -6,13 +6,13 @@
   <articleinfo>
   </articleinfo>
   <section id="include-test.test">
- <title><link linkend="include-test.test"> Test</link></title>
+ <title><link linkend="include-test.test">Test</link></title>
     <para>
       Just testing.
     </para>
   </section>
   <section id="foo.test">
- <title><link linkend="foo.test"> Test</link></title>
+ <title><link linkend="foo.test">Test</link></title>
     <para>
       Just testing.
     </para>

Modified: branches/quickbook-1.5-spirit2/test/list_test.gold
==============================================================================
--- branches/quickbook-1.5-spirit2/test/list_test.gold (original)
+++ branches/quickbook-1.5-spirit2/test/list_test.gold 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -41,36 +41,36 @@
     <listitem>
       <simpara>
         A
- <itemizedlist>
- <listitem>
- <simpara>
- A
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- B
- </simpara>
- </listitem>
- </itemizedlist>
       </simpara>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ A
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ B
+ </simpara>
+ </listitem>
+ </itemizedlist>
     </listitem>
     <listitem>
       <simpara>
         B
- <itemizedlist>
- <listitem>
- <simpara>
- A
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- B
- </simpara>
- </listitem>
- </itemizedlist>
       </simpara>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ A
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ B
+ </simpara>
+ </listitem>
+ </itemizedlist>
     </listitem>
   </itemizedlist>
   <para>
@@ -80,36 +80,36 @@
     <listitem>
       <simpara>
         A
- <itemizedlist>
- <listitem>
- <simpara>
- A
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- B
- </simpara>
- </listitem>
- </itemizedlist>
       </simpara>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ A
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ B
+ </simpara>
+ </listitem>
+ </itemizedlist>
     </listitem>
     <listitem>
       <simpara>
         B
- <itemizedlist>
- <listitem>
- <simpara>
- A
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- B
- </simpara>
- </listitem>
- </itemizedlist>
       </simpara>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ A
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ B
+ </simpara>
+ </listitem>
+ </itemizedlist>
     </listitem>
   </orderedlist>
   <para>
@@ -119,53 +119,53 @@
     <listitem>
       <simpara>
         A
- <itemizedlist>
- <listitem>
- <simpara>
- A
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- B
- <itemizedlist>
- <listitem>
- <simpara>
- C
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- D
- </simpara>
- </listitem>
- </itemizedlist>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- E
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- F
- <itemizedlist>
- <listitem>
- <simpara>
- G
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- H
- </simpara>
- </listitem>
- </itemizedlist>
- </simpara>
- </listitem>
- </itemizedlist>
       </simpara>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ A
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ B
+ </simpara>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ C
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ D
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ <listitem>
+ <simpara>
+ E
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ F
+ </simpara>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ G
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ H
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
     </listitem>
   </orderedlist>
   <para>
@@ -175,31 +175,31 @@
     <listitem>
       <simpara>
         A
- <itemizedlist>
- <listitem>
- <simpara>
- A
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- B
- <orderedlist>
- <listitem>
- <simpara>
- C
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- D
- </simpara>
- </listitem>
- </orderedlist>
- </simpara>
- </listitem>
- </itemizedlist>
       </simpara>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ A
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ B
+ </simpara>
+ <orderedlist>
+ <listitem>
+ <simpara>
+ C
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ D
+ </simpara>
+ </listitem>
+ </orderedlist>
+ </listitem>
+ </itemizedlist>
     </listitem>
     <listitem>
       <simpara>

Modified: branches/quickbook-1.5-spirit2/test/quickbook-manual.gold
==============================================================================
--- branches/quickbook-1.5-spirit2/test/quickbook-manual.gold (original)
+++ branches/quickbook-1.5-spirit2/test/quickbook-manual.gold 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -26,7 +26,7 @@
     </articlepurpose>
   </articleinfo>
   <section id="quickbook.intro">
- <title><link linkend="quickbook.intro"> Introduction</link></title>
+ <title><link linkend="quickbook.intro">Introduction</link></title>
     <blockquote>
       <para>
         <emphasis role="bold"><emphasis><quote>Why program by hand in five days what
@@ -102,7 +102,7 @@
     </itemizedlist>
   </section>
   <section id="quickbook.change_log">
- <title><link linkend="quickbook.change_log"> Change Log</link></title> <anchor
+ <title><link linkend="quickbook.change_log">Change Log</link></title> <anchor
     id="quickbook.change_log.version_1_3"/>
     <bridgehead renderas="sect3">
       <link linkend="quickbook.change_log.version_1_3">Version 1.3</link>
@@ -279,7 +279,7 @@
     </itemizedlist>
   </section>
   <section id="quickbook.syntax">
- <title><link linkend="quickbook.syntax"> Syntax Summary</link></title>
+ <title><link linkend="quickbook.syntax">Syntax Summary</link></title>
     <para>
       A QuickBook document is composed of one or more blocks. An example of a block
       is the paragraph or a C++ code snippet. Some blocks have special mark-ups.
@@ -311,7 +311,7 @@
 </programlisting>
     </section>
     <section id="quickbook.syntax.phrase">
- <title><link linkend="quickbook.syntax.phrase"> Phrase Level Elements</link></title>
+ <title><link linkend="quickbook.syntax.phrase">Phrase Level Elements</link></title>
       <section id="quickbook.syntax.phrase.font_styles">
         <title><link linkend="quickbook.syntax.phrase.font_styles">Font Styles</link></title>
         
@@ -928,7 +928,7 @@
         </para>
       </section>
       <section id="quickbook.syntax.phrase.code_links">
- <title><link linkend="quickbook.syntax.phrase.code_links"> Code Links</link></title>
+ <title><link linkend="quickbook.syntax.phrase.code_links">Code Links</link></title>
         <para>
           If you want to link to a function, class, member, enum, concept or header
           in the reference section, you can use:
@@ -1058,7 +1058,7 @@
       </section>
     </section>
     <section id="quickbook.syntax.block">
- <title><link linkend="quickbook.syntax.block"> Block Level Elements</link></title>
+ <title><link linkend="quickbook.syntax.block">Block Level Elements</link></title>
       <section id="quickbook.syntax.block.document">
         <title><link linkend="quickbook.syntax.block.document">Document</link></title>
         <para>
@@ -1272,48 +1272,48 @@
             <listitem>
               <simpara>
                 Three
- <orderedlist>
- <listitem>
- <simpara>
- Three.a
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- Three.b
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- Three.c
- </simpara>
- </listitem>
- </orderedlist>
               </simpara>
+ <orderedlist>
+ <listitem>
+ <simpara>
+ Three.a
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Three.b
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Three.c
+ </simpara>
+ </listitem>
+ </orderedlist>
             </listitem>
             <listitem>
               <simpara>
                 Fourth
- <orderedlist>
- <listitem>
- <simpara>
- Four.a
- <orderedlist>
- <listitem>
- <simpara>
- Four.a.i
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- Four.a.ii
- </simpara>
- </listitem>
- </orderedlist>
- </simpara>
- </listitem>
- </orderedlist>
               </simpara>
+ <orderedlist>
+ <listitem>
+ <simpara>
+ Four.a
+ </simpara>
+ <orderedlist>
+ <listitem>
+ <simpara>
+ Four.a.i
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Four.a.ii
+ </simpara>
+ </listitem>
+ </orderedlist>
+ </listitem>
+ </orderedlist>
             </listitem>
             <listitem>
               <simpara>
@@ -1418,24 +1418,24 @@
             <listitem>
               <simpara>
                 Three
- <itemizedlist>
- <listitem>
- <simpara>
- Three.a
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- Three.b
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- Three.c
- </simpara>
- </listitem>
- </itemizedlist>
               </simpara>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ Three.a
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Three.b
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ Three.c
+ </simpara>
+ </listitem>
+ </itemizedlist>
             </listitem>
             <listitem>
               <simpara>
@@ -1467,72 +1467,72 @@
             <listitem>
               <simpara>
                 1
- <itemizedlist>
- <listitem>
- <simpara>
- 1.a
- <orderedlist>
- <listitem>
- <simpara>
- 1.a.1
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- 1.a.2
- </simpara>
- </listitem>
- </orderedlist>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- 1.b
- </simpara>
- </listitem>
- </itemizedlist>
               </simpara>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ 1.a
+ </simpara>
+ <orderedlist>
+ <listitem>
+ <simpara>
+ 1.a.1
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ 1.a.2
+ </simpara>
+ </listitem>
+ </orderedlist>
+ </listitem>
+ <listitem>
+ <simpara>
+ 1.b
+ </simpara>
+ </listitem>
+ </itemizedlist>
             </listitem>
             <listitem>
               <simpara>
                 2
- <itemizedlist>
- <listitem>
- <simpara>
- 2.a
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- 2.b
- <orderedlist>
+ </simpara>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ 2.a
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ 2.b
+ </simpara>
+ <orderedlist>
+ <listitem>
+ <simpara>
+ 2.b.1
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ 2.b.2
+ </simpara>
+ <itemizedlist>
                         <listitem>
                           <simpara>
- 2.b.1
+ 2.b.2.a
                           </simpara>
                         </listitem>
                         <listitem>
                           <simpara>
- 2.b.2
- <itemizedlist>
- <listitem>
- <simpara>
- 2.b.2.a
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- 2.b.2.b
- </simpara>
- </listitem>
- </itemizedlist>
+ 2.b.2.b
                           </simpara>
                         </listitem>
- </orderedlist>
- </simpara>
- </listitem>
- </itemizedlist>
- </simpara>
+ </itemizedlist>
+ </listitem>
+ </orderedlist>
+ </listitem>
+ </itemizedlist>
             </listitem>
           </orderedlist>
         </section>
@@ -1579,8 +1579,8 @@
 </programlisting>
       </section>
       <section id="quickbook.syntax.block.escape_back">
- <title><link linkend="quickbook.syntax.block.escape_back"> Escaping Back
- To QuickBook</link></title>
+ <title><link linkend="quickbook.syntax.block.escape_back">Escaping Back To
+ QuickBook</link></title>
         <para>
           Inside code, code blocks and inline code, QuickBook does not allow any
           markup to avoid conflicts with the target syntax (e.g. c++). In case you
@@ -2823,7 +2823,7 @@
     </section>
   </section>
   <section id="quickbook.install">
- <title><link linkend="quickbook.install"> Installation and configuration</link></title>
+ <title><link linkend="quickbook.install">Installation and configuration</link></title>
     <para>
       This section provides some guidelines on how to install and configure BoostBook
       and Quickbook under several operating systems.
@@ -2837,7 +2837,7 @@
       trying again. Otherwise your configuration fixes will not take any effect.
     </para>
     <section id="quickbook.install.windows">
- <title><link linkend="quickbook.install.windows"> Windows 2000, XP, 2003, Vista</link></title>
+ <title><link linkend="quickbook.install.windows">Windows 2000, XP, 2003, Vista</link></title>
       <blockquote>
         <para>
           <emphasis>Section contributed by Julio M. Merino Vidal</emphasis>
@@ -2988,7 +2988,7 @@
 </programlisting>
     </section>
     <section id="quickbook.install.linux">
- <title><link linkend="quickbook.install.linux"> Debian, Ubuntu</link></title>
+ <title><link linkend="quickbook.install.linux">Debian, Ubuntu</link></title>
       <para>
         The following instructions apply to Debian and its derivatives. They are
         based on a Ubuntu Edgy install but should work on other Debian based systems.
@@ -3079,7 +3079,7 @@
     </section>
   </section>
   <section id="quickbook.editors">
- <title><link linkend="quickbook.editors"> Editor Support</link></title>
+ <title><link linkend="quickbook.editors">Editor Support</link></title>
     <para>
       Editing quickbook files is usually done with text editors both simple and powerful.
       The following sections list the settings for some editors which can help make
@@ -3097,7 +3097,7 @@
     </para>
     </sidebar>
     <section id="quickbook.editors.scite">
- <title><link linkend="quickbook.editors.scite"> Scintilla Text Editor</link></title>
+ <title><link linkend="quickbook.editors.scite">Scintilla Text Editor</link></title>
       <blockquote>
         <para>
           <emphasis>Section contributed by Dean Michael Berris</emphasis>
@@ -3145,7 +3145,7 @@
     </section>
   </section>
   <section id="quickbook.faq">
- <title><link linkend="quickbook.faq"> Frequently Asked Questions</link></title>
+ <title><link linkend="quickbook.faq">Frequently Asked Questions</link></title>
     <anchor id="quickbook.faq.can_i_use_quickbook_for_non_boost_documentation_"/>
     <bridgehead renderas="sect3">
       <link linkend="quickbook.faq.can_i_use_quickbook_for_non_boost_documentation_">Can
@@ -3187,7 +3187,7 @@
 </programlisting>
   </section>
   <section id="quickbook.ref">
- <title><link linkend="quickbook.ref"> Quick Reference</link></title>
+ <title><link linkend="quickbook.ref">Quick Reference</link></title>
     <para>
       [cpp]
     </para>

Modified: branches/quickbook-1.5-spirit2/test/quickbook-testing.jam
==============================================================================
--- branches/quickbook-1.5-spirit2/test/quickbook-testing.jam (original)
+++ branches/quickbook-1.5-spirit2/test/quickbook-testing.jam 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -16,6 +16,7 @@
 import type ;
 
 feature.feature quickbook-testing.quickbook-command : : free dependency ;
+feature.feature <quickbook-define> : : free ;
 
 type.register QUICKBOOK_INPUT : quickbook ;
 type.register QUICKBOOK_OUTPUT ;
@@ -94,6 +95,8 @@
 
 ################################################################################
 toolset.flags quickbook-testing.process-quickbook quickbook-command <quickbook-testing.quickbook-command> ;
+toolset.flags quickbook-testing.process-quickbook QB-DEFINES <quickbook-define> ;
+
 rule process-quickbook ( target : source : properties * )
 {
     DEPENDS $(target) : [ on $(target) return $(quickbook-command) ] ;
@@ -101,6 +104,6 @@
 
 actions process-quickbook bind quickbook-command
 {
- $(quickbook-command) $(>) --output-file=$(<) --debug
+ $(quickbook-command) $(>) --output-file=$(<) --debug -D"$(QB-DEFINES)"
 }
 

Modified: branches/quickbook-1.5-spirit2/test/section_1_4.gold
==============================================================================
--- branches/quickbook-1.5-spirit2/test/section_1_4.gold (original)
+++ branches/quickbook-1.5-spirit2/test/section_1_4.gold 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -6,13 +6,13 @@
   <articleinfo>
   </articleinfo>
   <section id="section_id_1_4.id_test1">
- <title><link linkend="section_id_1_4.id_test1"> Quickbook section id test</link></title>
+ <title><link linkend="section_id_1_4.id_test1">Quickbook section id test</link></title>
   </section>
   <section id="section_id_1_4.id_test2">
- <title><link linkend="section_id_1_4.id_test2"> Quickbook section id test</link></title>
+ <title><link linkend="section_id_1_4.id_test2">Quickbook section id test</link></title>
   </section>
- <section id="section_id_1_4._quickbook_section_no_id_test_1">
- <title><link linkend="section_id_1_4._quickbook_section_no_id_test_1"> Quickbook
+ <section id="section_id_1_4.quickbook_section_no_id_test_1">
+ <title><link linkend="section_id_1_4.quickbook_section_no_id_test_1">Quickbook
     section no id test 1</link></title>
   </section>
   <section id="section_id_1_4.___quickbook_section_no_id_test_2">

Modified: branches/quickbook-1.5-spirit2/test/section_1_5.gold
==============================================================================
--- branches/quickbook-1.5-spirit2/test/section_1_5.gold (original)
+++ branches/quickbook-1.5-spirit2/test/section_1_5.gold 2010-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -6,13 +6,13 @@
   <articleinfo>
   </articleinfo>
   <section id="section_id_1_5.id_test1">
- <title><link linkend="section_id_1_5.id_test1"> Quickbook section id test</link></title>
+ <title><link linkend="section_id_1_5.id_test1">Quickbook section id test</link></title>
   </section>
   <section id="section_id_1_5.id_test2">
- <title><link linkend="section_id_1_5.id_test2"> Quickbook section id test</link></title>
+ <title><link linkend="section_id_1_5.id_test2">Quickbook section id test</link></title>
   </section>
   <section id="section_id_1_5.id_test3">
- <title><link linkend="section_id_1_5.id_test3"> Quickbook section id test</link></title>
+ <title><link linkend="section_id_1_5.id_test3">Quickbook section id test</link></title>
   </section>
   <section id="section_id_1_5.___quickbook_section_no_id_test">
     <title><link linkend="section_id_1_5.___quickbook_section_no_id_test">++ Quickbook

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-08-30 19:52:12 EDT (Mon, 30 Aug 2010)
@@ -118,7 +118,7 @@
     </tgroup>
   </table>
   <section id="table_1_5.section1">
- <title><link linkend="table_1_5.section1"> Section 1</link></title>
+ <title><link linkend="table_1_5.section1">Section 1</link></title>
     <table frame="all" id="table_1_5.section1.table1">
       <title>Table 1</title>
       <tgroup cols="1">


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