Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71862 - in branches/release/tools/quickbook: . doc src test
From: dnljms_at_[hidden]
Date: 2011-05-10 14:39:42


Author: danieljames
Date: 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
New Revision: 71862
URL: http://svn.boost.org/trac/boost/changeset/71862

Log:
Quickbook: merge to release.

Includes:

- Detemplate syntax highlighter.
- Allow escaped markup in comments in highlighter.
- Remove whitespace hat was inserted after anchors.
- Use fs::path in a couple more places.
- Handle blocks inside phrases better (can happen with templates).

Added:
   branches/release/tools/quickbook/test/code-block-cpp.gold
      - copied, changed from r71098, /trunk/tools/quickbook/test/code-block-cpp.gold
   branches/release/tools/quickbook/test/code-block-cpp.quickbook
      - copied unchanged from r71098, /trunk/tools/quickbook/test/code-block-cpp.quickbook
   branches/release/tools/quickbook/test/code-block-python.gold
      - copied, changed from r71098, /trunk/tools/quickbook/test/code-block-python.gold
   branches/release/tools/quickbook/test/code-block-python.quickbook
      - copied unchanged from r71098, /trunk/tools/quickbook/test/code-block-python.quickbook
Removed:
   branches/release/tools/quickbook/src/syntax_highlight.hpp
Properties modified:
   branches/release/tools/quickbook/ (props changed)
   branches/release/tools/quickbook/doc/ (props changed)
   branches/release/tools/quickbook/src/ (props changed)
   branches/release/tools/quickbook/test/ (props changed)
Text files modified:
   branches/release/tools/quickbook/doc/quickbook.qbk | 1
   branches/release/tools/quickbook/src/Jamfile.v2 | 1
   branches/release/tools/quickbook/src/actions.cpp | 40 +++
   branches/release/tools/quickbook/src/actions.hpp | 31 ++
   branches/release/tools/quickbook/src/actions_class.cpp | 3
   branches/release/tools/quickbook/src/actions_class.hpp | 3
   branches/release/tools/quickbook/src/block_element_grammar.cpp | 2
   branches/release/tools/quickbook/src/code_snippet.cpp | 4
   branches/release/tools/quickbook/src/main_grammar.cpp | 6
   branches/release/tools/quickbook/src/phrase_element_grammar.cpp | 2
   branches/release/tools/quickbook/src/syntax_highlight.cpp | 424 ++++++++++++++++++++++++++++++++++++---
   branches/release/tools/quickbook/test/Jamfile.v2 | 2
   branches/release/tools/quickbook/test/anchor.gold | 18
   branches/release/tools/quickbook/test/code-block-cpp.gold | 10
   branches/release/tools/quickbook/test/code-block-python.gold | 4
   branches/release/tools/quickbook/test/import.gold | 12
   branches/release/tools/quickbook/test/link.gold | 2
   branches/release/tools/quickbook/test/quickbook-manual.gold | 28 +-
   branches/release/tools/quickbook/test/simple_markup.gold | 3
   branches/release/tools/quickbook/test/simple_markup.quickbook | 2
   branches/release/tools/quickbook/test/table_1_5.gold | 2
   branches/release/tools/quickbook/test/templates.gold | 90 ++++++++
   branches/release/tools/quickbook/test/templates.quickbook | 42 +++
   branches/release/tools/quickbook/test/variablelist.gold | 4
   branches/release/tools/quickbook/test/variablelist.quickbook | 10
   25 files changed, 634 insertions(+), 112 deletions(-)

Modified: branches/release/tools/quickbook/doc/quickbook.qbk
==============================================================================
--- branches/release/tools/quickbook/doc/quickbook.qbk (original)
+++ branches/release/tools/quickbook/doc/quickbook.qbk 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -287,6 +287,7 @@
 * Use relative paths for `__FILENAME__` macro.
 * Rewrite xinclude path generator so that it doesn't use deprecated
   filesystem functions.
+* Allow quickbook escapes inside comments in syntax highlighted code.
 * Quickbook 1.6:
   * Scope source mode changes to the file they're made in.
   * Explicit markup for lists. e.g.

Modified: branches/release/tools/quickbook/src/Jamfile.v2
==============================================================================
--- branches/release/tools/quickbook/src/Jamfile.v2 (original)
+++ branches/release/tools/quickbook/src/Jamfile.v2 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -14,7 +14,6 @@
         <toolset>darwin:<c++-template-depth>300
         <toolset>gcc:<cflags>-g0
         <toolset>darwin:<cflags>-g0
- <warnings>all
         <toolset>msvc:<cflags>/wd4709
     ;
 

Modified: branches/release/tools/quickbook/src/actions.cpp
==============================================================================
--- branches/release/tools/quickbook/src/actions.cpp (original)
+++ branches/release/tools/quickbook/src/actions.cpp 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -59,7 +59,7 @@
             {
                 tgt << "<anchor id=\"";
                 detail::print_string(*it, tgt.get());
- tgt << "\"/>\n";
+ tgt << "\"/>";
             }
             
             actions.anchors.clear();
@@ -522,12 +522,26 @@
     }
 
     // TODO: No need to check suppress since this is only used in the syntax
- // highlighter. I should moved this or something.
+ // highlighter. I should move this or something.
     void span::operator()(iterator first, iterator last) const
     {
+ if (name) out << "<phrase role=\"" << name << "\">";
+ while (first != last)
+ detail::print_char(*first++, out.get());
+ if (name) out << "</phrase>";
+ }
+
+ void span_start::operator()(iterator first, iterator last) const
+ {
         out << "<phrase role=\"" << name << "\">";
         while (first != last)
             detail::print_char(*first++, out.get());
+ }
+
+ void span_end::operator()(iterator first, iterator last) const
+ {
+ while (first != last)
+ detail::print_char(*first++, out.get());
         out << "</phrase>";
     }
 
@@ -1341,6 +1355,7 @@
             actions.paragraph(); // For paragraphs before the template call.
             actions.out << block;
             actions.phrase << phrase;
+ actions.paragraph();
         }
         else {
             actions.phrase << phrase;
@@ -1777,7 +1792,7 @@
         std::string ext = paths.filename.extension().generic_string();
         std::vector<template_symbol> storage;
         actions.error_count +=
- load_snippets(paths.filename.string(), storage, ext, actions.doc_id);
+ load_snippets(paths.filename, storage, ext, actions.doc_id);
 
         BOOST_FOREACH(template_symbol& ts, storage)
         {
@@ -1842,7 +1857,7 @@
         actions.values.builder.save();
 
         // parse the file
- quickbook::parse_file(actions.filename.string().c_str(), actions, true);
+ quickbook::parse_file(actions.filename, actions, true);
 
         // restore the values
         actions.values.builder.restore();
@@ -1884,13 +1899,24 @@
         return (*this)(first, last, value::default_tag);
     }
     
- void collector_to_value_action::operator()(iterator, iterator) const
+ void to_value_action::operator()(iterator, iterator) const
     {
         if (actions.suppress) return;
- write_anchors(actions, output);
 
         std::string value;
- output.swap(value);
+
+ if (!actions.out.str().empty())
+ {
+ actions.paragraph();
+ write_anchors(actions, actions.out);
+ actions.out.swap(value);
+ }
+ else
+ {
+ write_anchors(actions, actions.phrase);
+ actions.phrase.swap(value);
+ }
+
         actions.values.builder.insert(bbk_value(value, value::default_tag));
     }
     

Modified: branches/release/tools/quickbook/src/actions.hpp
==============================================================================
--- branches/release/tools/quickbook/src/actions.hpp (original)
+++ branches/release/tools/quickbook/src/actions.hpp 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -53,8 +53,9 @@
 
     typedef cl::symbols<std::string> string_symbols;
 
- int load_snippets(std::string const& file, std::vector<template_symbol>& storage,
+ int load_snippets(fs::path const& file, std::vector<template_symbol>& storage,
         std::string const& extension, std::string const& doc_id);
+
     std::string syntax_highlight(
         iterator first, iterator last,
         actions& escape_actions,
@@ -161,6 +162,27 @@
         collector& out;
     };
 
+ struct span_start
+ {
+ span_start(char const* name, collector& out)
+ : name(name), out(out) {}
+
+ void operator()(iterator first, iterator last) const;
+
+ char const* name;
+ collector& out;
+ };
+
+ struct span_end
+ {
+ span_end(collector& out)
+ : out(out) {}
+
+ void operator()(iterator first, iterator last) const;
+
+ collector& out;
+ };
+
     struct unexpected_char
     {
         // Handles unexpected chars in c++ syntax
@@ -356,15 +378,14 @@
     
     typedef phoenix::function<phrase_to_docinfo_action_impl> phrase_to_docinfo_action;
 
- struct collector_to_value_action
+ struct to_value_action
     {
- collector_to_value_action(quickbook::actions& actions, collector& output)
- : actions(actions), output(output) {}
+ to_value_action(quickbook::actions& actions)
+ : actions(actions) {}
 
         void operator()(iterator first, iterator last) const;
 
         quickbook::actions& actions;
- collector& output;
     };
 
     struct scoped_output_push : scoped_action_base

Modified: branches/release/tools/quickbook/src/actions_class.cpp
==============================================================================
--- branches/release/tools/quickbook/src/actions_class.cpp (original)
+++ branches/release/tools/quickbook/src/actions_class.cpp 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -35,8 +35,7 @@
 
     // value actions
         , values()
- , phrase_value(*this, phrase)
- , out_value(*this, out)
+ , to_value(*this)
         , docinfo_value(*this)
         , scoped_cond_phrase(*this)
         , scoped_output(*this)

Modified: branches/release/tools/quickbook/src/actions_class.hpp
==============================================================================
--- branches/release/tools/quickbook/src/actions_class.hpp (original)
+++ branches/release/tools/quickbook/src/actions_class.hpp 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -51,8 +51,7 @@
 
     // value actions
         value_parser values;
- collector_to_value_action phrase_value;
- collector_to_value_action out_value;
+ to_value_action to_value;
         phrase_to_docinfo_action docinfo_value;
         
         scoped_parser<cond_phrase_push>

Modified: branches/release/tools/quickbook/src/block_element_grammar.cpp
==============================================================================
--- branches/release/tools/quickbook/src/block_element_grammar.cpp (original)
+++ branches/release/tools/quickbook/src/block_element_grammar.cpp 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -281,7 +281,7 @@
         local.inner_block =
             actions.scoped_output()
             [
- inside_paragraph [actions.out_value]
+ inside_paragraph [actions.to_value]
             ]
             ;
 

Modified: branches/release/tools/quickbook/src/code_snippet.cpp
==============================================================================
--- branches/release/tools/quickbook/src/code_snippet.cpp (original)
+++ branches/release/tools/quickbook/src/code_snippet.cpp 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -24,7 +24,7 @@
     struct code_snippet_actions
     {
         code_snippet_actions(std::vector<template_symbol>& storage,
- std::string const& filename,
+ fs::path const& filename,
                                  std::string const& doc_id,
                                  char const* source_type)
             : callout_id(0)
@@ -312,7 +312,7 @@
     };
 
     int load_snippets(
- std::string const& file
+ fs::path const& file
       , std::vector<template_symbol>& storage // snippets are stored in a
                                                 // vector of template_symbols
       , std::string const& extension

Modified: branches/release/tools/quickbook/src/main_grammar.cpp
==============================================================================
--- branches/release/tools/quickbook/src/main_grammar.cpp (original)
+++ branches/release/tools/quickbook/src/main_grammar.cpp 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -221,7 +221,7 @@
>> (cl::ch_p('*') | '#')
                                             [actions.values.entry(ph::arg1, ph::arg2, general_tags::list_mark)]
>> *cl::blank_p
- >> local.list_item [actions.phrase_value]
+ >> local.list_item [actions.to_value]
                     ]
                 ]
                 ] [actions.element]
@@ -384,7 +384,7 @@
                 [
                     actions.scoped_output()
                     [
- (*( ~cl::eps_p(local.simple_markup_end)
+ (+( ~cl::eps_p(local.simple_markup_end)
>> local.nested_char
                         )) [actions.docinfo_value(ph::arg1, ph::arg2)]
                     ]
@@ -508,7 +508,7 @@
>> local.command_line_phrase
>> *cl::space_p
                 | cl::eps_p
- ) [actions.phrase_value]
+ ) [actions.to_value]
             ] [actions.element]
             ;
 

Modified: branches/release/tools/quickbook/src/phrase_element_grammar.cpp
==============================================================================
--- branches/release/tools/quickbook/src/phrase_element_grammar.cpp (original)
+++ branches/release/tools/quickbook/src/phrase_element_grammar.cpp 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -127,7 +127,7 @@
         local.inner_phrase =
                 blank
>> actions.scoped_output()
- [ phrase [actions.phrase_value]
+ [ phrase [actions.to_value]
                 ]
             ;
     }

Modified: branches/release/tools/quickbook/src/syntax_highlight.cpp
==============================================================================
--- branches/release/tools/quickbook/src/syntax_highlight.cpp (original)
+++ branches/release/tools/quickbook/src/syntax_highlight.cpp 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -7,42 +7,394 @@
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt)
 =============================================================================*/
-#include "syntax_highlight.hpp"
+#include <boost/spirit/include/classic_core.hpp>
+#include <boost/spirit/include/classic_confix.hpp>
+#include <boost/spirit/include/classic_chset.hpp>
+#include <boost/spirit/include/classic_symbols.hpp>
+#include <boost/spirit/include/classic_loops.hpp>
+#include "grammar.hpp"
+#include "grammar_impl.hpp" // Just for context stuff. Should move?
 #include "actions_class.hpp"
 
 namespace quickbook
-{
- typedef cpp_highlight<
- span
- , space
- , string_symbols
- , do_macro_action
- , pre_escape_back
- , post_escape_back
- , unexpected_char
- , collector>
- cpp_p_type;
-
- typedef python_highlight<
- span
- , space
- , string_symbols
- , do_macro_action
- , pre_escape_back
- , post_escape_back
- , unexpected_char
- , collector>
- python_p_type;
-
- typedef teletype_highlight<
- plain_char_action
- , string_symbols
- , do_macro_action
- , pre_escape_back
- , post_escape_back
- , collector>
- teletype_p_type;
-
+{
+ namespace cl = boost::spirit::classic;
+
+ // Grammar for C++ highlighting
+ struct cpp_highlight
+ : public cl::grammar<cpp_highlight>
+ {
+ cpp_highlight(collector& out, actions& escape_actions)
+ : out(out), escape_actions(escape_actions) {}
+
+ template <typename Scanner>
+ struct definition
+ {
+ definition(cpp_highlight const& self)
+ : g(self.escape_actions.grammar())
+ {
+ program
+ =
+ *( (+cl::space_p) [space(self.out)]
+ | macro
+ | escape
+ | preprocessor [span("preprocessor", self.out)]
+ | comment
+ | keyword [span("keyword", self.out)]
+ | identifier [span("identifier", self.out)]
+ | special [span("special", self.out)]
+ | string_ [span("string", self.out)]
+ | char_ [span("char", self.out)]
+ | number [span("number", self.out)]
+ | cl::repeat_p(1)[cl::anychar_p]
+ [unexpected_char(self.out, self.escape_actions)]
+ )
+ ;
+
+ macro =
+ // must not be followed by alpha or underscore
+ cl::eps_p(self.escape_actions.macro
+ >> (cl::eps_p - (cl::alpha_p | '_')))
+ >> self.escape_actions.macro [do_macro_action(self.out, self.escape_actions)]
+ ;
+
+ qbk_phrase =
+ self.escape_actions.scoped_context(element_info::in_phrase)
+ [ *( g.common
+ | (cl::anychar_p - cl::str_p("``"))
+ [self.escape_actions.plain_char]
+ )
+ ]
+ ;
+
+ escape =
+ cl::str_p("``") [pre_escape_back(self.escape_actions, save)]
+ >>
+ (
+ (
+ (
+ (+(cl::anychar_p - "``") >> cl::eps_p("``"))
+ & qbk_phrase
+ )
+ >> cl::str_p("``")
+ )
+ |
+ (
+ cl::eps_p [self.escape_actions.error]
+ >> *cl::anychar_p
+ )
+ ) [post_escape_back(self.out, self.escape_actions, save)]
+ ;
+
+ preprocessor
+ = '#' >> *cl::space_p >> ((cl::alpha_p | '_') >> *(cl::alnum_p | '_'))
+ ;
+
+ comment
+ = cl::str_p("//") [span_start("comment", self.out)]
+ >> *( escape
+ | (+(cl::anychar_p - (cl::eol_p | "``")))
+ [span(0, self.out)]
+ )
+ >> cl::eps_p [span_end(self.out)]
+ | cl::str_p("/*") [span_start("comment", self.out)]
+ >> *( escape
+ | (+(cl::anychar_p - (cl::str_p("*/") | "``")))
+ [span(0, self.out)]
+ )
+ >> (!cl::str_p("*/")) [span_end(self.out)]
+ ;
+
+ keyword
+ = keyword_ >> (cl::eps_p - (cl::alnum_p | '_'))
+ ; // make sure we recognize whole words only
+
+ keyword_
+ = "and_eq", "and", "asm", "auto", "bitand", "bitor",
+ "bool", "break", "case", "catch", "char", "class",
+ "compl", "const_cast", "const", "continue", "default",
+ "delete", "do", "double", "dynamic_cast", "else",
+ "enum", "explicit", "export", "extern", "false",
+ "float", "for", "friend", "goto", "if", "inline",
+ "int", "long", "mutable", "namespace", "new", "not_eq",
+ "not", "operator", "or_eq", "or", "private",
+ "protected", "public", "register", "reinterpret_cast",
+ "return", "short", "signed", "sizeof", "static",
+ "static_cast", "struct", "switch", "template", "this",
+ "throw", "true", "try", "typedef", "typeid",
+ "typename", "union", "unsigned", "using", "virtual",
+ "void", "volatile", "wchar_t", "while", "xor_eq", "xor"
+ ;
+
+ special
+ = +cl::chset_p("~!%^&*()+={[}]:;,<.>?/|\\-")
+ ;
+
+ string_char = ('\\' >> cl::anychar_p) | (cl::anychar_p - '\\');
+
+ string_
+ = !cl::as_lower_d['l'] >> cl::confix_p('"', *string_char, '"')
+ ;
+
+ char_
+ = !cl::as_lower_d['l'] >> cl::confix_p('\'', *string_char, '\'')
+ ;
+
+ number
+ = (
+ cl::as_lower_d["0x"] >> cl::hex_p
+ | '0' >> cl::oct_p
+ | cl::real_p
+ )
+ >> *cl::as_lower_d[cl::chset_p("ldfu")]
+ ;
+
+ identifier
+ = (cl::alpha_p | '_') >> *(cl::alnum_p | '_')
+ ;
+ }
+
+ cl::rule<Scanner>
+ program, macro, preprocessor, comment, special, string_,
+ char_, number, identifier, keyword, qbk_phrase, escape,
+ string_char;
+
+ cl::symbols<> keyword_;
+ quickbook_grammar& g;
+ std::string save;
+
+ cl::rule<Scanner> const&
+ start() const { return program; }
+ };
+
+ collector& out;
+ actions& escape_actions;
+ };
+
+ // Grammar for Python highlighting
+ // See also: The Python Reference Manual
+ // http://docs.python.org/ref/ref.html
+ struct python_highlight
+ : public cl::grammar<python_highlight>
+ {
+ python_highlight(collector& out, actions& escape_actions)
+ : out(out), escape_actions(escape_actions) {}
+
+ template <typename Scanner>
+ struct definition
+ {
+ definition(python_highlight const& self)
+ : g(self.escape_actions.grammar())
+ {
+ program
+ =
+ *( (+cl::space_p) [space(self.out)]
+ | macro
+ | escape
+ | comment
+ | keyword [span("keyword", self.out)]
+ | identifier [span("identifier", self.out)]
+ | special [span("special", self.out)]
+ | string_ [span("string", self.out)]
+ | number [span("number", self.out)]
+ | cl::repeat_p(1)[cl::anychar_p]
+ [unexpected_char(self.out, self.escape_actions)]
+ )
+ ;
+
+ macro =
+ // must not be followed by alpha or underscore
+ cl::eps_p(self.escape_actions.macro
+ >> (cl::eps_p - (cl::alpha_p | '_')))
+ >> self.escape_actions.macro [do_macro_action(self.out, self.escape_actions)]
+ ;
+
+ qbk_phrase =
+ self.escape_actions.scoped_context(element_info::in_phrase)
+ [
+ *( g.common
+ | (cl::anychar_p - cl::str_p("``"))
+ [self.escape_actions.plain_char]
+ )
+ ]
+ ;
+
+ escape =
+ cl::str_p("``") [pre_escape_back(self.escape_actions, save)]
+ >>
+ (
+ (
+ (
+ (+(cl::anychar_p - "``") >> cl::eps_p("``"))
+ & qbk_phrase
+ )
+ >> cl::str_p("``")
+ )
+ |
+ (
+ cl::eps_p [self.escape_actions.error]
+ >> *cl::anychar_p
+ )
+ ) [post_escape_back(self.out, self.escape_actions, save)]
+ ;
+
+ comment
+ = cl::str_p("#") [span_start("comment", self.out)]
+ >> *( escape
+ | (+(cl::anychar_p - (cl::eol_p | "``")))
+ [span(0, self.out)]
+ )
+ >> cl::eps_p [span_end(self.out)]
+ ;
+
+ keyword
+ = keyword_ >> (cl::eps_p - (cl::alnum_p | '_'))
+ ; // make sure we recognize whole words only
+
+ keyword_
+ =
+ "and", "del", "for", "is", "raise",
+ "assert", "elif", "from", "lambda", "return",
+ "break", "else", "global", "not", "try",
+ "class", "except", "if", "or", "while",
+ "continue", "exec", "import", "pass", "yield",
+ "def", "finally", "in", "print",
+
+ // Technically "as" and "None" are not yet keywords (at Python
+ // 2.4). They are destined to become keywords, and we treat them
+ // as such for syntax highlighting purposes.
+
+ "as", "None"
+ ;
+
+ special
+ = +cl::chset_p("~!%^&*()+={[}]:;,<.>/|\\-")
+ ;
+
+ string_prefix
+ = cl::as_lower_d[cl::str_p("u") >> ! cl::str_p("r")]
+ ;
+
+ string_
+ = ! string_prefix >> (long_string | short_string)
+ ;
+
+ string_char = ('\\' >> cl::anychar_p) | (cl::anychar_p - '\\');
+
+ short_string
+ = cl::confix_p('\'', * string_char, '\'') |
+ cl::confix_p('"', * string_char, '"')
+ ;
+
+ long_string
+ // Note: the "cl::str_p" on the next two lines work around
+ // an INTERNAL COMPILER ERROR when using VC7.1
+ = cl::confix_p(cl::str_p("'''"), * string_char, "'''") |
+ cl::confix_p(cl::str_p("\"\"\""), * string_char, "\"\"\"")
+ ;
+
+ number
+ = (
+ cl::as_lower_d["0x"] >> cl::hex_p
+ | '0' >> cl::oct_p
+ | cl::real_p
+ )
+ >> *cl::as_lower_d[cl::chset_p("lj")]
+ ;
+
+ identifier
+ = (cl::alpha_p | '_') >> *(cl::alnum_p | '_')
+ ;
+ }
+
+ cl::rule<Scanner>
+ program, macro, comment, special, string_, string_prefix,
+ short_string, long_string, number, identifier, keyword,
+ qbk_phrase, escape, string_char;
+
+ cl::symbols<> keyword_;
+ quickbook_grammar& g;
+ std::string save;
+
+ cl::rule<Scanner> const&
+ start() const { return program; }
+ };
+
+ collector& out;
+ actions& escape_actions;
+ };
+
+ // Grammar for plain text (no actual highlighting)
+ struct teletype_highlight
+ : public cl::grammar<teletype_highlight>
+ {
+ teletype_highlight(collector& out, actions& escape_actions)
+ : out(out), escape_actions(escape_actions) {}
+
+ template <typename Scanner>
+ struct definition
+ {
+ definition(teletype_highlight const& self)
+ : g(self.escape_actions.grammar())
+ {
+ program
+ =
+ *( macro
+ | escape
+ | cl::repeat_p(1)[cl::anychar_p] [plain_char_action(self.out, self.escape_actions)]
+ )
+ ;
+
+ macro =
+ // must not be followed by alpha or underscore
+ cl::eps_p(self.escape_actions.macro
+ >> (cl::eps_p - (cl::alpha_p | '_')))
+ >> self.escape_actions.macro [do_macro_action(self.out, self.escape_actions)]
+ ;
+
+ qbk_phrase =
+ self.escape_actions.scoped_context(element_info::in_phrase)
+ [
+ *( g.common
+ | (cl::anychar_p - cl::str_p("``"))
+ [self.escape_actions.plain_char]
+ )
+ ]
+ ;
+
+ escape =
+ cl::str_p("``") [pre_escape_back(self.escape_actions, save)]
+ >>
+ (
+ (
+ (
+ (+(cl::anychar_p - "``") >> cl::eps_p("``"))
+ & qbk_phrase
+ )
+ >> cl::str_p("``")
+ )
+ |
+ (
+ cl::eps_p [self.escape_actions.error]
+ >> *cl::anychar_p
+ )
+ ) [post_escape_back(self.out, self.escape_actions, save)]
+ ;
+ }
+
+ cl::rule<Scanner> program, macro, qbk_phrase, escape;
+
+ quickbook_grammar& g;
+ std::string save;
+
+ cl::rule<Scanner> const&
+ start() const { return program; }
+ };
+
+ collector& out;
+ actions& escape_actions;
+ };
+
     std::string syntax_highlight(
         iterator first, iterator last,
         actions& escape_actions,
@@ -53,17 +405,17 @@
         // print the code with syntax coloring
         if (source_mode == "c++")
         {
- cpp_p_type cpp_p(temp, escape_actions.macro, do_macro_action(temp, escape_actions), escape_actions);
+ cpp_highlight cpp_p(temp, escape_actions);
             boost::spirit::classic::parse(first, last, cpp_p);
         }
         else if (source_mode == "python")
         {
- python_p_type python_p(temp, escape_actions.macro, do_macro_action(temp, escape_actions), escape_actions);
+ python_highlight python_p(temp, escape_actions);
             boost::spirit::classic::parse(first, last, python_p);
         }
         else if (source_mode == "teletype")
         {
- teletype_p_type teletype_p(temp, escape_actions.macro, do_macro_action(temp, escape_actions), escape_actions);
+ teletype_highlight teletype_p(temp, escape_actions);
             boost::spirit::classic::parse(first, last, teletype_p);
         }
         else

Deleted: branches/release/tools/quickbook/src/syntax_highlight.hpp
==============================================================================
--- branches/release/tools/quickbook/src/syntax_highlight.hpp 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
+++ (empty file)
@@ -1,417 +0,0 @@
-/*=============================================================================
- Copyright (c) 2002 2004 2006 Joel de Guzman
- Copyright (c) 2004 Eric Niebler
- http://spirit.sourceforge.net/
-
- Use, modification and distribution is subject to the Boost Software
- License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt)
-=============================================================================*/
-#if !defined(BOOST_SPIRIT_QUICKBOOK_SYNTAX_HIGHLIGHT_HPP)
-#define BOOST_SPIRIT_QUICKBOOK_SYNTAX_HIGHLIGHT_HPP
-
-#include <boost/spirit/include/classic_core.hpp>
-#include <boost/spirit/include/classic_confix.hpp>
-#include <boost/spirit/include/classic_chset.hpp>
-#include <boost/spirit/include/classic_symbols.hpp>
-#include <boost/spirit/include/classic_loops.hpp>
-#include "grammar.hpp"
-#include "grammar_impl.hpp" // Just for context stuff. Should move?
-
-namespace quickbook
-{
- namespace cl = boost::spirit::classic;
-
- // Grammar for C++ highlighting
- template <
- typename Process
- , typename Space
- , typename Macro
- , typename DoMacro
- , typename PreEscape
- , typename PostEscape
- , typename Unexpected
- , typename Out>
- struct cpp_highlight
- : public cl::grammar<cpp_highlight<Process, Space, Macro, DoMacro, PreEscape, PostEscape, Unexpected, Out> >
- {
- cpp_highlight(Out& out, Macro const& macro, DoMacro do_macro, actions& escape_actions)
- : out(out), macro(macro), do_macro(do_macro), escape_actions(escape_actions) {}
-
- template <typename Scanner>
- struct definition
- {
- definition(cpp_highlight const& self)
- : g(self.escape_actions.grammar())
- {
- program
- =
- *( (+cl::space_p) [Space(self.out)]
- | macro
- | escape
- | preprocessor [Process("preprocessor", self.out)]
- | comment [Process("comment", self.out)]
- | keyword [Process("keyword", self.out)]
- | identifier [Process("identifier", self.out)]
- | special [Process("special", self.out)]
- | string_ [Process("string", self.out)]
- | char_ [Process("char", self.out)]
- | number [Process("number", self.out)]
- | cl::repeat_p(1)[cl::anychar_p]
- [Unexpected(self.out, self.escape_actions)]
- )
- ;
-
- macro =
- // must not be followed by alpha or underscore
- cl::eps_p(self.macro
- >> (cl::eps_p - (cl::alpha_p | '_')))
- >> self.macro [self.do_macro]
- ;
-
- qbk_phrase =
- self.escape_actions.scoped_context(element_info::in_phrase)
- [ *( g.common
- | (cl::anychar_p - cl::str_p("``"))
- [self.escape_actions.plain_char]
- )
- ]
- ;
-
- escape =
- cl::str_p("``") [PreEscape(self.escape_actions, save)]
- >>
- (
- (
- (
- (+(cl::anychar_p - "``") >> cl::eps_p("``"))
- & qbk_phrase
- )
- >> cl::str_p("``")
- )
- |
- (
- cl::eps_p [self.escape_actions.error]
- >> *cl::anychar_p
- )
- ) [PostEscape(self.out, self.escape_actions, save)]
- ;
-
- preprocessor
- = '#' >> *cl::space_p >> ((cl::alpha_p | '_') >> *(cl::alnum_p | '_'))
- ;
-
- comment
- = cl::comment_p("//") | cl::comment_p("/*", "*/")
- ;
-
- keyword
- = keyword_ >> (cl::eps_p - (cl::alnum_p | '_'))
- ; // make sure we recognize whole words only
-
- keyword_
- = "and_eq", "and", "asm", "auto", "bitand", "bitor",
- "bool", "break", "case", "catch", "char", "class",
- "compl", "const_cast", "const", "continue", "default",
- "delete", "do", "double", "dynamic_cast", "else",
- "enum", "explicit", "export", "extern", "false",
- "float", "for", "friend", "goto", "if", "inline",
- "int", "long", "mutable", "namespace", "new", "not_eq",
- "not", "operator", "or_eq", "or", "private",
- "protected", "public", "register", "reinterpret_cast",
- "return", "short", "signed", "sizeof", "static",
- "static_cast", "struct", "switch", "template", "this",
- "throw", "true", "try", "typedef", "typeid",
- "typename", "union", "unsigned", "using", "virtual",
- "void", "volatile", "wchar_t", "while", "xor_eq", "xor"
- ;
-
- special
- = +cl::chset_p("~!%^&*()+={[}]:;,<.>?/|\\-")
- ;
-
- string_char = ('\\' >> cl::anychar_p) | (cl::anychar_p - '\\');
-
- string_
- = !cl::as_lower_d['l'] >> cl::confix_p('"', *string_char, '"')
- ;
-
- char_
- = !cl::as_lower_d['l'] >> cl::confix_p('\'', *string_char, '\'')
- ;
-
- number
- = (
- cl::as_lower_d["0x"] >> cl::hex_p
- | '0' >> cl::oct_p
- | cl::real_p
- )
- >> *cl::as_lower_d[cl::chset_p("ldfu")]
- ;
-
- identifier
- = (cl::alpha_p | '_') >> *(cl::alnum_p | '_')
- ;
- }
-
- cl::rule<Scanner>
- program, macro, preprocessor, comment, special, string_,
- char_, number, identifier, keyword, qbk_phrase, escape,
- string_char;
-
- cl::symbols<> keyword_;
- quickbook_grammar& g;
- std::string save;
-
- cl::rule<Scanner> const&
- start() const { return program; }
- };
-
- Out& out;
- Macro const& macro;
- DoMacro do_macro;
- actions& escape_actions;
- };
-
- // Grammar for Python highlighting
- // See also: The Python Reference Manual
- // http://docs.python.org/ref/ref.html
- template <
- typename Process
- , typename Space
- , typename Macro
- , typename DoMacro
- , typename PreEscape
- , typename PostEscape
- , typename Unexpected
- , typename Out>
- struct python_highlight
- : public cl::grammar<python_highlight<Process, Space, Macro, DoMacro, PreEscape, PostEscape, Unexpected, Out> >
- {
- python_highlight(Out& out, Macro const& macro, DoMacro do_macro, actions& escape_actions)
- : out(out), macro(macro), do_macro(do_macro), escape_actions(escape_actions) {}
-
- template <typename Scanner>
- struct definition
- {
- definition(python_highlight const& self)
- : g(self.escape_actions.grammar())
- {
- program
- =
- *( (+cl::space_p) [Space(self.out)]
- | macro
- | escape
- | comment [Process("comment", self.out)]
- | keyword [Process("keyword", self.out)]
- | identifier [Process("identifier", self.out)]
- | special [Process("special", self.out)]
- | string_ [Process("string", self.out)]
- | number [Process("number", self.out)]
- | cl::repeat_p(1)[cl::anychar_p]
- [Unexpected(self.out, self.escape_actions)]
- )
- ;
-
- macro =
- // must not be followed by alpha or underscore
- cl::eps_p(self.macro
- >> (cl::eps_p - (cl::alpha_p | '_')))
- >> self.macro [self.do_macro]
- ;
-
- qbk_phrase =
- self.escape_actions.scoped_context(element_info::in_phrase)
- [
- *( g.common
- | (cl::anychar_p - cl::str_p("``"))
- [self.escape_actions.plain_char]
- )
- ]
- ;
-
- escape =
- cl::str_p("``") [PreEscape(self.escape_actions, save)]
- >>
- (
- (
- (
- (+(cl::anychar_p - "``") >> cl::eps_p("``"))
- & qbk_phrase
- )
- >> cl::str_p("``")
- )
- |
- (
- cl::eps_p [self.escape_actions.error]
- >> *cl::anychar_p
- )
- ) [PostEscape(self.out, self.escape_actions, save)]
- ;
-
- comment
- = cl::comment_p("#")
- ;
-
- keyword
- = keyword_ >> (cl::eps_p - (cl::alnum_p | '_'))
- ; // make sure we recognize whole words only
-
- keyword_
- =
- "and", "del", "for", "is", "raise",
- "assert", "elif", "from", "lambda", "return",
- "break", "else", "global", "not", "try",
- "class", "except", "if", "or", "while",
- "continue", "exec", "import", "pass", "yield",
- "def", "finally", "in", "print",
-
- // Technically "as" and "None" are not yet keywords (at Python
- // 2.4). They are destined to become keywords, and we treat them
- // as such for syntax highlighting purposes.
-
- "as", "None"
- ;
-
- special
- = +cl::chset_p("~!%^&*()+={[}]:;,<.>/|\\-")
- ;
-
- string_prefix
- = cl::as_lower_d[cl::str_p("u") >> ! cl::str_p("r")]
- ;
-
- string_
- = ! string_prefix >> (long_string | short_string)
- ;
-
- string_char = ('\\' >> cl::anychar_p) | (cl::anychar_p - '\\');
-
- short_string
- = cl::confix_p('\'', * string_char, '\'') |
- cl::confix_p('"', * string_char, '"')
- ;
-
- long_string
- // Note: the "cl::str_p" on the next two lines work around
- // an INTERNAL COMPILER ERROR when using VC7.1
- = cl::confix_p(cl::str_p("'''"), * string_char, "'''") |
- cl::confix_p(cl::str_p("\"\"\""), * string_char, "\"\"\"")
- ;
-
- number
- = (
- cl::as_lower_d["0x"] >> cl::hex_p
- | '0' >> cl::oct_p
- | cl::real_p
- )
- >> *cl::as_lower_d[cl::chset_p("lj")]
- ;
-
- identifier
- = (cl::alpha_p | '_') >> *(cl::alnum_p | '_')
- ;
- }
-
- cl::rule<Scanner>
- program, macro, comment, special, string_, string_prefix,
- short_string, long_string, number, identifier, keyword,
- qbk_phrase, escape, string_char;
-
- cl::symbols<> keyword_;
- quickbook_grammar& g;
- std::string save;
-
- cl::rule<Scanner> const&
- start() const { return program; }
- };
-
- Out& out;
- Macro const& macro;
- DoMacro do_macro;
- actions& escape_actions;
- };
-
- // Grammar for plain text (no actual highlighting)
- template <
- typename CharProcess
- , typename Macro
- , typename DoMacro
- , typename PreEscape
- , typename PostEscape
- , typename Out>
- struct teletype_highlight
- : public cl::grammar<teletype_highlight<CharProcess, Macro, DoMacro, PreEscape, PostEscape, Out> >
- {
- teletype_highlight(Out& out, Macro const& macro, DoMacro do_macro, actions& escape_actions)
- : out(out), macro(macro), do_macro(do_macro), escape_actions(escape_actions) {}
-
- template <typename Scanner>
- struct definition
- {
- definition(teletype_highlight const& self)
- : g(self.escape_actions.grammar())
- {
- program
- =
- *( macro
- | escape
- | cl::repeat_p(1)[cl::anychar_p] [CharProcess(self.out, self.escape_actions)]
- )
- ;
-
- macro =
- // must not be followed by alpha or underscore
- cl::eps_p(self.macro
- >> (cl::eps_p - (cl::alpha_p | '_')))
- >> self.macro [self.do_macro]
- ;
-
- qbk_phrase =
- self.escape_actions.scoped_context(element_info::in_phrase)
- [
- *( g.common
- | (cl::anychar_p - cl::str_p("``"))
- [self.escape_actions.plain_char]
- )
- ]
- ;
-
- escape =
- cl::str_p("``") [PreEscape(self.escape_actions, save)]
- >>
- (
- (
- (
- (+(cl::anychar_p - "``") >> cl::eps_p("``"))
- & qbk_phrase
- )
- >> cl::str_p("``")
- )
- |
- (
- cl::eps_p [self.escape_actions.error]
- >> *cl::anychar_p
- )
- ) [PostEscape(self.out, self.escape_actions, save)]
- ;
- }
-
- cl::rule<Scanner> program, macro, qbk_phrase, escape;
-
- quickbook_grammar& g;
- std::string save;
-
- cl::rule<Scanner> const&
- start() const { return program; }
- };
-
- Out& out;
- Macro const& macro;
- DoMacro do_macro;
- actions& escape_actions;
- };
-
-}
-
-#endif // BOOST_SPIRIT_QUICKBOOK_SYNTAX_HIGHLIGHT_HPP

Modified: branches/release/tools/quickbook/test/Jamfile.v2
==============================================================================
--- branches/release/tools/quickbook/test/Jamfile.v2 (original)
+++ branches/release/tools/quickbook/test/Jamfile.v2 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -26,6 +26,8 @@
     [ quickbook-test code-block-2 ]
     [ quickbook-test code-block-3 ]
     [ quickbook-test code-block-teletype ]
+ [ quickbook-test code-block-cpp ]
+ [ quickbook-test code-block-python ]
     [ quickbook-test code-snippet ]
     [ quickbook-test preformatted ]
     [ quickbook-test link ]

Modified: branches/release/tools/quickbook/test/anchor.gold
==============================================================================
--- branches/release/tools/quickbook/test/anchor.gold (original)
+++ branches/release/tools/quickbook/test/anchor.gold 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -6,42 +6,42 @@
   <section id="anchor_test.anchors">
     <title>Anchors</title>
     <para>
- <anchor id="a1"/> A paragraph containing several anchors. <anchor id="a2"/>
- We want to make sure they appear in the correct place. <anchor id="a3"/>
+ <anchor id="a1"/>A paragraph containing several anchors. <anchor id="a2"/>We
+ want to make sure they appear in the correct place. <anchor id="a3"/>
     </para>
     <anchor id="anchor_test.anchors.this_heading_shouldn_t_pick_up_the_previous_anchor"/>
     <bridgehead renderas="sect3" id="anchor_test.anchors.this_heading_shouldn_t_pick_up_the_previous_anchor-heading">
       <link linkend="anchor_test.anchors.this_heading_shouldn_t_pick_up_the_previous_anchor">This
       heading shouldn't pick up the previous anchor</link>
     </bridgehead>
- <anchor id="a4"/> <anchor id="anchor_test.anchors.this_heading_should_pick_up_the_previous_anchor"/>
+ <anchor id="a4"/><anchor id="anchor_test.anchors.this_heading_should_pick_up_the_previous_anchor"/>
     <bridgehead renderas="sect3" id="anchor_test.anchors.this_heading_should_pick_up_the_previous_anchor-heading">
       <link linkend="anchor_test.anchors.this_heading_should_pick_up_the_previous_anchor">This
       heading should pick up the previous anchor</link>
     </bridgehead>
- <anchor id="a5"/> <anchor id="anchor_test.anchors.and_this_one"/>
+ <anchor id="a5"/><anchor id="anchor_test.anchors.and_this_one"/>
     <bridgehead renderas="sect3" id="anchor_test.anchors.and_this_one-heading">
       <link linkend="anchor_test.anchors.and_this_one">And this one</link>
     </bridgehead>
- <anchor id="a6"/> <anchor id="anchor_test.anchors.also_this_one"/>
+ <anchor id="a6"/><anchor id="anchor_test.anchors.also_this_one"/>
     <bridgehead renderas="sect3" id="anchor_test.anchors.also_this_one-heading">
       <link linkend="anchor_test.anchors.also_this_one">Also this one</link>
     </bridgehead>
- <anchor id="a7"/> <anchor id="anchors.finally_this"/>
+ <anchor id="a7"/><anchor id="anchors.finally_this"/>
     <bridgehead renderas="sect3" id="anchors.finally_this-heading">
       Finally this
     </bridgehead>
     <anchor id="a8"/>
   </section>
   <section id="anchor_test.section_anchor">
- <title><anchor id="a9"/> Section Anchor</title>
+ <title><anchor id="a9"/>Section Anchor</title>
     <section id="anchor_test.nested_section">
- <title><anchor id="a10"/> Nested Section</title>
+ <title><anchor id="a10"/>Nested Section</title>
     </section>
     <anchor id="a11"/>
   </section>
   <section id="anchor_test.conditional_section_anchor">
- <title><anchor id="a12"/> Conditional Section Anchor</title>
+ <title><anchor id="a12"/>Conditional Section Anchor</title>
   </section>
   <section id="anchor_test.lists">
     <title>Lists</title> <anchor id="a14"/>

Copied: branches/release/tools/quickbook/test/code-block-cpp.gold (from r71098, /trunk/tools/quickbook/test/code-block-cpp.gold)
==============================================================================
--- /trunk/tools/quickbook/test/code-block-cpp.gold (original)
+++ branches/release/tools/quickbook/test/code-block-cpp.gold 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -8,10 +8,10 @@
 <phrase role="comment">/* No escape
  * with newlines
  */</phrase>
-<phrase role="comment">// In Header: &lt;</phrase><ulink url="boost:/boost/optional/optional.hpp">boost/optional/optional.hpp</ulink><phrase role="comment">&gt;</phrase>
-<phrase role="comment">/* In Header: &lt;</phrase><ulink url="boost:/boost/optional/optional.hpp">boost/optional/optional.hpp</ulink><phrase role="comment">&gt; */</phrase>
-<phrase role="comment">/* Multiple escapes: </phrase><emphasis>italic</emphasis><phrase role="comment">
- * </phrase><emphasis role="underline">underline</emphasis><emphasis role="bold">bold</emphasis><phrase role="comment">
+<phrase role="comment">// In Header: &lt;<ulink url="boost:/boost/optional/optional.hpp">boost/optional/optional.hpp</ulink>&gt;</phrase>
+<phrase role="comment">/* In Header: &lt;<ulink url="boost:/boost/optional/optional.hpp">boost/optional/optional.hpp</ulink>&gt; */</phrase>
+<phrase role="comment">/* Multiple escapes: <emphasis>italic</emphasis>
+ * <emphasis role="underline">underline</emphasis><emphasis role="bold">bold</emphasis>
  */</phrase>
 </programlisting>
   <para>
@@ -24,6 +24,6 @@
     A badly formed comment with an escape:
   </para>
   
-<programlisting><phrase role="comment">/* Oh dear </phrase><emphasis role="bold">bold</emphasis><phrase role="comment">
+<programlisting><phrase role="comment">/* Oh dear <emphasis role="bold">bold</emphasis>
 </phrase></programlisting>
 </article>

Copied: branches/release/tools/quickbook/test/code-block-python.gold (from r71098, /trunk/tools/quickbook/test/code-block-python.gold)
==============================================================================
--- /trunk/tools/quickbook/test/code-block-python.gold (original)
+++ branches/release/tools/quickbook/test/code-block-python.gold 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -4,7 +4,7 @@
  xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>Python Code Blocks</title>
 <programlisting><phrase role="comment"># No escape</phrase>
-<phrase role="comment"># Escape: </phrase><emphasis role="bold">bold</emphasis>
-<phrase role="comment"># Escape: </phrase><emphasis role="underline">underline</emphasis><emphasis>italic</emphasis>
+<phrase role="comment"># Escape: <emphasis role="bold">bold</emphasis></phrase>
+<phrase role="comment"># Escape: <emphasis role="underline">underline</emphasis><emphasis>italic</emphasis></phrase>
 </programlisting>
 </article>

Modified: branches/release/tools/quickbook/test/import.gold
==============================================================================
--- branches/release/tools/quickbook/test/import.gold (original)
+++ branches/release/tools/quickbook/test/import.gold 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -27,8 +27,8 @@
     
 <programlisting><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">string</phrase> <phrase role="identifier">foo</phrase><phrase role="special">()</phrase>
 <phrase role="special">{</phrase>
- <phrase role="comment">// return 'em, foo man!
-</phrase> <phrase role="keyword">return</phrase> <phrase role="string">&quot;foo&quot;</phrase><phrase role="special">;</phrase>
+ <phrase role="comment">// return 'em, foo man!</phrase>
+ <phrase role="keyword">return</phrase> <phrase role="string">&quot;foo&quot;</phrase><phrase role="special">;</phrase>
 <phrase role="special">}</phrase>
 </programlisting>
   </para>
@@ -57,8 +57,8 @@
   <para>
     
 <programlisting><phrase role="keyword">def</phrase> <phrase role="identifier">foo</phrase><phrase role="special">():</phrase>
- <phrase role="comment"># return 'em, foo man!
-</phrase> <phrase role="keyword">return</phrase> <phrase role="string">&quot;foo&quot;</phrase>
+ <phrase role="comment"># return 'em, foo man!</phrase>
+ <phrase role="keyword">return</phrase> <phrase role="string">&quot;foo&quot;</phrase>
 
 </programlisting>
   </para>
@@ -87,8 +87,8 @@
     
 <programlisting><phrase role="keyword">char</phrase><phrase role="special">*</phrase> <phrase role="identifier">foo</phrase><phrase role="special">()</phrase>
 <phrase role="special">{</phrase>
- <phrase role="comment">// return 'em, foo man!
-</phrase> <phrase role="keyword">return</phrase> <phrase role="string">&quot;foo&quot;</phrase><phrase role="special">;</phrase>
+ <phrase role="comment">// return 'em, foo man!</phrase>
+ <phrase role="keyword">return</phrase> <phrase role="string">&quot;foo&quot;</phrase><phrase role="special">;</phrase>
 <phrase role="special">}</phrase>
 </programlisting>
   </para>

Modified: branches/release/tools/quickbook/test/link.gold
==============================================================================
--- branches/release/tools/quickbook/test/link.gold (original)
+++ branches/release/tools/quickbook/test/link.gold 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -7,7 +7,7 @@
     <para>
       <ulink url="http://www.boost.org/">http://www.boost.org/> <ulink url="http://www.boost.org/">Boost</ulink>
       <link linkend="link-id">link-id</link> <link linkend="link-id">Link Text</link>
- <anchor id="link-id"/> <functionname alt="foo">foo</functionname> <functionname
+ <anchor id="link-id"/><functionname alt="foo">foo</functionname> <functionname
       alt="foo">link text</functionname> <classname alt="foo">foo</classname> <classname
       alt="foo">link text</classname> <methodname alt="foo">foo</methodname> <methodname
       alt="foo">link text</methodname> <enumname alt="foo">foo</enumname> <enumname

Modified: branches/release/tools/quickbook/test/quickbook-manual.gold
==============================================================================
--- branches/release/tools/quickbook/test/quickbook-manual.gold (original)
+++ branches/release/tools/quickbook/test/quickbook-manual.gold 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -1549,8 +1549,8 @@
 
 <phrase role="keyword">int</phrase> <phrase role="identifier">main</phrase><phrase role="special">()</phrase>
 <phrase role="special">{</phrase>
- <phrase role="comment">// Sample code
-</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special">&lt;&lt;</phrase> <phrase role="string">&quot;Hello, World\n&quot;</phrase><phrase role="special">;</phrase>
+ <phrase role="comment">// Sample code</phrase>
+ <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special">&lt;&lt;</phrase> <phrase role="string">&quot;Hello, World\n&quot;</phrase><phrase role="special">;</phrase>
     <phrase role="keyword">return</phrase> <phrase role="number">0</phrase><phrase role="special">;</phrase>
 <phrase role="special">}</phrase>
 </programlisting>
@@ -2714,8 +2714,8 @@
           
 <programlisting><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">string</phrase> <phrase role="identifier">foo</phrase><phrase role="special">()</phrase>
 <phrase role="special">{</phrase>
- <phrase role="comment">// return 'em, foo man!
-</phrase> <phrase role="keyword">return</phrase> <phrase role="string">&quot;foo&quot;</phrase><phrase role="special">;</phrase>
+ <phrase role="comment">// return 'em, foo man!</phrase>
+ <phrase role="keyword">return</phrase> <phrase role="string">&quot;foo&quot;</phrase><phrase role="special">;</phrase>
 <phrase role="special">}</phrase>
 </programlisting>
         </para>
@@ -2726,8 +2726,8 @@
           
 <programlisting><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">string</phrase> <phrase role="identifier">bar</phrase><phrase role="special">()</phrase>
 <phrase role="special">{</phrase>
- <phrase role="comment">// return 'em, bar man!
-</phrase> <phrase role="keyword">return</phrase> <phrase role="string">&quot;bar&quot;</phrase><phrase role="special">;</phrase>
+ <phrase role="comment">// return 'em, bar man!</phrase>
+ <phrase role="keyword">return</phrase> <phrase role="string">&quot;bar&quot;</phrase><phrase role="special">;</phrase>
 <phrase role="special">}</phrase></programlisting>
         </para>
         <para>
@@ -2743,10 +2743,10 @@
           get marked up. We use distinguishable comments following the form:
         </para>
         
-<programlisting><phrase role="comment">//[id
-</phrase><phrase role="identifier">some</phrase> <phrase role="identifier">code</phrase> <phrase role="identifier">here</phrase>
-<phrase role="comment">//]
-</phrase></programlisting>
+<programlisting><phrase role="comment">//[id</phrase>
+<phrase role="identifier">some</phrase> <phrase role="identifier">code</phrase> <phrase role="identifier">here</phrase>
+<phrase role="comment">//]</phrase>
+</programlisting>
         <para>
           The first comment line above initiates a named code-snippet. This prefix
           will not be visible in quickbook. The entire code-snippet in between <code><phrase
@@ -2764,8 +2764,8 @@
           Special comments of the form:
         </para>
         
-<programlisting><phrase role="comment">//` some [*quickbook] markup here
-</phrase></programlisting>
+<programlisting><phrase role="comment">//` some [*quickbook] markup here</phrase>
+</programlisting>
         <para>
           and:
         </para>
@@ -3029,8 +3029,8 @@
     <phrase role="special">:</phrase> <phrase role="special">/</phrase><phrase role="identifier">usr</phrase><phrase role="special">/</phrase><phrase role="identifier">share</phrase><phrase role="special">/</phrase><phrase role="identifier">xml</phrase><phrase role="special">/</phrase><phrase role="identifier">docbook</phrase><phrase role="special">/</phrase><phrase role="identifier">schema</phrase><phrase role="special">/</phrase><phrase role="identifier">dtd</phrase><phrase role="special">/</phrase><phrase role="number">4.2</phrase>
     <phrase role="special">;</phrase>
 
-<phrase role="comment"># Remove this line if you're not using doxygen
-</phrase><phrase role="identifier">using</phrase> <phrase role="identifier">doxygen</phrase> <phrase role="special">;</phrase>
+<phrase role="comment"># Remove this line if you're not using doxygen</phrase>
+<phrase role="identifier">using</phrase> <phrase role="identifier">doxygen</phrase> <phrase role="special">;</phrase>
 </programlisting>
       <para>
         The above steps are enough to get a functional BoostBook setup. Quickbook

Modified: branches/release/tools/quickbook/test/simple_markup.gold
==============================================================================
--- branches/release/tools/quickbook/test/simple_markup.gold (original)
+++ branches/release/tools/quickbook/test/simple_markup.gold 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -46,5 +46,8 @@
     <para>
       /not italic/
     </para>
+ <para>
+ These shouldn't be interepted as markup: == // **
+ </para>
   </section>
 </article>

Modified: branches/release/tools/quickbook/test/simple_markup.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/simple_markup.quickbook (original)
+++ branches/release/tools/quickbook/test/simple_markup.quickbook 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -33,4 +33,6 @@
 
 /not italic\/
 
+These shouldn't be interepted as markup: == // **
+
 [endsect]
\ No newline at end of file

Modified: branches/release/tools/quickbook/test/table_1_5.gold
==============================================================================
--- branches/release/tools/quickbook/test/table_1_5.gold (original)
+++ branches/release/tools/quickbook/test/table_1_5.gold 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -306,7 +306,7 @@
           <row>
             <entry>
               <para>
- <anchor id="id2"/> a<anchor id="id3"/>
+ <anchor id="id2"/>a<anchor id="id3"/>
               </para>
             </entry>
           </row>

Modified: branches/release/tools/quickbook/test/templates.gold
==============================================================================
--- branches/release/tools/quickbook/test/templates.gold (original)
+++ branches/release/tools/quickbook/test/templates.gold 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -67,6 +67,9 @@
   <section id="templates.nested_templates">
     <title><link linkend="templates.nested_templates">Nested Templates</link></title>
     <para>
+ Pre
+ </para>
+ <para>
       Start block template.
     </para>
     <para>
@@ -82,6 +85,12 @@
       End block template.
     </para>
     <para>
+ Post
+ </para>
+ <para>
+ Pre
+ </para>
+ <para>
       Start block template.
     </para>
     <para>
@@ -91,6 +100,12 @@
       End block template.
     </para>
     <para>
+ Post
+ </para>
+ <para>
+ Pre
+ </para>
+ <para>
       Start phrase template.
     </para>
     <para>
@@ -103,8 +118,79 @@
       End block template.
     </para>
     <para>
- End phrase template. Start phrase template. Start phrase template. Hello! End
- phrase template. End phrase template.
+ End phrase template.
+ </para>
+ <para>
+ Post
     </para>
+ <para>
+ Pre Start phrase template. Start phrase template. Hello! End phrase template.
+ End phrase template. Post
+ </para>
+ </section>
+ <section id="templates.block_markup">
+ <title><link linkend="templates.block_markup">Block Markup</link></title>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ a
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ b
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ <para/>
+
+<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">main</phrase><phrase role="special">()</phrase> <phrase role="special">{}</phrase>
+</programlisting>
+ <para>
+ Paragraphs 1
+ </para>
+ <para>
+ Paragraphs 2
+ </para>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ a
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ b
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <para/>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+
+<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">main</phrase><phrase role="special">()</phrase> <phrase role="special">{}</phrase>
+</programlisting>
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ <para>
+ Paragraphs 1
+ </para>
+ <para>
+ Paragraphs 2
+ </para>
+ </simpara>
+ </listitem>
+ </itemizedlist>
   </section>
 </article>

Modified: branches/release/tools/quickbook/test/templates.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/templates.quickbook (original)
+++ branches/release/tools/quickbook/test/templates.quickbook 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -160,9 +160,41 @@
 
 [template phrase[content] Start phrase template. [content] End phrase template.]
 
-[block [block Hello!]]
-[block [phrase Hello!]]
-[phrase [block Hello!]]
-[phrase [phrase Hello!]]
+Pre [block [block Hello!]] Post
 
-[endsect]
\ No newline at end of file
+Pre [block [phrase Hello!]] Post
+
+Pre [phrase [block Hello!]] Post
+
+Pre [phrase [phrase Hello!]] Post
+
+[endsect]
+
+[/----------------------------------- Block Markup ]
+
+[section Block Markup]
+
+[template list
+* a
+* b]
+
+[template horizontal
+----]
+
+[template codeblock
+ int main() {}]
+
+[template paragraphs
+Paragraphs 1
+
+Paragraphs 2
+]
+
+[list][horizontal][codeblock][paragraphs]
+
+* [list]
+* [horizontal]
+* [codeblock]
+* [paragraphs]
+
+[endsect]

Modified: branches/release/tools/quickbook/test/variablelist.gold
==============================================================================
--- branches/release/tools/quickbook/test/variablelist.gold (original)
+++ branches/release/tools/quickbook/test/variablelist.gold 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -96,10 +96,10 @@
   <variablelist>
     <title>Variable List with anchors</title>
     <varlistentry>
- <term><anchor id="id2"/> a<anchor id="id3"/> </term>
+ <term><anchor id="id2"/>a<anchor id="id3"/></term>
       <listitem>
         <para>
- <anchor id="id4"/> b<anchor id="id5"/>
+ <anchor id="id4"/>b<anchor id="id5"/>
         </para>
       </listitem>
     </varlistentry>

Modified: branches/release/tools/quickbook/test/variablelist.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/variablelist.quickbook (original)
+++ branches/release/tools/quickbook/test/variablelist.quickbook 2011-05-10 14:39:38 EDT (Tue, 10 May 2011)
@@ -23,9 +23,9 @@
 
 [#id1]
 [variablelist Variable List with anchors
- [
- [[#id2]a[#id3]]
- [[#id4]b[#id5]]
- ]
+ [
+ [[#id2]a[#id3]]
+ [[#id4]b[#id5]]
+ ]
 ]
-
+


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