Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67784 - in branches/release/tools/quickbook: . doc src test
From: dnljms_at_[hidden]
Date: 2011-01-08 10:22:23


Author: danieljames
Date: 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
New Revision: 67784
URL: http://svn.boost.org/trac/boost/changeset/67784

Log:
Merge quickbook from trunk.

Left docs out of this merge, I want to do a little work on them.

- Add 'lang' element to docinfo.
- Improved anchor implementation. Especially for using an anchor before a
  section or heading.
- Reorganize the grammar, there's now a single main grammar. Elements are added
  separately using the Nabialek trick.
- Fixed some more issues where lines containing comments were treated as blank
  lines.
- Introduce a spirit rule for scoped actions when parsing. Could do with some
  improvement, but works okay.
- Allow import, include and xinclude in conditional phrases. Will allow more
  block elements in a future version.
- Use filesystem 3. Remove cygwin support.

Added:
   branches/release/tools/quickbook/src/block_element_grammar.cpp
      - copied unchanged from r67782, /trunk/tools/quickbook/src/block_element_grammar.cpp
   branches/release/tools/quickbook/src/grammar.cpp
      - copied, changed from r67335, /trunk/tools/quickbook/src/grammar.cpp
   branches/release/tools/quickbook/src/grammar_impl.hpp
      - copied, changed from r67335, /trunk/tools/quickbook/src/grammar_impl.hpp
   branches/release/tools/quickbook/src/main_grammar.cpp
      - copied, changed from r67335, /trunk/tools/quickbook/src/main_grammar.cpp
   branches/release/tools/quickbook/src/phrase_element_grammar.cpp
      - copied unchanged from r67782, /trunk/tools/quickbook/src/phrase_element_grammar.cpp
   branches/release/tools/quickbook/src/rule_store.hpp
      - copied unchanged from r67335, /trunk/tools/quickbook/src/rule_store.hpp
   branches/release/tools/quickbook/src/scoped_parser.hpp
      - copied unchanged from r67637, /trunk/tools/quickbook/src/scoped_parser.hpp
   branches/release/tools/quickbook/test/anchor.gold
      - copied, changed from r67335, /trunk/tools/quickbook/test/anchor.gold
   branches/release/tools/quickbook/test/anchor.quickbook
      - copied, changed from r67335, /trunk/tools/quickbook/test/anchor.quickbook
Removed:
   branches/release/tools/quickbook/src/block_grammar.cpp
   branches/release/tools/quickbook/src/phrase_grammar.cpp
   branches/release/tools/quickbook/src/phrase_grammar.hpp
   branches/release/tools/quickbook/src/scoped_block.hpp
Properties modified:
   branches/release/tools/quickbook/ (props changed)
   branches/release/tools/quickbook/src/ (props changed)
   branches/release/tools/quickbook/test/ (props changed)
Text files modified:
   branches/release/tools/quickbook/doc/Jamfile.v2 | 2
   branches/release/tools/quickbook/doc/quickbook.qbk | 145 ++++++++++++-------
   branches/release/tools/quickbook/src/Jamfile.v2 | 6
   branches/release/tools/quickbook/src/actions.cpp | 282 ++++++++++++++++++++++++++++++---------
   branches/release/tools/quickbook/src/actions.hpp | 273 ++++++++++++++++++++++++++++---------
   branches/release/tools/quickbook/src/actions_class.cpp | 227 +++++++++++++++++--------------
   branches/release/tools/quickbook/src/actions_class.hpp | 28 +++
   branches/release/tools/quickbook/src/doc_info_actions.cpp | 15 +
   branches/release/tools/quickbook/src/doc_info_grammar.cpp | 155 ++++++++-------------
   branches/release/tools/quickbook/src/fwd.hpp | 3
   branches/release/tools/quickbook/src/grammar.cpp | 5
   branches/release/tools/quickbook/src/grammar.hpp | 89 ++++--------
   branches/release/tools/quickbook/src/grammar_impl.hpp | 8
   branches/release/tools/quickbook/src/input_path.cpp | 33 ----
   branches/release/tools/quickbook/src/main_grammar.cpp | 43 ++++-
   branches/release/tools/quickbook/src/quickbook.cpp | 17 -
   branches/release/tools/quickbook/src/syntax_highlight.cpp | 8
   branches/release/tools/quickbook/src/syntax_highlight.hpp | 28 +--
   branches/release/tools/quickbook/src/utils.hpp | 25 +++
   branches/release/tools/quickbook/test/Jamfile.v2 | 3
   branches/release/tools/quickbook/test/anchor.gold | 9
   branches/release/tools/quickbook/test/anchor.quickbook | 10
   branches/release/tools/quickbook/test/blocks.gold | 23 +++
   branches/release/tools/quickbook/test/blocks.quickbook | 6
   branches/release/tools/quickbook/test/cond_phrase.gold | 3
   branches/release/tools/quickbook/test/cond_phrase.quickbook | 8
   branches/release/tools/quickbook/test/doc-info-1.gold | 4
   branches/release/tools/quickbook/test/doc-info-1.quickbook | 1
   branches/release/tools/quickbook/test/include_1_5.gold | 12 +
   branches/release/tools/quickbook/test/include_1_5.quickbook | 6
   branches/release/tools/quickbook/test/include_1_6.gold | 12 +
   branches/release/tools/quickbook/test/include_1_6.quickbook | 7
   branches/release/tools/quickbook/test/link.gold | 19 +-
   branches/release/tools/quickbook/test/quickbook-testing.jam | 4
   branches/release/tools/quickbook/test/table_1_5.gold | 60 ++++++++
   branches/release/tools/quickbook/test/table_1_5.quickbook | 29 ++++
   36 files changed, 1052 insertions(+), 556 deletions(-)

Modified: branches/release/tools/quickbook/doc/Jamfile.v2
==============================================================================
--- branches/release/tools/quickbook/doc/Jamfile.v2 (original)
+++ branches/release/tools/quickbook/doc/Jamfile.v2 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -23,7 +23,7 @@
     :
         <xsl:param>boost.root=../../../..
         <xsl:param>generate.section.toc.level=3
- <xsl:param>chunk.section.depth=2
+ <xsl:param>chunk.section.depth=1
         <xsl:param>chunk.first.sections=1
 
         #<xsl:param>callout.graphics.path=../../images/callouts//

Modified: branches/release/tools/quickbook/doc/quickbook.qbk
==============================================================================
--- branches/release/tools/quickbook/doc/quickbook.qbk (original)
+++ branches/release/tools/quickbook/doc/quickbook.qbk 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -106,7 +106,7 @@
 * automatic syntax coloring of code samples
 * CSS support
 
-[endsect]
+[endsect] [/Introduction]
 
 [section:change_log Change Log]
 
@@ -238,7 +238,7 @@
   * XML escape documentation fields, with escapes to allow encoding unicode
     in ASCII.
 
-[endsect]
+[endsect] [/Change log]
 
 [section:syntax Syntax Summary]
 
@@ -278,7 +278,7 @@
 
 [/ for testing [*only ] ]
 
-[endsect]
+[endsect] [/Comments]
 
 [section:phrase Phrase Level Elements]
 
@@ -302,7 +302,7 @@
 
 [*['bold-italic]]
 
-[endsect]
+[endsect] [/Font Styles]
 
 [section Replaceable]
 
@@ -316,7 +316,7 @@
 
 [~replacement]
 
-[endsect]
+[endsect] [/Replaceable]
 
 [section Quotations]
 
@@ -344,7 +344,8 @@
 ["Here's the rule for bargains: ["Do other men, for they would do you.]
 That's the true business precept.]
 
-[endsect]
+[endsect] [/Quotations]
+
 [section Simple formatting]
 
 Simple markup for formatting text, common in many applications, is now supported:
@@ -426,7 +427,8 @@
 One for the master, one for the dame,
 And one for the little boy who lives down the lane.
 
-[endsect]
+[endsect] [/Simple Formatting]
+
 [section Inline code]
 
 Inlining code in paragraphs is quite common when writing C++ documentation. We
@@ -445,7 +447,8 @@
 single quote: `"'"`. Note too that [^'''`some code`'''] is preferred over
 [^'''[^some code]''']. ]
 
-[endsect]
+[endsect] [/Inline Code]
+
 [section Code blocks]
 
 Preformatted code simply starts with a space or a tab (See __code__).
@@ -482,7 +485,8 @@
     }
 ``
 
-[endsect]
+[endsect] [/Code blocks]
+
 [section Source Mode]
 
 If a document contains more than one type of source code then the source
@@ -514,7 +518,8 @@
 
 [note The source mode strings are lowercase.]
 
-[endsect]
+[endsect] [/Source Mode]
+
 [section line-break]
 
 [pre'''
@@ -539,7 +544,8 @@
 quickbook documentation. Be careful to avoid clashes with anchors in
 other sections.
 
-[endsect]
+[endsect] [/Line break]
+
 [section Links]
 
 [pre'''
@@ -578,7 +584,8 @@
 Note that this is only available when using BoostBook, and only for links
 - it can't be used for images.
 
-[endsect]
+[endsect] [/Links]
+
 [section Anchor links]
 
 You can link within a document using:
@@ -589,7 +596,8 @@
 
 See sections __section__ and __heading__ for more info.
 
-[endsect]
+[endsect] [/Anchor links]
+
 [section refentry links]
 
 In addition, you can link internally to an XML refentry like:
@@ -609,7 +617,8 @@
 
 This gets converted into [^<link linkend="xml.refentry">xml.refentry</link>].
 
-[endsect]
+[endsect] [/refentry links]
+
 [section:code_links Code Links]
 
 If you want to link to a function, class, member, enum, concept, global, or header in
@@ -636,7 +645,8 @@
 
 would have "boost::bar::baz" as the link text.
 
-[endsect]
+[endsect] [/Code Links]
+
 [section Escape]
 
 The escape mark-up is used when we don't want to do any processing.
@@ -662,7 +672,8 @@
 [important Be careful when using the escape. The text must conform to
 __boostbook__/__docbook__ syntax.]
 
-[endsect]
+[endsect] [/Escape]
+
 [section Single char escape]
 
 The backslash may be used to escape a single punctuation character. The
@@ -679,7 +690,8 @@
 The escaped space: `\ ` also has a special meaning. The escaped space is removed
 from the output.
 
-[endsect]
+[endsect] [/Single char escape]
+
 [section Unicode escape]
 
 You can enter any 16-bit unicode character by using `\u` followed by its 4 digit
@@ -696,7 +708,8 @@
 \u03B1 + \u03B2
 ]
 
-[endsect]
+[endsect] [/Unicode escape]
+
 [section Images]
 
 [pre'''
@@ -711,7 +724,8 @@
 [$image.jpg [width 200in] [height 200in]]
 ''']
 
-[endsect]
+[endsect] [/Images]
+
 [section Footnotes]
 
 As of version 1.3, QuickBook supports footnotes. Just put the text of the
@@ -724,6 +738,8 @@
 
 will generate this[footnote A sample footnote].
 
+[endsect] [/Footnotes]
+
 [section Macro Expansion]
 
 [pre'''
@@ -732,7 +748,7 @@
 
 See __macros__ for details.
 
-[endsect]
+[endsect] [/Macro Expansion]
 
 [section Template Expansion]
 
@@ -742,9 +758,7 @@
 
 See __templates__ for details.
 
-[endsect]
-
-[endsect]
+[endsect] [/Template Expansion]
 
 [section:cond Conditional Generation]
 
@@ -774,9 +788,10 @@
 
 Yes![footnote Conditional Generation makes quickbook turing complete.]
 
-[endsect]
+[endsect] [/Condition Generation]
+
+[endsect] [/Phrase Level Elements]
 
-[endsect]
 [section:block Block Level Elements]
 
 [section Document]
@@ -827,7 +842,8 @@
 =source-type= is a lowercase string setting the initial __source_mode__. If
 the =source-mode= field is omitted, a default value of =c++= will be used.
 
-[endsect]
+[endsect] [/Document]
+
 [section Section]
 
 Starting a new section is accomplished with:
@@ -850,7 +866,8 @@
 
 Sections can nest, and that results in a hierarchy in the table of contents.
 
-[endsect]
+[endsect] [/Section]
+
 [section xinclude]
 
 You can include another XML file with:
@@ -862,7 +879,8 @@
 This is useful when file.xml has been generated by Doxygen and contains your
 reference section.
 
-[endsect]
+[endsect] [/xinclude]
+
 [section Paragraphs]
 
 Paragraphs start left-flushed and are terminated by two or more newlines. No
@@ -872,7 +890,7 @@
  [/ <-- There's a space here. Don't remove. this is intentianal, for testing]
 This is a new paragraph...
 
-[endsect]
+[endsect] [/Paragraphs]
 
 [section Lists]
 [section Ordered lists]
@@ -889,7 +907,7 @@
 # Two
 # Three
 
-[endsect]
+[endsect] [/Ordered lists]
 [section List Hierarchies]
 
 List hierarchies are supported. Example:
@@ -922,7 +940,7 @@
         # Four.a.ii
 # Five
 
-[endsect]
+[endsect] [/List Hierarchies]
 [section Long List Lines]
 
 Long lines will be wrapped appropriately. Example:
@@ -945,7 +963,7 @@
   A very long item. A very long item. A very long item.
 # A short item.
 
-[endsect]
+[endsect] [/Long list lines]
 [section Unordered lists]
 
 [pre'''
@@ -960,7 +978,7 @@
 * Second
 * Third
 
-[endsect]
+[endsect] [/Unordered lists]
 [section Mixed lists]
 
 Mixed lists (ordered and unordered) are supported. Example:
@@ -1017,8 +1035,8 @@
             * 2.b.2.a
             * 2.b.2.b
 
-[endsect]
-[endsect]
+[endsect] [/Mixed lists]
+[endsect] [/Lists]
 
 [section Code]
 
@@ -1063,7 +1081,8 @@
 
     using __boost__::__array__;
 
-[endsect]
+[endsect] [/Code]
+
 [section:escape_back Escaping Back To QuickBook]
 
 Inside code, code blocks and inline code, QuickBook does not allow any
@@ -1087,7 +1106,8 @@
 When escaping from code to QuickBook, only phrase level markups are
 allowed. Block level markups like lists, tables etc. are not allowed.
 
-[endsect]
+[endsect] [/Escaping back to quickbook]
+
 [section Preformatted]
 
 Sometimes, you don't want some preformatted text to be parsed as C++. In such
@@ -1122,7 +1142,8 @@
 Notice that unlike Code, phrase markup such as font style is still permitted
 inside =pre= blocks.
 
-[endsect]
+[endsect] [/Preformatted]
+
 [section Blockquote]
 
 [pre
@@ -1131,7 +1152,8 @@
 
 [:Indents the paragraph. This applies to one paragraph only.]
 
-[endsect]
+[endsect] [/Blockquote]
+
 [section Admonitions]
 
 [pre'''
@@ -1154,7 +1176,8 @@
 for example [^\[information This is some information\]] is unlikely
 to produce the desired effect.
 
-[endsect]
+[endsect] [/Admonitions]
+
 [section Headings]
 
 [pre'''
@@ -1187,7 +1210,8 @@
 
 to link to them. See __anchor_links__ and __section__ for more info.
 
-[endsect]
+[endsect] [/Headings]
+
 [section Generic Heading]
 
 In cases when you don't want to care about the heading level (1 to 6), you
@@ -1232,7 +1256,8 @@
 with /section/ and /heading/, you have all you need. /h1/../h6/ becomes
 redundant. /h1/../h6/ might be deprecated in the future.
 
-[endsect]
+[endsect] [/Generic Heading]
+
 [section Macros]
 
 [pre'''
@@ -1284,7 +1309,8 @@
 
 Hi __spirit__ :-)
 
-[endsect]
+[endsect] [/Macros]
+
 [section Predefined Macros]
 
 Quickbook has some predefined macros that you can already use.
@@ -1296,7 +1322,8 @@
     [['''__FILENAME__'''] [Quickbook source filename] [__FILENAME__]]
 ]
 
-[endsect]
+[endsect] [/Predefined Macros]
+
 [section Templates]
 
 Templates provide a more versatile text substitution mechanism. Templates
@@ -1550,7 +1577,8 @@
 <hey>baz</hey>
 ]
 
-[endsect]
+[endsect] [/Templates]
+
 [section Blurbs]
 
 [pre'''
@@ -1576,7 +1604,8 @@
 [note Prefer [link quickbook.syntax.block.admonitions admonitions] wherever
 appropriate.]
 
-[endsect]
+[endsect] [/Blurbs]
+
 [section Tables]
 
 [pre'''
@@ -1699,7 +1728,8 @@
     ]
 ]
 
-[endsect]
+[endsect] [/Tables]
+
 [section Variable Lists]
 
 [pre'''
@@ -1731,7 +1761,8 @@
 the second column contains the definitions. Those familiar with HTML
 will recognize this as a "definition list".
 
-[endsect]
+[endsect] [/Variable Lists]
+
 [section Include]
 
 You can include one QuickBook file from another. The syntax is simply:
@@ -1761,7 +1792,7 @@
 named anchor for that section will be "someid.intro", and you can link to
 it with [^\[link someid.intro The Intro\]].
 
-[endsect]
+[endsect] [/Include]
 
 [section Import]
 
@@ -1896,10 +1927,11 @@
 
 See the actual code here: [@boost:/tools/quickbook/test/stub.cpp]
 
-[endsect]
+[endsect] [/Import]
 
-[endsect]
-[endsect]
+[endsect] [/Block Level Elements]
+
+[endsect] [/Syntax Summary]
 
 [section:install Installation and configuration]
 
@@ -1993,7 +2025,7 @@
 package system to avoid manual management of the installations. In that
 case, check out [@http://www.pkgsrc.org pkgsrc].
 
-[endsect]
+[endsect] [/Mac OS X]
 
 [section:windows Windows 2000, XP, 2003, Vista]
 
@@ -2065,7 +2097,7 @@
      : "C:/Users/example/Documents/boost/xml/bin/quickbook.exe"
      ;
 
-[endsect]
+[endsect] [/Windows]
 
 [section:linux Debian, Ubuntu]
 
@@ -2116,7 +2148,8 @@
      : /usr/local/bin/quickbook
      ;
 
-[endsect]
+[endsect] [/Linux]
+
 [endsect] [/Installation and configuration]
 
 [section:editors Editor Support]
@@ -2301,4 +2334,4 @@
                             [[^'''[? symbol phrase]''']] [__cond__]]
 ]
 
-[endsect]
+[endsect] [/ quick reference]

Modified: branches/release/tools/quickbook/src/Jamfile.v2
==============================================================================
--- branches/release/tools/quickbook/src/Jamfile.v2 (original)
+++ branches/release/tools/quickbook/src/Jamfile.v2 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -30,8 +30,10 @@
     code_snippet.cpp
     markups.cpp
     syntax_highlight.cpp
- block_grammar.cpp
- phrase_grammar.cpp
+ grammar.cpp
+ main_grammar.cpp
+ block_element_grammar.cpp
+ phrase_element_grammar.cpp
     doc_info_grammar.cpp
     /boost//program_options
     /boost//filesystem

Modified: branches/release/tools/quickbook/src/actions.cpp
==============================================================================
--- branches/release/tools/quickbook/src/actions.cpp (original)
+++ branches/release/tools/quickbook/src/actions.cpp 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -11,8 +11,8 @@
 #include <numeric>
 #include <functional>
 #include <algorithm>
-#include <boost/filesystem/v2/convenience.hpp>
-#include <boost/filesystem/v2/fstream.hpp>
+#include <boost/filesystem/v3/convenience.hpp>
+#include <boost/filesystem/v3/fstream.hpp>
 #include <boost/lexical_cast.hpp>
 #include "quickbook.hpp"
 #include "actions.hpp"
@@ -47,6 +47,8 @@
     // Handles line-breaks (DEPRECATED!!!)
     void break_action::operator()(iterator first, iterator) const
     {
+ if(!actions.output_pre(phrase)) return;
+
         position const pos = first.get_position();
         detail::outwarn(pos.file,pos.line) << "in column:" << pos.column << ", "
             << "[br] and \\n are deprecated" << ".\n";
@@ -63,11 +65,15 @@
 
     void tagged_action::operator()(std::string const& str) const
     {
+ if(!actions.output_pre(out)) return;
+
         out << pre << str << post;
     }
 
- void phrase_action::operator()(iterator first, iterator last) const
+ void phrase_action::operator()() const
     {
+ if(!actions.output_pre(phrase)) return;
+
         std::string str;
         phrase.swap(str);
         out << pre << str << post;
@@ -75,6 +81,8 @@
 
     void implicit_paragraph_action::operator()() const
     {
+ if(actions.suppress) return;
+
         std::string str;
         phrase.swap(str);
 
@@ -91,36 +99,51 @@
         }
 
         if(pos != end) {
- out << pre << str << post;
+ out << pre << str;
+ // TODO: Is this right place?
+ actions.output_pre(out);
+ out << post;
         }
     }
 
     void header_action::operator()(iterator first, iterator last) const
     {
+ if(actions.suppress) return;
+
         std::string str;
         phrase.swap(str);
 
+ std::string anchor;
+
         if (qbk_version_n < 103) // version 1.2 and below
         {
- out << "<anchor id=\""
- << section_id << '.'
- << detail::make_identifier(str.begin(), str.end())
- << "\" />"
- << pre << str << post
- ;
+ anchor = section_id + '.' +
+ detail::make_identifier(str.begin(), str.end());
         }
- else // version 1.3 and above
+ else
         {
             std::string id =
                 !element_id.empty() ? element_id :
                 qbk_version_n >= 106 ? detail::make_identifier(first, last) :
                 detail::make_identifier(str.begin(), str.end());
 
- std::string anchor =
+ anchor =
                 fully_qualified_id(library_id, qualified_section_id, id);
+ }
 
- out << "<anchor id=\"" << anchor << "\"/>"
- << pre
+ actions.output_pre(out);
+ actions.anchors.swap(actions.saved_anchors);
+ actions.anchors.push_back(anchor);
+ actions.output_pre(out);
+
+ if (qbk_version_n < 103)
+ {
+ out << pre << str << post
+ ;
+ }
+ else // version 1.3 and above
+ {
+ out << pre
                 << "<link linkend=\"" << anchor << "\">"
                 << str
                 << "</link>"
@@ -131,6 +154,8 @@
 
     void generic_header_action::operator()(iterator first, iterator last) const
     {
+ if(actions.suppress) return;
+
         int level_ = section_level + 2; // section_level is zero-based. We need to use a
                                             // 0ne-based heading which is one greater
                                             // than the current. Thus: section_level + 2.
@@ -147,8 +172,12 @@
         std::string anchor =
             fully_qualified_id(library_id, qualified_section_id, id);
 
+ actions.output_pre(out);
+ actions.anchors.swap(actions.saved_anchors);
+ actions.anchors.push_back(anchor);
+ actions.output_pre(out);
+
         out
- << "<anchor id=\"" << anchor << "\"/>"
             << "<bridgehead renderas=\"sect" << level_ << "\">"
             << "<link linkend=\"" << anchor << "\">"
             << str
@@ -159,6 +188,8 @@
 
     void simple_phrase_action::operator()(iterator first, iterator last) const
     {
+ if(!actions.output_pre(out)) return;
+
         out << pre;
         std::string str(first, last);
         if (std::string const* ptr = find(macro, str.c_str()))
@@ -176,30 +207,25 @@
     void cond_phrase_action_pre::operator()(iterator first, iterator last) const
     {
         std::string str(first, last);
- conditions.push_back(find(macro, str.c_str()));
- out.push(); // save the stream
+ condition = find(macro, str.c_str());
     }
 
- void cond_phrase_action_post::operator()(iterator first, iterator last) const
+ cond_phrase_push::cond_phrase_push(quickbook::actions& actions)
+ : actions(actions)
+ , saved_suppress(actions.suppress)
     {
- bool symbol_found = conditions.back();
- conditions.pop_back();
-
- if (first == last || !symbol_found)
- {
- out.pop(); // restore the stream
- }
- else
- {
- std::string save;
- out.swap(save);
- out.pop(); // restore the stream
- out << save; // print the body
- }
+ actions.suppress = actions.suppress || !actions.condition;
+ }
+
+ cond_phrase_push::~cond_phrase_push()
+ {
+ actions.suppress = saved_suppress;
     }
 
     void list_action::operator()(iterator first, iterator last) const
     {
+ if(actions.suppress) return;
+
         BOOST_ASSERT(!list_marks.empty()); // there must be at least one item in the stack
         out << list_buffer.str();
         list_buffer.clear();
@@ -218,6 +244,8 @@
 
     void list_format_action::operator()(iterator first, iterator last) const
     {
+ if(!actions.output_pre(out)) return;
+
         int new_indent = 0;
         while (first != last && (*first == ' ' || *first == '\t'))
         {
@@ -289,6 +317,8 @@
         }
     }
 
+ // TODO: No need to check suppress since this is only used in the syntax
+ // highlighter. I should moved this or something.
     void span::operator()(iterator first, iterator last) const
     {
         out << "<phrase role=\"" << name << "\">";
@@ -315,14 +345,14 @@
 
     void anchor_action::operator()(iterator first, iterator last) const
     {
- out << "<anchor id=\"";
- while (first != last)
- detail::print_char(*first++, out.get());
- out << "\" />\n";
+ if(!actions.suppress)
+ actions.anchors.push_back(std::string(first, last));
     }
 
     void do_macro_action::operator()(std::string const& str) const
     {
+ if(!actions.output_pre(phrase)) return;
+
         if (str == quickbook_get_date)
         {
             char strdate[64];
@@ -343,7 +373,6 @@
 
     void space::operator()(char ch) const
     {
-
         detail::print_space(ch, out.get());
     }
 
@@ -360,12 +389,15 @@
 
     void post_escape_back::operator()(iterator first, iterator last) const
     {
+ escape_actions.output_pre(escape_actions.phrase);
         out << escape_actions.phrase.str();
         escape_actions.phrase.pop(); // restore the stream
     }
 
     void code_action::operator()(iterator first, iterator last) const
     {
+ if(!actions.output_pre(out)) return;
+
         // preprocess the code section to remove the initial indentation
         std::string program(first, last);
         detail::unindent(program);
@@ -376,6 +408,8 @@
         iterator last_(program.end(), program.end());
         first_.set_position(first.get_position());
 
+ // TODO: Shouldn't phrase be empty here? Why would it be output
+ // after the code block?
         std::string save;
         phrase.swap(save);
 
@@ -395,6 +429,8 @@
 
     void inline_code_action::operator()(iterator first, iterator last) const
     {
+ if(!actions.output_pre(out)) return;
+
         std::string save;
         out.swap(save);
 
@@ -410,26 +446,32 @@
 
     void raw_char_action::operator()(char ch) const
     {
+ if(!actions.output_pre(phrase)) return;
         phrase << ch;
     }
 
     void raw_char_action::operator()(iterator first, iterator /*last*/) const
     {
+ if(!actions.output_pre(phrase)) return;
         phrase << *first;
     }
 
     void plain_char_action::operator()(char ch) const
     {
+ if(!actions.output_pre(phrase)) return;
         detail::print_char(ch, phrase.get());
     }
 
     void plain_char_action::operator()(iterator first, iterator /*last*/) const
     {
+ if(!actions.output_pre(phrase)) return;
         detail::print_char(*first, phrase.get());
     }
 
     void escape_unicode_action::operator()(iterator first, iterator last) const
     {
+ if(!actions.output_pre(phrase)) return;
+
         while(first != last && *first == '0') ++first;
 
         // Just ignore \u0000
@@ -462,10 +504,14 @@
 
     void image_action::operator()(iterator, iterator) const
     {
+ if(!actions.output_pre(phrase)) return;
+
         fs::path const img_path(image_fileref);
         
         attribute_map::iterator it = attributes.find("alt");
- std::string alt_text = it != attributes.end() ? it->second : img_path.stem();
+ std::string alt_text = it != attributes.end() ?
+ it->second :
+ img_path.stem().generic_string();
         attributes.erase("alt");
 
         attributes.insert(attribute_map::value_type("fileref", image_fileref));
@@ -566,12 +612,14 @@
 
     void macro_identifier_action::operator()(iterator first, iterator last) const
     {
+ if(actions.suppress) return;
         actions.macro_id.assign(first, last);
         actions.phrase.push(); // save the phrase
     }
 
     void macro_definition_action::operator()(iterator first, iterator last) const
     {
+ if(actions.suppress) return;
         actions.copy_macros_for_write();
         actions.macro.add(
             actions.macro_id.begin()
@@ -582,6 +630,7 @@
 
     void template_body_action::operator()(iterator first, iterator last) const
     {
+ if(actions.suppress) return;
         if (!actions.templates.add(
             template_symbol(actions.template_identifier, actions.template_info,
                 std::string(first, last), first.get_position(),
@@ -762,29 +811,28 @@
                 (body.is_block ? actions.out : actions.phrase) << body.content;
                 return true;
             }
- else if (!body.is_block)
- {
- simple_phrase_grammar phrase_p(actions);
-
- // do a phrase level parse
- iterator first(body.content.begin(), body.content.end(),
- position(body.position.file.c_str(), body.position.line, body.position.column));
- iterator last(body.content.end(), body.content.end());
- return call_parse(first, last, phrase_p).full;
- }
             else
             {
- block_grammar block_p(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.
-
- std::string content = body.content + "\n\n";
- iterator first(content.begin(), content.end(),
- position(body.position.file.c_str(), body.position.line, body.position.column));
- iterator last(content.end(), content.end());
- return call_parse(first, last, block_p).full;
+ if (!body.is_block)
+ {
+ // do a phrase level parse
+ iterator first(body.content.begin(), body.content.end(),
+ position(body.position.file.c_str(), body.position.line, body.position.column));
+ iterator last(body.content.end(), body.content.end());
+ return cl::parse(first, last, actions.grammar().simple_phrase).full;
+ }
+ else
+ {
+ // 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.
+
+ std::string content = body.content + "\n\n";
+ iterator first(content.begin(), content.end(),
+ position(body.position.file.c_str(), body.position.line, body.position.column));
+ iterator last(content.end(), content.end());
+ return cl::parse(first, last, actions.grammar().block).full;
+ }
             }
         }
     }
@@ -796,6 +844,8 @@
 
     void template_arg_action::operator()(iterator first, iterator last) const
     {
+ if(actions.suppress) return;
+
         actions.template_args.push_back(
             template_body(
                 std::string(first, last),
@@ -805,6 +855,8 @@
 
     void do_template_action::operator()(iterator first, iterator) const
     {
+ if(actions.suppress) return;
+
         // Get the arguments and clear values stored in action.
 
         std::vector<template_body> args;
@@ -994,6 +1046,8 @@
 
     void link_action::operator()(iterator first, iterator last) const
     {
+ if(!actions.output_pre(phrase)) return;
+
         iterator save = first;
         phrase << tag;
         while (first != last)
@@ -1015,6 +1069,8 @@
 
     void variablelist_action::operator()(iterator, iterator) const
     {
+ if(actions.suppress) return;
+
         actions.out << "<variablelist>\n";
 
         actions.out << "<title>";
@@ -1036,6 +1092,8 @@
 
     void table_action::operator()(iterator, iterator) const
     {
+ if(actions.suppress) return;
+
         std::string::iterator first = actions.table_title.begin();
         std::string::iterator last = actions.table_title.end();
         bool has_title = first != last;
@@ -1104,6 +1162,8 @@
 
     void start_row_action::operator()(char) const
     {
+ if (actions.suppress) return;
+
         // the first row is the header
         if (header.empty() && !phrase.str().empty())
         {
@@ -1121,12 +1181,15 @@
 
     void col_action::operator()(std::string const& contents) const
     {
+ if(actions.suppress) return;
         phrase << start_cell_ << contents << end_cell_;
         ++span;
     }
 
     void begin_section_action::operator()(iterator first, iterator last) const
- {
+ {
+ if(actions.suppress) return;
+
         section_id = element_id.empty() ?
             detail::make_identifier(first, last) :
             element_id;
@@ -1138,6 +1201,8 @@
         qualified_section_id += section_id;
         ++section_level;
 
+ actions.output_pre(out);
+
         if (qbk_version_n < 103) // version 1.2 and below
         {
             out << "\n<section id=\""
@@ -1151,6 +1216,9 @@
         std::string str;
         phrase.swap(str);
 
+ actions.anchors.swap(actions.saved_anchors);
+ actions.output_pre(out);
+
         if (qbk_version_n < 103) // version 1.2 and below
         {
             out << "<title>" << str << "</title>\n";
@@ -1169,6 +1237,8 @@
 
     void end_section_action::operator()(iterator first, iterator last) const
     {
+ if(!actions.output_pre(out)) return;
+
         if (section_level <= min_section_level)
         {
             position const pos = first.get_position();
@@ -1226,9 +1296,9 @@
         fs::path path(std::string(first, last));
         if (!path.is_complete())
         {
- fs::path infile = fs::complete(actions.filename).normalize();
+ fs::path infile = fs::absolute(actions.filename).normalize();
             path = (infile.parent_path() / path).normalize();
- fs::path outdir = fs::complete(actions.outdir).normalize();
+ fs::path outdir = fs::absolute(actions.outdir).normalize();
             path = path_difference(outdir, path);
         }
         return path;
@@ -1236,6 +1306,8 @@
 
     void xinclude_action::operator()(iterator first, iterator last) const
     {
+ if(!actions.output_pre(out)) return;
+
         fs::path path = calculate_relative_path(first, last, actions);
         out << "\n<xi:include href=\"";
         detail::print_string(detail::escape_uri(path.string()), out.get());
@@ -1275,8 +1347,10 @@
 
     void import_action::operator()(iterator first, iterator last) const
     {
+ if(!actions.output_pre(actions.out)) return;
+
         fs::path path = include_search(actions.filename.parent_path(), std::string(first,last));
- std::string ext = path.extension();
+ std::string ext = path.extension().generic_string();
         std::vector<template_symbol> storage;
         actions.error_count +=
             load_snippets(path.string(), storage, ext, actions.doc_id);
@@ -1297,6 +1371,8 @@
 
     void include_action::operator()(iterator first, iterator last) const
     {
+ if(!actions.output_pre(actions.out)) return;
+
         fs::path filein = include_search(actions.filename.parent_path(), std::string(first,last));
         std::string doc_type, doc_id;
         docinfo_string doc_dirname, doc_last_revision;
@@ -1338,10 +1414,10 @@
         }
 
         // update the __FILENAME__ macro
- *boost::spirit::classic::find(actions.macro, "__FILENAME__") = actions.filename.file_string();
+ *boost::spirit::classic::find(actions.macro, "__FILENAME__") = actions.filename.native();
 
         // parse the file
- quickbook::parse_file(actions.filename.file_string().c_str(), actions, true);
+ quickbook::parse_file(actions.filename.native().c_str(), actions, true);
 
         // restore the values
         std::swap(actions.filename, filein);
@@ -1367,14 +1443,90 @@
 
     void phrase_to_string_action::operator()(iterator first, iterator last) const
     {
+ if(!actions.output_pre(phrase)) return;
+
         out.clear();
         phrase.swap(out);
     }
 
     void phrase_to_docinfo_action::operator()(iterator first, iterator last) const
     {
+ if(!actions.output_pre(phrase)) return;
+
         out.encoded.clear();
         phrase.swap(out.encoded);
         out.raw = std::string(first, last);
     }
+
+ void inner_phrase_action_pre::operator()(iterator, iterator) const
+ {
+ // TODO: Really?
+ if(actions.suppress) return;
+
+ actions.saved_anchors.clear();
+ actions.saved_anchors.swap(actions.anchors);
+ }
+
+ void inner_phrase_action_post::operator()(iterator, iterator) const
+ {
+ if(actions.suppress) return;
+
+ actions.output_pre(actions.phrase);
+ }
+
+ bool pre_output_action::operator()(collector& tgt) const
+ {
+ if(actions.suppress) return false;
+
+ for(quickbook::actions::string_list::iterator
+ it = actions.anchors.begin(),
+ end = actions.anchors.end();
+ it != end; ++it)
+ {
+ tgt << "<anchor id=\"";
+ detail::print_string(*it, tgt.get());
+ tgt << "\"/>\n";
+ }
+
+ actions.anchors.clear();
+
+ return true;
+ }
+
+ bool pre_output_action::operator()(iterator, iterator) const
+ {
+ return (*this)(actions.out);
+ }
+
+ scoped_block_push::scoped_block_push(quickbook::actions& actions)
+ : actions(actions)
+ {
+ actions.out.push();
+ actions.phrase.push();
+ }
+
+ scoped_block_push::~scoped_block_push()
+ {
+ actions.phrase.pop();
+ actions.out.pop();
+ }
+
+ std::string const& scoped_block_push::success_impl()
+ {
+ // TODO: This should probably return an empty string
+ // if actions.suppress is true.
+ actions.inside_paragraph();
+ return actions.out.str();
+ }
+
+ set_no_eols_scoped::set_no_eols_scoped(quickbook::actions& actions)
+ : actions(actions), saved_no_eols(actions.no_eols)
+ {
+ actions.no_eols = false;
+ }
+
+ set_no_eols_scoped::~set_no_eols_scoped()
+ {
+ actions.no_eols = saved_no_eols;
+ }
 }

Modified: branches/release/tools/quickbook/src/actions.hpp
==============================================================================
--- branches/release/tools/quickbook/src/actions.hpp (original)
+++ branches/release/tools/quickbook/src/actions.hpp 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -15,7 +15,7 @@
 #include <vector>
 #include <stack>
 #include <algorithm>
-#include <boost/filesystem/v2/operations.hpp>
+#include <boost/filesystem/v3/operations.hpp>
 #include <boost/foreach.hpp>
 #include <boost/tuple/tuple.hpp>
 #include "fwd.hpp"
@@ -73,6 +73,46 @@
         actions& escape_actions,
         std::string const& source_mode);
 
+ template <typename Derived, typename DataT = void>
+ struct scoped_action_base
+ {
+ typedef quickbook::actions data_type;
+
+ template <typename T>
+ struct result
+ {
+ typedef cl::match<DataT> type;
+ };
+
+ template <typename T>
+ DataT success(T const&)
+ {
+ return static_cast<Derived*>(this)->success_impl();
+ }
+
+ void failure() {
+ return static_cast<Derived*>(this)->failure_impl();
+ }
+
+ void failure_impl() {}
+ };
+
+ struct void_type {};
+
+ template <typename Derived>
+ struct scoped_action_base<Derived, void>
+ : scoped_action_base<Derived, void_type>
+ {
+ template <typename T>
+ void_type success(T const&)
+ {
+ static_cast<Derived*>(this)->success_impl();
+ return void_type();
+ }
+
+ void success_impl() {}
+ };
+
     struct error_action
     {
         // Prints an error message to std::cerr
@@ -91,16 +131,19 @@
         tagged_action(
             collector& out,
             std::string const& pre,
- std::string const& post)
+ std::string const& post,
+ quickbook::actions& actions)
         : out(out)
         , pre(pre)
- , post(post) {}
+ , post(post)
+ , actions(actions) {}
 
         void operator()(std::string const&) const;
 
         collector& out;
         std::string pre;
         std::string post;
+ quickbook::actions& actions;
     };
 
     struct phrase_action
@@ -112,18 +155,24 @@
             collector& out,
             collector& phrase,
             std::string const& pre,
- std::string const& post)
+ std::string const& post,
+ quickbook::actions& actions)
         : out(out)
         , phrase(phrase)
         , pre(pre)
- , post(post) {}
+ , post(post)
+ , actions(actions) {}
 
- void operator()(iterator first, iterator last) const;
+ void operator()(iterator first, iterator last) const { return (*this)(); }
+ template <typename T>
+ void operator()(T const&) const { return (*this)(); }
+ void operator()() const;
 
         collector& out;
         collector& phrase;
         std::string pre;
         std::string post;
+ quickbook::actions& actions;
     };
 
     struct implicit_paragraph_action
@@ -135,11 +184,13 @@
             collector& out,
             collector& phrase,
             std::string const& pre,
- std::string const& post)
+ std::string const& post,
+ quickbook::actions& actions)
         : out(out)
         , phrase(phrase)
         , pre(pre)
- , post(post) {}
+ , post(post)
+ , actions(actions) {}
 
         void operator()() const;
         void operator()(iterator first, iterator last) const { (*this)(); }
@@ -148,6 +199,7 @@
         collector& phrase;
         std::string pre;
         std::string post;
+ quickbook::actions& actions;
     };
 
     struct header_action
@@ -162,7 +214,8 @@
             std::string const& section_id,
             std::string const& qualified_section_id,
             std::string const& pre,
- std::string const& post)
+ std::string const& post,
+ quickbook::actions& actions)
         : out(out)
         , phrase(phrase)
         , element_id(element_id)
@@ -170,7 +223,8 @@
         , section_id(section_id)
         , qualified_section_id(qualified_section_id)
         , pre(pre)
- , post(post) {}
+ , post(post)
+ , actions(actions) {}
 
         void operator()(iterator first, iterator last) const;
 
@@ -182,6 +236,7 @@
         std::string const& qualified_section_id;
         std::string pre;
         std::string post;
+ quickbook::actions& actions;
     };
 
     struct generic_header_action
@@ -195,14 +250,16 @@
             std::string const& library_id,
             std::string const& section_id,
             std::string const& qualified_section_id,
- int const& section_level)
+ int const& section_level,
+ quickbook::actions& actions)
         : out(out)
         , phrase(phrase)
         , element_id(element_id)
         , library_id(library_id)
         , section_id(section_id)
         , qualified_section_id(qualified_section_id)
- , section_level(section_level) {}
+ , section_level(section_level)
+ , actions(actions) {}
 
         void operator()(iterator first, iterator last) const;
 
@@ -213,6 +270,7 @@
         std::string const& section_id;
         std::string const& qualified_section_id;
         int const& section_level;
+ quickbook::actions& actions;
     };
 
     struct simple_phrase_action
@@ -223,11 +281,13 @@
             collector& out
           , std::string const& pre
           , std::string const& post
- , string_symbols const& macro)
+ , string_symbols const& macro
+ , quickbook::actions& actions)
         : out(out)
         , pre(pre)
         , post(post)
- , macro(macro) {}
+ , macro(macro)
+ , actions(actions) {}
 
         void operator()(iterator first, iterator last) const;
 
@@ -235,6 +295,7 @@
         std::string pre;
         std::string post;
         string_symbols const& macro;
+ quickbook::actions& actions;
     };
 
     struct cond_phrase_action_pre
@@ -242,37 +303,24 @@
         // Handles conditional phrases
 
         cond_phrase_action_pre(
- collector& out
- , std::vector<bool>& conditions
+ bool& condition
           , string_symbols const& macro)
- : out(out)
- , conditions(conditions)
+ : condition(condition)
         , macro(macro) {}
 
         void operator()(iterator first, iterator last) const;
 
- collector& out;
- std::vector<bool>& conditions;
+ bool& condition;
         string_symbols const& macro;
     };
 
- struct cond_phrase_action_post
+ struct cond_phrase_push : scoped_action_base<cond_phrase_push>
     {
- // Handles conditional phrases
-
- cond_phrase_action_post(
- collector& out
- , std::vector<bool>& conditions
- , string_symbols const& macro)
- : out(out)
- , conditions(conditions)
- , macro(macro) {}
+ cond_phrase_push(quickbook::actions&);
+ ~cond_phrase_push();
 
- void operator()(iterator first, iterator last) const;
-
- collector& out;
- std::vector<bool>& conditions;
- string_symbols const& macro;
+ quickbook::actions& actions;
+ bool saved_suppress;
     };
 
     struct list_action
@@ -284,11 +332,13 @@
             collector& out
           , collector& list_buffer
           , int& list_indent
- , std::stack<mark_type>& list_marks)
+ , std::stack<mark_type>& list_marks
+ , quickbook::actions& actions)
         : out(out)
         , list_buffer(list_buffer)
         , list_indent(list_indent)
- , list_marks(list_marks) {}
+ , list_marks(list_marks)
+ , actions(actions) {}
 
         void operator()(iterator first, iterator last) const;
 
@@ -296,6 +346,7 @@
         collector& list_buffer;
         int& list_indent;
         std::stack<mark_type>& list_marks;
+ quickbook::actions& actions;
     };
 
     struct list_format_action
@@ -307,11 +358,13 @@
             collector& out
           , int& list_indent
           , std::stack<mark_type>& list_marks
- , int& error_count)
+ , int& error_count
+ , quickbook::actions& actions)
         : out(out)
         , list_indent(list_indent)
         , list_marks(list_marks)
- , error_count(error_count) {}
+ , error_count(error_count)
+ , actions(actions) {}
 
         void operator()(iterator first, iterator last) const;
 
@@ -319,6 +372,7 @@
         int& list_indent;
         std::stack<mark_type>& list_marks;
         int& error_count;
+ quickbook::actions& actions;
     };
 
     struct span
@@ -350,12 +404,12 @@
     {
         // Handles anchors
 
- anchor_action(collector& out)
- : out(out) {}
+ anchor_action(quickbook::actions& actions)
+ : actions(actions) {}
 
         void operator()(iterator first, iterator last) const;
 
- collector& out;
+ quickbook::actions& actions;
     };
 
     extern char const* quickbook_get_date;
@@ -365,11 +419,13 @@
     {
         // Handles macro substitutions
 
- do_macro_action(collector& phrase)
- : phrase(phrase) {}
+ do_macro_action(collector& phrase, quickbook::actions& actions)
+ : phrase(phrase)
+ , actions(actions) {}
 
         void operator()(std::string const& str) const;
         collector& phrase;
+ quickbook::actions& actions;
     };
 
     struct space
@@ -417,13 +473,15 @@
         // Prints a single raw (unprocessed) char.
         // Allows '<', '>'... etc.
 
- raw_char_action(collector& phrase)
- : phrase(phrase) {}
+ raw_char_action(collector& phrase, quickbook::actions& actions)
+ : phrase(phrase)
+ , actions(actions) {}
 
         void operator()(char ch) const;
         void operator()(iterator first, iterator /*last*/) const;
 
         collector& phrase;
+ quickbook::actions& actions;
     };
 
     struct plain_char_action
@@ -431,21 +489,26 @@
         // Prints a single plain char.
         // Converts '<' to "&lt;"... etc See utils.hpp
 
- plain_char_action(collector& phrase)
- : phrase(phrase) {}
+ plain_char_action(collector& phrase, quickbook::actions& actions)
+ : phrase(phrase)
+ , actions(actions) {}
 
         void operator()(char ch) const;
         void operator()(iterator first, iterator /*last*/) const;
 
         collector& phrase;
+ quickbook::actions& actions;
     };
     
     struct escape_unicode_action
     {
- escape_unicode_action(collector& phrase) : phrase(phrase) {}
+ escape_unicode_action(collector& phrase, quickbook::actions& actions)
+ : phrase(phrase)
+ , actions(actions) {}
         void operator()(iterator first, iterator last) const;
 
         collector& phrase;
+ quickbook::actions& actions;
     };
 
     struct attribute_action
@@ -474,24 +537,30 @@
         image_action(
             collector& phrase
           , attribute_map& attributes
- , std::string& image_fileref)
+ , std::string& image_fileref
+ , quickbook::actions& actions)
         : phrase(phrase)
         , attributes(attributes)
- , image_fileref(image_fileref) {}
+ , image_fileref(image_fileref)
+ , actions(actions) {}
 
         void operator()(iterator first, iterator last) const;
 
         collector& phrase;
         attribute_map& attributes;
         std::string& image_fileref;
+ quickbook::actions& actions;
     };
 
     struct markup_action
     {
         // A generic markup action
 
- markup_action(collector& phrase, std::string const& str)
- : phrase(phrase), str(str) {}
+ markup_action(
+ collector& phrase,
+ std::string const& str,
+ quickbook::actions& actions)
+ : phrase(phrase), str(str), actions(actions) {}
 
         template <typename T>
         void operator()(T const&) const
@@ -507,6 +576,7 @@
 
         collector& phrase;
         std::string str;
+ quickbook::actions& actions;
     };
     
     struct code_action
@@ -551,12 +621,13 @@
     {
         // Handles line-breaks (DEPRECATED!!!)
 
- break_action(collector& phrase)
- : phrase(phrase) {}
+ break_action(collector& phrase, quickbook::actions& actions)
+ : phrase(phrase), actions(actions) {}
 
         void operator()(iterator f, iterator) const;
 
         collector& phrase;
+ quickbook::actions& actions;
     };
 
     struct macro_identifier_action
@@ -623,13 +694,17 @@
     {
         // Handles links (URL, XML refentry, function, class, member)
 
- link_action(collector& phrase, char const* tag)
- : phrase(phrase), tag(tag) {}
+ link_action(
+ collector& phrase,
+ char const* tag,
+ quickbook::actions& actions)
+ : phrase(phrase), tag(tag), actions(actions) {}
 
         void operator()(iterator first, iterator last) const;
 
         collector& phrase;
         char const* tag;
+ quickbook::actions& actions;
     };
 
     struct variablelist_action
@@ -660,8 +735,8 @@
     {
         // Handles table rows
 
- start_row_action(collector& phrase, unsigned& span, std::string& header)
- : phrase(phrase), span(span), header(header) {}
+ start_row_action(collector& phrase, unsigned& span, std::string& header, quickbook::actions& actions)
+ : phrase(phrase), span(span), header(header), actions(actions) {}
 
         void operator()(char) const;
         void operator()(iterator f, iterator) const;
@@ -669,17 +744,19 @@
         collector& phrase;
         unsigned& span;
         std::string& header;
+ quickbook::actions& actions;
     };
 
     struct col_action
     {
- col_action(collector& phrase, unsigned& span)
- : phrase(phrase), span(span) {}
+ col_action(collector& phrase, unsigned& span, quickbook::actions& actions)
+ : phrase(phrase), span(span), actions(actions) {}
 
         void operator()(std::string const&) const;
 
         collector& phrase;
         unsigned& span;
+ quickbook::actions& actions;
     };
 
     struct begin_section_action
@@ -693,14 +770,16 @@
           , std::string& section_id
           , int& section_level
           , std::string& qualified_section_id
- , std::string& element_id)
+ , std::string& element_id
+ , quickbook::actions& actions)
         : out(out)
         , phrase(phrase)
         , library_id(library_id)
         , section_id(section_id)
         , section_level(section_level)
         , qualified_section_id(qualified_section_id)
- , element_id(element_id) {}
+ , element_id(element_id)
+ , actions(actions) {}
 
         void operator()(iterator first, iterator last) const;
 
@@ -711,6 +790,7 @@
         int& section_level;
         std::string& qualified_section_id;
         std::string& element_id;
+ quickbook::actions& actions;
     };
 
     struct end_section_action
@@ -720,12 +800,14 @@
           , int& section_level
           , int& min_section_level
           , std::string& qualified_section_id
- , int& error_count)
+ , int& error_count
+ , quickbook::actions& actions)
         : out(out)
         , section_level(section_level)
         , min_section_level(min_section_level)
         , qualified_section_id(qualified_section_id)
- , error_count(error_count) {}
+ , error_count(error_count)
+ , actions(actions) {}
 
         void operator()(iterator first, iterator last) const;
 
@@ -734,6 +816,7 @@
         int& min_section_level;
         std::string& qualified_section_id;
         int& error_count;
+ quickbook::actions& actions;
    };
    
    struct element_id_warning_action
@@ -805,25 +888,77 @@
 
     struct phrase_to_string_action
     {
- phrase_to_string_action(std::string& out, collector& phrase)
- : out(out) , phrase(phrase) {}
+ phrase_to_string_action(std::string& out, collector& phrase, quickbook::actions& actions)
+ : out(out) , phrase(phrase), actions(actions) {}
 
         void operator()(iterator first, iterator last) const;
 
         std::string& out;
         collector& phrase;
+ quickbook::actions& actions;
     };
 
     struct phrase_to_docinfo_action
     {
- phrase_to_docinfo_action(docinfo_string& out, collector& phrase)
+ phrase_to_docinfo_action(docinfo_string& out, collector& phrase, quickbook::actions& actions)
             : out(out)
- , phrase(phrase) {}
+ , phrase(phrase)
+ , actions(actions) {}
 
         void operator()(iterator first, iterator last) const;
 
         docinfo_string& out;
         collector& phrase;
+ quickbook::actions& actions;
+ };
+
+ struct inner_phrase_action_pre
+ {
+ inner_phrase_action_pre(quickbook::actions& actions)
+ : actions(actions) {}
+
+ void operator()(iterator, iterator) const;
+
+ quickbook::actions& actions;
+ };
+
+ struct inner_phrase_action_post
+ {
+ inner_phrase_action_post(quickbook::actions& actions)
+ : actions(actions) {}
+
+ void operator()(iterator, iterator) const;
+
+ quickbook::actions& actions;
+ };
+
+ struct pre_output_action
+ {
+ pre_output_action(quickbook::actions& actions)
+ : actions(actions) {}
+
+ bool operator()(collector& tgt) const;
+ bool operator()(iterator, iterator) const;
+
+ quickbook::actions& actions;
+ };
+
+ struct scoped_block_push : scoped_action_base<scoped_block_push, std::string>
+ {
+ scoped_block_push(quickbook::actions&);
+ ~scoped_block_push();
+ std::string const& success_impl();
+
+ quickbook::actions& actions;
+ };
+
+ struct set_no_eols_scoped : scoped_action_base<set_no_eols_scoped>
+ {
+ set_no_eols_scoped(quickbook::actions&);
+ ~set_no_eols_scoped();
+
+ quickbook::actions& actions;
+ bool saved_no_eols;
     };
 }
 

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-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -11,6 +11,7 @@
 #include "actions_class.hpp"
 #include "markups.hpp"
 #include "quickbook.hpp"
+#include "grammar.hpp"
 
 #if (defined(BOOST_MSVC) && (BOOST_MSVC <= 1310))
 #pragma warning(disable:4355)
@@ -19,8 +20,10 @@
 namespace quickbook
 {
     actions::actions(char const* filein_, fs::path const& outdir_, string_stream& out_)
+ : grammar_()
+
     // header info
- : doc_type()
+ , doc_type()
         , doc_title()
         , doc_version()
         , doc_id()
@@ -41,7 +44,7 @@
         , list_buffer()
 
     // state
- , filename(fs::complete(fs::path(filein_)))
+ , filename(fs::absolute(fs::path(filein_)))
         , outdir(outdir_)
         , macro_change_depth(0)
         , macro()
@@ -68,130 +71,142 @@
         , image_fileref()
         , attribute_name()
         , attributes()
+ , anchors()
+ , saved_anchors()
+ , no_eols(true)
+ , suppress(false)
 
     // actions
         , error(error_count)
- , extract_doc_title(doc_title, phrase)
- , extract_doc_license(doc_license, phrase)
- , extract_doc_purpose(doc_purpose, phrase)
- , extract_doc_version(doc_version, phrase)
- , extract_doc_id(doc_id_tmp, phrase)
- , extract_doc_dirname(doc_dirname, phrase)
- , extract_copyright_second(copyright.second, phrase)
- , extract_name_second(name.second, phrase)
- , extract_name_first(name.first, phrase)
- , extract_doc_last_revision(doc_last_revision, phrase)
- , extract_doc_category(doc_category, phrase)
- , extract_doc_biblioid(doc_biblioid.second, phrase)
+ , extract_doc_title(doc_title, phrase, *this)
+ , extract_doc_license(doc_license, phrase, *this)
+ , extract_doc_purpose(doc_purpose, phrase, *this)
+ , extract_doc_version(doc_version, phrase, *this)
+ , extract_doc_id(doc_id_tmp, phrase, *this)
+ , extract_doc_dirname(doc_dirname, phrase, *this)
+ , extract_copyright_second(copyright.second, phrase, *this)
+ , extract_name_second(name.second, phrase, *this)
+ , extract_name_first(name.first, phrase, *this)
+ , extract_doc_last_revision(doc_last_revision, phrase, *this)
+ , extract_doc_category(doc_category, phrase, *this)
+ , extract_doc_biblioid(doc_biblioid.second, phrase, *this)
+ , extract_doc_lang(doc_lang, phrase, *this)
+ , scoped_block(*this)
         , code(out, phrase, *this)
         , code_block(phrase, phrase, *this)
         , inline_code(phrase, *this)
- , inside_paragraph(out, phrase, paragraph_pre, paragraph_post)
- , h(out, phrase, element_id, doc_id, section_id, qualified_section_id, section_level)
- , h1(out, phrase, element_id, doc_id, section_id, qualified_section_id, h1_pre, h1_post)
- , h2(out, phrase, element_id, doc_id, section_id, qualified_section_id, h2_pre, h2_post)
- , h3(out, phrase, element_id, doc_id, section_id, qualified_section_id, h3_pre, h3_post)
- , h4(out, phrase, element_id, doc_id, section_id, qualified_section_id, h4_pre, h4_post)
- , h5(out, phrase, element_id, doc_id, section_id, qualified_section_id, h5_pre, h5_post)
- , h6(out, phrase, element_id, doc_id, section_id, qualified_section_id, h6_pre, h6_post)
- , hr(out, hr_)
- , blurb(out, blurb_pre, blurb_post)
- , blockquote(out, blockquote_pre, blockquote_post)
- , preformatted(out, phrase, preformatted_pre, preformatted_post)
- , warning(out, warning_pre, warning_post)
- , caution(out, caution_pre, caution_post)
- , important(out, important_pre, important_post)
- , note(out, note_pre, note_post)
- , tip(out, tip_pre, tip_post)
- , plain_char(phrase)
- , raw_char(phrase)
- , escape_unicode(phrase)
+ , inside_paragraph(out, phrase, paragraph_pre, paragraph_post, *this)
+ , h(out, phrase, element_id, doc_id, section_id, qualified_section_id, section_level, *this)
+ , h1(out, phrase, element_id, doc_id, section_id, qualified_section_id, h1_pre, h1_post, *this)
+ , h2(out, phrase, element_id, doc_id, section_id, qualified_section_id, h2_pre, h2_post, *this)
+ , h3(out, phrase, element_id, doc_id, section_id, qualified_section_id, h3_pre, h3_post, *this)
+ , h4(out, phrase, element_id, doc_id, section_id, qualified_section_id, h4_pre, h4_post, *this)
+ , h5(out, phrase, element_id, doc_id, section_id, qualified_section_id, h5_pre, h5_post, *this)
+ , h6(out, phrase, element_id, doc_id, section_id, qualified_section_id, h6_pre, h6_post, *this)
+ , hr(out, hr_, *this)
+ , blurb(out, blurb_pre, blurb_post, *this)
+ , blockquote(out, blockquote_pre, blockquote_post, *this)
+ , set_no_eols(*this)
+ , preformatted(out, phrase, preformatted_pre, preformatted_post, *this)
+ , warning(out, warning_pre, warning_post, *this)
+ , caution(out, caution_pre, caution_post, *this)
+ , important(out, important_pre, important_post, *this)
+ , note(out, note_pre, note_post, *this)
+ , tip(out, tip_pre, tip_post, *this)
+ , space_char(phrase)
+ , plain_char(phrase, *this)
+ , raw_char(phrase, *this)
+ , escape_unicode(phrase, *this)
         , attribute(attributes, attribute_name, error_count)
- , image(phrase, attributes, image_fileref)
- , cond_phrase_pre(phrase, conditions, macro)
- , cond_phrase_post(phrase, conditions, macro)
-
- , list(out, list_buffer, list_indent, list_marks)
- , list_format(list_buffer, list_indent, list_marks, error_count)
- , list_item(list_buffer, phrase, list_item_pre, list_item_post)
-
- , funcref_pre(phrase, funcref_pre_)
- , funcref_post(phrase, funcref_post_)
- , classref_pre(phrase, classref_pre_)
- , classref_post(phrase, classref_post_)
- , memberref_pre(phrase, memberref_pre_)
- , memberref_post(phrase, memberref_post_)
- , enumref_pre(phrase, enumref_pre_)
- , enumref_post(phrase, enumref_post_)
- , macroref_pre(phrase, macroref_pre_)
- , macroref_post(phrase, macroref_post_)
- , headerref_pre(phrase, headerref_pre_)
- , headerref_post(phrase, headerref_post_)
- , conceptref_pre(phrase, conceptref_pre_)
- , conceptref_post(phrase, conceptref_post_)
- , globalref_pre(phrase, globalref_pre_)
- , globalref_post(phrase, globalref_post_)
-
- , bold_pre(phrase, bold_pre_)
- , bold_post(phrase, bold_post_)
- , italic_pre(phrase, italic_pre_)
- , italic_post(phrase, italic_post_)
- , underline_pre(phrase, underline_pre_)
- , underline_post(phrase, underline_post_)
- , teletype_pre(phrase, teletype_pre_)
- , teletype_post(phrase, teletype_post_)
- , strikethrough_pre(phrase, strikethrough_pre_)
- , strikethrough_post(phrase, strikethrough_post_)
- , quote_pre(phrase, quote_pre_)
- , quote_post(phrase, quote_post_)
- , replaceable_pre(phrase, replaceable_pre_)
- , replaceable_post(phrase, replaceable_post_)
- , footnote_pre(phrase, footnote_pre_)
- , footnote_post(phrase, footnote_post_)
-
- , simple_bold(phrase, bold_pre_, bold_post_, macro)
- , simple_italic(phrase, italic_pre_, italic_post_, macro)
- , simple_underline(phrase, underline_pre_, underline_post_, macro)
- , simple_teletype(phrase, teletype_pre_, teletype_post_, macro)
- , simple_strikethrough(phrase, strikethrough_pre_, strikethrough_post_, macro)
+ , image(phrase, attributes, image_fileref, *this)
+ , cond_phrase_pre(condition, macro)
+ , scoped_cond_phrase(*this)
+
+ , list(out, list_buffer, list_indent, list_marks, *this)
+ , list_format(list_buffer, list_indent, list_marks, error_count, *this)
+ , list_item(list_buffer, phrase, list_item_pre, list_item_post, *this)
+
+ , funcref_pre(phrase, funcref_pre_, *this)
+ , funcref_post(phrase, funcref_post_, *this)
+ , classref_pre(phrase, classref_pre_, *this)
+ , classref_post(phrase, classref_post_, *this)
+ , memberref_pre(phrase, memberref_pre_, *this)
+ , memberref_post(phrase, memberref_post_, *this)
+ , enumref_pre(phrase, enumref_pre_, *this)
+ , enumref_post(phrase, enumref_post_, *this)
+ , macroref_pre(phrase, macroref_pre_, *this)
+ , macroref_post(phrase, macroref_post_, *this)
+ , headerref_pre(phrase, headerref_pre_, *this)
+ , headerref_post(phrase, headerref_post_, *this)
+ , conceptref_pre(phrase, conceptref_pre_, *this)
+ , conceptref_post(phrase, conceptref_post_, *this)
+ , globalref_pre(phrase, globalref_pre_, *this)
+ , globalref_post(phrase, globalref_post_, *this)
+
+ , bold_pre(phrase, bold_pre_, *this)
+ , bold_post(phrase, bold_post_, *this)
+ , italic_pre(phrase, italic_pre_, *this)
+ , italic_post(phrase, italic_post_, *this)
+ , underline_pre(phrase, underline_pre_, *this)
+ , underline_post(phrase, underline_post_, *this)
+ , teletype_pre(phrase, teletype_pre_, *this)
+ , teletype_post(phrase, teletype_post_, *this)
+ , strikethrough_pre(phrase, strikethrough_pre_, *this)
+ , strikethrough_post(phrase, strikethrough_post_, *this)
+ , quote_pre(phrase, quote_pre_, *this)
+ , quote_post(phrase, quote_post_, *this)
+ , replaceable_pre(phrase, replaceable_pre_, *this)
+ , replaceable_post(phrase, replaceable_post_, *this)
+ , footnote_pre(phrase, footnote_pre_, *this)
+ , footnote_post(phrase, footnote_post_, *this)
+
+ , simple_bold(phrase, bold_pre_, bold_post_, macro, *this)
+ , simple_italic(phrase, italic_pre_, italic_post_, macro, *this)
+ , simple_underline(phrase, underline_pre_, underline_post_, macro, *this)
+ , simple_teletype(phrase, teletype_pre_, teletype_post_, macro, *this)
+ , simple_strikethrough(phrase, strikethrough_pre_, strikethrough_post_, macro, *this)
 
         , variablelist(*this)
- , start_varlistentry(phrase, start_varlistentry_)
- , end_varlistentry(phrase, end_varlistentry_)
- , start_varlistterm(phrase, start_varlistterm_)
- , end_varlistterm(phrase, end_varlistterm_)
- , varlistitem(phrase, start_varlistitem_, end_varlistitem_)
+ , start_varlistentry(phrase, start_varlistentry_, *this)
+ , end_varlistentry(phrase, end_varlistentry_, *this)
+ , start_varlistterm(phrase, start_varlistterm_, *this)
+ , end_varlistterm(phrase, end_varlistterm_, *this)
+ , varlistitem(phrase, start_varlistitem_, end_varlistitem_, *this)
 
- , break_(phrase)
+ , break_(phrase, *this)
         , macro_identifier(*this)
         , macro_definition(*this)
- , do_macro(phrase)
+ , do_macro(phrase, *this)
         , template_body(*this)
         , template_arg(*this)
         , do_template(*this)
- , url_pre(phrase, url_pre_)
- , url_post(phrase, url_post_)
- , link_pre(phrase, link_pre_)
- , link_post(phrase, link_post_)
+ , url_pre(phrase, url_pre_, *this)
+ , url_post(phrase, url_post_, *this)
+ , link_pre(phrase, link_pre_, *this)
+ , link_post(phrase, link_post_, *this)
         , table(*this)
- , start_row(phrase, table_span, table_header)
- , end_row(phrase, end_row_)
- , cell(phrase, table_span)
- , anchor(out)
+ , start_row(phrase, table_span, table_header, *this)
+ , end_row(phrase, end_row_, *this)
+ , cell(phrase, table_span, *this)
+ , anchor(*this)
 
- , begin_section(out, phrase, doc_id, section_id, section_level, qualified_section_id, element_id)
- , end_section(out, section_level, min_section_level, qualified_section_id, error_count)
+ , begin_section(out, phrase, doc_id, section_id, section_level, qualified_section_id, element_id, *this)
+ , end_section(out, section_level, min_section_level, qualified_section_id, error_count, *this)
         , xinclude(out, *this)
         , include(*this)
         , import(out, *this)
 
- , escape_pre(phrase, escape_pre_)
- , escape_post(phrase, escape_post_)
+ , escape_pre(phrase, escape_pre_, *this)
+ , escape_post(phrase, escape_post_, *this)
+
+ , inner_phrase_pre(*this)
+ , inner_phrase_post(*this)
+ , output_pre(*this)
     {
         // turn off __FILENAME__ macro on debug mode = true
         std::string filename_str = debug_mode ?
             std::string("NO_FILENAME_MACRO_GENERATED_IN_DEBUG_MODE") :
- filename.file_string();
+ filename.native();
 
         // add the predefined macros
         macro.add
@@ -199,8 +214,12 @@
             ("__TIME__", std::string(quickbook_get_time))
             ("__FILENAME__", filename_str)
         ;
+
+ boost::scoped_ptr<quickbook_grammar> g(
+ new quickbook_grammar(*this));
+ grammar_.swap(g);
     }
-
+
     void actions::push()
     {
         state_stack.push(
@@ -261,4 +280,8 @@
         list_buffer.pop();
         templates.pop();
     }
+
+ quickbook_grammar& actions::grammar() const {
+ return *grammar_;
+ }
 }

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-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -11,7 +11,9 @@
 #define BOOST_SPIRIT_ACTIONS_CLASS_HPP
 
 #include "actions.hpp"
+#include "scoped_parser.hpp"
 #include <boost/tuple/tuple.hpp>
+#include <boost/scoped_ptr.hpp>
 
 namespace quickbook
 {
@@ -22,6 +24,10 @@
     {
         actions(char const* filein_, fs::path const& outdir, string_stream& out_);
 
+ private:
+ boost::scoped_ptr<quickbook_grammar> grammar_;
+
+ public:
     ///////////////////////////////////////////////////////////////////////////
     // State
     ///////////////////////////////////////////////////////////////////////////
@@ -51,6 +57,7 @@
         docinfo_string doc_license;
         docinfo_string doc_last_revision;
         biblioid_list doc_biblioid_items;
+ docinfo_string doc_lang;
         std::string include_doc_id;
         //temporary state
         biblioid_item doc_biblioid;
@@ -101,7 +108,7 @@
         std::string macro_id;
         std::stack<mark_type> list_marks;
         int list_indent;
- std::vector<bool> conditions;
+ bool condition;
         std::string template_identifier;
         string_list template_info;
         int template_depth;
@@ -114,11 +121,16 @@
         std::string image_fileref;
         std::string attribute_name;
         attribute_map attributes;
+ string_list anchors;
+ string_list saved_anchors;
+ bool no_eols;
+ bool suppress;
 
     // push/pop the states and the streams
         void copy_macros_for_write();
         void push();
         void pop();
+ quickbook_grammar& grammar() const;
 
     ///////////////////////////////////////////////////////////////////////////
     // actions
@@ -136,6 +148,10 @@
         phrase_to_docinfo_action extract_doc_last_revision;
         phrase_to_docinfo_action extract_doc_category;
         phrase_to_docinfo_action extract_doc_biblioid;
+ phrase_to_docinfo_action extract_doc_lang;
+
+ scoped_parser<scoped_block_push>
+ scoped_block;
 
         code_action code;
         code_action code_block;
@@ -145,15 +161,19 @@
         header_action h1, h2, h3, h4, h5, h6;
         markup_action hr;
         tagged_action blurb, blockquote;
+ scoped_parser<set_no_eols_scoped>
+ set_no_eols;
         phrase_action preformatted;
         tagged_action warning, caution, important, note, tip;
+ space space_char;
         plain_char_action plain_char;
         raw_char_action raw_char;
         escape_unicode_action escape_unicode;
         attribute_action attribute;
         image_action image;
         cond_phrase_action_pre cond_phrase_pre;
- cond_phrase_action_post cond_phrase_post;
+ scoped_parser<cond_phrase_push>
+ scoped_cond_phrase;
 
         list_action list;
         list_format_action list_format;
@@ -232,6 +252,10 @@
 
         markup_action escape_pre;
         markup_action escape_post;
+
+ inner_phrase_action_pre inner_phrase_pre;
+ inner_phrase_action_post inner_phrase_post;
+ pre_output_action output_pre;
     };
 }
 

Deleted: branches/release/tools/quickbook/src/block_grammar.cpp
==============================================================================
--- branches/release/tools/quickbook/src/block_grammar.cpp 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
+++ (empty file)
@@ -1,487 +0,0 @@
-/*=============================================================================
- Copyright (c) 2002 2004 2006Joel 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)
-=============================================================================*/
-
-#include "phrase_grammar.hpp"
-#include "utils.hpp"
-#include "actions_class.hpp"
-#include "scoped_block.hpp"
-#include <boost/spirit/include/classic_confix.hpp>
-#include <boost/spirit/include/classic_chset.hpp>
-#include <boost/spirit/include/classic_assign_actor.hpp>
-#include <boost/spirit/include/classic_if.hpp>
-#include <boost/spirit/include/classic_symbols.hpp>
-#include <boost/spirit/include/classic_clear_actor.hpp>
-
-namespace quickbook
-{
- namespace cl = boost::spirit::classic;
-
- template <typename Scanner>
- struct block_grammar::definition
- {
- definition(block_grammar const&);
-
- bool no_eols;
-
- cl::rule<Scanner>
- start_, blocks, block_markup, code, code_line, blank_line,
- paragraph, space, blank, comment, headings, h, h1, h2,
- h3, h4, h5, h6, hr, blurb, blockquote, admonition,
- phrase, list, phrase_end, ordered_list, def_macro,
- macro_identifier, table, table_row, variablelist,
- varlistentry, varlistterm, varlistitem, table_cell,
- preformatted, list_item, begin_section, end_section,
- xinclude, include, hard_space, eol, paragraph_end,
- template_, template_id, template_formal_arg,
- template_body, identifier, dummy_block, import,
- inside_paragraph,
- element_id, element_id_1_5, element_id_1_6;
-
- cl::symbols<> paragraph_end_markups;
-
- phrase_grammar common;
-
- cl::rule<Scanner> const&
- start() const { return start_; }
- };
-
- template <typename Scanner>
- block_grammar::definition<Scanner>::definition(block_grammar const& self)
- : no_eols(true)
- , common(self.actions, no_eols)
- {
- using detail::var;
- quickbook::actions& actions = self.actions;
-
- if (self.skip_initial_spaces)
- {
- start_ =
- *(cl::blank_p | comment) >> blocks >> blank
- ;
- }
- else
- {
- start_ =
- blocks >> blank
- ;
- }
-
- blocks =
- *( block_markup
- | code
- | list [actions.list]
- | hr [actions.hr]
- | +eol
- | paragraph [actions.inside_paragraph]
- )
- ;
-
- space =
- *(cl::space_p | comment)
- ;
-
- blank =
- *(cl::blank_p | comment)
- ;
-
- eol = blank >> cl::eol_p
- ;
-
- phrase_end =
- ']' |
- cl::if_p(var(no_eols))
- [
- eol >> *cl::blank_p >> cl::eol_p
- // Make sure that we don't go
- ] // past a single block, except
- ; // when preformatted.
-
- // Follows after an alphanumeric identifier - ensures that it doesn't
- // match an empty space in the middle of the identifier.
- hard_space =
- (cl::eps_p - (cl::alnum_p | '_')) >> space // must not be preceded by
- ; // alpha-numeric or underscore
-
- comment =
- "[/" >> *(dummy_block | (cl::anychar_p - ']')) >> ']'
- ;
-
- dummy_block =
- '[' >> *(dummy_block | (cl::anychar_p - ']')) >> ']'
- ;
-
- hr =
- cl::str_p("----")
- >> *(cl::anychar_p - eol)
- >> +eol
- ;
-
- block_markup =
- '[' >> space
- >> ( begin_section
- | end_section
- | headings
- | blurb
- | blockquote
- | admonition
- | preformatted
- | def_macro
- | table
- | variablelist
- | xinclude
- | include
- | import
- | template_
- )
- >> ( (space >> ']' >> +eol)
- | cl::eps_p [actions.error]
- )
- ;
-
- element_id =
- ':'
- >>
- (
- cl::if_p(qbk_since(105u)) [space]
- >> (+(cl::alnum_p | '_')) [cl::assign_a(actions.element_id)]
- | cl::eps_p [actions.element_id_warning]
- [cl::assign_a(actions.element_id)]
- )
- | cl::eps_p [cl::assign_a(actions.element_id)]
- ;
-
- element_id_1_5 =
- cl::if_p(qbk_since(105u)) [
- element_id
- ]
- .else_p [
- cl::eps_p [cl::assign_a(actions.element_id)]
- ]
- ;
-
- element_id_1_6 =
- cl::if_p(qbk_since(106u)) [
- element_id
- ]
- .else_p [
- cl::eps_p [cl::assign_a(actions.element_id)]
- ]
- ;
-
- begin_section =
- "section"
- >> hard_space
- >> element_id
- >> space
- >> phrase [actions.begin_section]
- ;
-
- end_section =
- cl::str_p("endsect") [actions.end_section]
- ;
-
- headings =
- h1 | h2 | h3 | h4 | h5 | h6 | h
- ;
-
- h = "heading" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h];
- h1 = "h1" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h1];
- h2 = "h2" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h2];
- h3 = "h3" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h3];
- h4 = "h4" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h4];
- h5 = "h5" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h5];
- h6 = "h6" >> hard_space >> element_id_1_6 >> space >> phrase [actions.h6];
-
- static const bool true_ = true;
- static const bool false_ = false;
-
- inside_paragraph =
- phrase [actions.inside_paragraph]
- >> *(
- +eol >> phrase [actions.inside_paragraph]
- )
- ;
-
- blurb =
- "blurb" >> hard_space
- >> scoped_block(actions)[inside_paragraph]
- [actions.blurb]
- ;
-
- blockquote =
- ':' >> blank >>
- scoped_block(actions)[inside_paragraph]
- [actions.blockquote]
- ;
-
- admonition =
- "warning" >> hard_space >>
- scoped_block(actions)[inside_paragraph]
- [actions.warning]
- |
- "caution" >> hard_space >>
- scoped_block(actions)[inside_paragraph]
- [actions.caution]
- |
- "important" >> hard_space >>
- scoped_block(actions)[inside_paragraph]
- [actions.important]
- |
- "note" >> hard_space >>
- scoped_block(actions)[inside_paragraph]
- [actions.note]
- |
- "tip" >> hard_space >>
- scoped_block(actions)[inside_paragraph]
- [actions.tip]
- ;
-
- preformatted =
- "pre" >> hard_space [cl::assign_a(no_eols, false_)]
- >> !eol >> phrase [actions.preformatted]
- >> cl::eps_p [cl::assign_a(no_eols, true_)]
- ;
-
- macro_identifier =
- +(cl::anychar_p - (cl::space_p | ']'))
- ;
-
- def_macro =
- "def" >> hard_space
- >> macro_identifier [actions.macro_identifier]
- >> blank >> phrase [actions.macro_definition]
- ;
-
- identifier =
- (cl::alpha_p | '_') >> *(cl::alnum_p | '_')
- ;
-
- template_id =
- identifier | (cl::punct_p - (cl::ch_p('[') | ']'))
- ;
-
- template_ =
- "template"
- >> hard_space
- >> template_id [cl::assign_a(actions.template_identifier)]
- [cl::clear_a(actions.template_info)]
- >>
- !(
- space >> '['
- >> *(
- space >> template_id [cl::push_back_a(actions.template_info)]
- )
- >> space >> ']'
- )
- >> ( cl::eps_p(*cl::blank_p >> cl::eol_p)
- [cl::assign_a(actions.template_block, true_)]
- | cl::eps_p [cl::assign_a(actions.template_block, false_)]
- )
- >> template_body [actions.template_body]
- ;
-
- template_body =
- *(('[' >> template_body >> ']') | (cl::anychar_p - ']'))
- >> cl::eps_p(space >> ']')
- >> space
- ;
-
- variablelist =
- "variablelist"
- >> (cl::eps_p(*cl::blank_p >> cl::eol_p) | hard_space)
- >> (*(cl::anychar_p - eol)) [cl::assign_a(actions.table_title)]
- >> +eol
- >> *varlistentry
- >> cl::eps_p [actions.variablelist]
- ;
-
- varlistentry =
- space
- >> cl::ch_p('[') [actions.start_varlistentry]
- >>
- (
- (
- varlistterm
- >> ( scoped_block(actions) [+varlistitem]
- [actions.varlistitem]
- | cl::eps_p [actions.error]
- )
- >> cl::ch_p(']') [actions.end_varlistentry]
- >> space
- )
- | cl::eps_p [actions.error]
- )
- ;
-
- varlistterm =
- space
- >> cl::ch_p('[') [actions.start_varlistterm]
- >>
- (
- (
- phrase
- >> cl::ch_p(']') [actions.end_varlistterm]
- >> space
- )
- | cl::eps_p [actions.error]
- )
- ;
-
- varlistitem =
- space
- >> cl::ch_p('[')
- >>
- (
- (
- inside_paragraph
- >> cl::ch_p(']')
- >> space
- )
- | cl::eps_p [actions.error]
- )
- ;
-
- table =
- "table"
- >> (cl::eps_p(*cl::blank_p >> cl::eol_p) | hard_space)
- >> element_id_1_5
- >> (cl::eps_p(*cl::blank_p >> cl::eol_p) | space)
- >> (*(cl::anychar_p - eol)) [cl::assign_a(actions.table_title)]
- >> +eol
- >> *table_row
- >> cl::eps_p [actions.table]
- ;
-
- table_row =
- space
- >> cl::ch_p('[') [actions.start_row]
- >>
- (
- (
- *table_cell
- >> cl::ch_p(']') [actions.end_row]
- >> space
- )
- | cl::eps_p [actions.error]
- )
- ;
-
- table_cell =
- space
- >> cl::ch_p('[')
- >> ( scoped_block(actions) [
- inside_paragraph
- >> cl::ch_p(']')
- >> space
- ] [actions.cell]
- | cl::eps_p [actions.error]
- )
- ;
-
- xinclude =
- "xinclude"
- >> hard_space
- >> (*(cl::anychar_p -
- phrase_end)) [actions.xinclude]
- ;
-
- import =
- "import"
- >> hard_space
- >> (*(cl::anychar_p -
- phrase_end)) [actions.import]
- ;
-
- include =
- "include"
- >> hard_space
- >>
- !(
- ':'
- >> (*((cl::alnum_p | '_') - cl::space_p))
- [cl::assign_a(actions.include_doc_id)]
- >> space
- )
- >> (*(cl::anychar_p -
- phrase_end)) [actions.include]
- ;
-
- code =
- (
- code_line
- >> *(*blank_line >> code_line)
- ) [actions.code]
- >> *eol
- ;
-
- code_line =
- cl::blank_p >> *(cl::anychar_p - cl::eol_p) >> cl::eol_p
- ;
-
- blank_line =
- *cl::blank_p >> cl::eol_p
- ;
-
- list =
- cl::eps_p(cl::ch_p('*') | '#') >>
- +(
- (*cl::blank_p
- >> (cl::ch_p('*') | '#')) [actions.list_format]
- >> *cl::blank_p
- >> list_item
- ) [actions.list_item]
- ;
-
- list_item =
- *( common
- | (cl::anychar_p -
- ( cl::eol_p >> *cl::blank_p >> cl::eps_p(cl::ch_p('*') | '#')
- | (eol >> eol)
- )
- ) [actions.plain_char]
- )
- >> +eol
- ;
-
- paragraph_end_markups =
- "section", "endsect", "h1", "h2", "h3", "h4", "h5", "h6",
- "blurb", ":", "pre", "def", "table", "include", "xinclude",
- "variablelist", "import", "template", "warning", "caution",
- "important", "note", "tip", ":"
- ;
-
- paragraph_end =
- '[' >> space >> paragraph_end_markups >> hard_space | eol >> *cl::blank_p >> cl::eol_p
- ;
-
- paragraph =
- +( common
- | (cl::anychar_p - // Make sure we don't go past
- paragraph_end // a single block.
- ) [actions.plain_char]
- )
- >> (cl::eps_p('[') | +eol)
- ;
-
- phrase =
- *( common
- | comment
- | (cl::anychar_p -
- phrase_end) [actions.plain_char]
- )
- ;
- }
-
- cl::parse_info<iterator> call_parse(
- iterator& first, iterator last, block_grammar& g)
- {
- return boost::spirit::classic::parse(first, last, g);
- }
-}

Modified: branches/release/tools/quickbook/src/doc_info_actions.cpp
==============================================================================
--- branches/release/tools/quickbook/src/doc_info_actions.cpp (original)
+++ branches/release/tools/quickbook/src/doc_info_actions.cpp 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -77,7 +77,7 @@
             qbk_major_version = 1;
             qbk_minor_version = 1;
             qbk_version_n = 101;
- detail::outwarn(actions.filename.file_string(),1)
+ detail::outwarn(actions.filename.native(),1)
                 << "Warning: Quickbook version undefined. "
                 "Version 1.1 is assumed" << std::endl;
         }
@@ -89,13 +89,13 @@
         
         if (qbk_version_n == 106)
         {
- detail::outwarn(actions.filename.file_string(),1)
+ detail::outwarn(actions.filename.native(),1)
                 << "Quickbook 1.6 is still under development and is "
                 "likely to change in the future." << std::endl;
         }
         else if(qbk_version_n < 100 || qbk_version_n > 106)
         {
- detail::outerr(actions.filename.file_string(),1)
+ detail::outerr(actions.filename.native(),1)
                 << "Unknown version of quickbook: quickbook "
                 << qbk_major_version
                 << "."
@@ -121,7 +121,7 @@
 
             if(!invalid_attributes.empty())
             {
- detail::outwarn(actions.filename.file_string(),1)
+ detail::outwarn(actions.filename.native(),1)
                     << (invalid_attributes.size() > 1 ?
                         "Invalid attributes" : "Invalid attribute")
                     << " for '" << actions.doc_type << " document info': "
@@ -143,6 +143,13 @@
             << actions.doc_id
             << "\"\n";
         
+ if(!actions.doc_lang.empty())
+ {
+ out << " lang=\""
+ << actions.doc_lang.get(106)
+ << "\"\n";
+ }
+
         if(actions.doc_type == "library")
         {
             out << " name=\"" << actions.doc_title.get(106) << "\"\n";

Modified: branches/release/tools/quickbook/src/doc_info_grammar.cpp
==============================================================================
--- branches/release/tools/quickbook/src/doc_info_grammar.cpp (original)
+++ branches/release/tools/quickbook/src/doc_info_grammar.cpp 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -8,7 +8,7 @@
     http://www.boost.org/LICENSE_1_0.txt)
 =============================================================================*/
 
-#include "phrase_grammar.hpp"
+#include "grammar_impl.hpp"
 #include "actions_class.hpp"
 #include <boost/spirit/include/classic_core.hpp>
 #include <boost/spirit/include/classic_actor.hpp>
@@ -20,74 +20,65 @@
 {
     namespace cl = boost::spirit::classic;
 
- template <typename Scanner>
- struct doc_info_grammar::definition
+ struct doc_info_grammar_local
     {
- definition(doc_info_grammar const&);
-
- typedef cl::uint_parser<int, 10, 1, 2> uint2_t;
-
- bool unused;
- std::string category;
- cl::rule<Scanner>
- doc_info, doc_title, doc_version, doc_id, doc_dirname,
+ cl::rule<scanner>
+ doc_title, doc_version, doc_id, doc_dirname,
                         doc_copyright, doc_purpose, doc_category, doc_authors,
- doc_author, space, hard_space, doc_license,
- doc_last_revision, doc_source_mode, doc_biblioid,
- phrase, quickbook_version, char_, comment, dummy_block;
- phrase_grammar common;
+ doc_author, doc_license,
+ doc_last_revision, doc_source_mode, doc_biblioid, doc_lang,
+ quickbook_version, char_;
         cl::symbols<> doc_types;
-
- cl::rule<Scanner> const&
- start() const { return doc_info; }
     };
 
- template <typename Scanner>
- doc_info_grammar::definition<Scanner>::definition(doc_info_grammar const& self)
- : unused(false), common(self.actions, unused)
+ void quickbook_grammar::impl::init_doc_info()
     {
- quickbook::actions& actions = self.actions;
+ doc_info_grammar_local& local = store_.create();
 
- doc_types =
+ typedef cl::uint_parser<int, 10, 1, 2> uint2_t;
+
+ local.doc_types =
             "book", "article", "library", "chapter", "part"
           , "appendix", "preface", "qandadiv", "qandaset"
           , "reference", "set"
         ;
         
- doc_info =
+ doc_info_details =
             space
>> '[' >> space
- >> (doc_types >> cl::eps_p) [cl::assign_a(actions.doc_type)]
+ >> (local.doc_types >> cl::eps_p)
+ [cl::assign_a(actions.doc_type)]
>> hard_space
- >> ( *(~cl::eps_p(cl::ch_p('[') | ']' | cl::eol_p) >> char_)
+ >> ( *(~cl::eps_p(cl::ch_p('[') | ']' | cl::eol_p) >> local.char_)
                 ) [actions.extract_doc_title]
>> !(
                     space >> '[' >>
- quickbook_version
+ local.quickbook_version
>> space >> ']'
                 )
>>
                 *(
                     space >> '[' >>
                     (
- doc_version
- | doc_id
- | doc_dirname
- | doc_copyright [cl::push_back_a(actions.doc_copyrights, actions.copyright)]
- | doc_purpose
- | doc_category
- | doc_authors
- | doc_license
- | doc_last_revision
- | doc_source_mode
- | doc_biblioid
+ local.doc_version
+ | local.doc_id
+ | local.doc_dirname
+ | local.doc_copyright [cl::push_back_a(actions.doc_copyrights, actions.copyright)]
+ | local.doc_purpose
+ | local.doc_category
+ | local.doc_authors
+ | local.doc_license
+ | local.doc_last_revision
+ | local.doc_source_mode
+ | local.doc_biblioid
+ | local.doc_lang
                     )
>> space >> ']' >> +cl::eol_p
                 )
>> space >> ']' >> +cl::eol_p
             ;
 
- quickbook_version =
+ local.quickbook_version =
                 "quickbook" >> hard_space
>> ( cl::uint_p [cl::assign_a(qbk_major_version)]
>> '.'
@@ -95,82 +86,83 @@
                 )
             ;
 
- doc_version =
+ local.doc_version =
                 "version" >> hard_space
- >> (*(~cl::eps_p(']') >> char_))
+ >> (*(~cl::eps_p(']') >> local.char_))
                                             [actions.extract_doc_version]
             ;
 
         // TODO: Restrictions on doc_id?
- doc_id =
+ local.doc_id =
                 "id" >> hard_space
- >> (*(~cl::eps_p(']') >> char_))
+ >> (*(~cl::eps_p(']') >> local.char_))
                                             [actions.extract_doc_id]
             ;
 
         // TODO: Restrictions on doc_dirname?
- doc_dirname =
+ local.doc_dirname =
                 "dirname" >> hard_space
- >> (*(~cl::eps_p(']') >> char_))
+ >> (*(~cl::eps_p(']') >> local.char_))
                                             [actions.extract_doc_dirname]
             ;
 
- doc_copyright =
- "copyright" >> hard_space [cl::clear_a(actions.copyright.first)]
+ local.doc_copyright =
+ "copyright"
+ >> hard_space [cl::clear_a(actions.copyright.first)]
>> +( cl::repeat_p(4)[cl::digit_p]
                                             [cl::push_back_a(actions.copyright.first)]
>> space
                 )
>> space
- >> (*(~cl::eps_p(']') >> char_))
+ >> (*(~cl::eps_p(']') >> local.char_))
                                             [actions.extract_copyright_second]
             ;
 
- doc_purpose =
+ local.doc_purpose =
                 "purpose" >> hard_space
- >> phrase [actions.extract_doc_purpose]
+ >> simple_phrase [actions.extract_doc_purpose]
             ;
 
- doc_category =
+ local.doc_category =
                 "category" >> hard_space
- >> (*(~cl::eps_p(']') >> char_))
+ >> (*(~cl::eps_p(']') >> local.char_))
                                             [actions.extract_doc_category]
                                             [cl::push_back_a(actions.doc_categories, actions.doc_category)]
             ;
 
- doc_author =
+ local.doc_author =
                 '[' >> space
- >> (*(~cl::eps_p(',') >> char_))
+ >> (*(~cl::eps_p(',') >> local.char_))
                                             [actions.extract_name_second]
>> ',' >> space
- >> (*(~cl::eps_p(']') >> char_))
+ >> (*(~cl::eps_p(']') >> local.char_))
                                             [actions.extract_name_first]
>> ']'
             ;
 
- doc_authors =
+ local.doc_authors =
                 "authors"
>> hard_space
- >> doc_author [cl::push_back_a(actions.doc_authors, actions.name)]
+ >> local.doc_author [cl::push_back_a(actions.doc_authors, actions.name)]
>> space
>> *( !(cl::ch_p(',') >> space)
- >> doc_author [cl::push_back_a(actions.doc_authors, actions.name)]
+ >> local.doc_author [cl::push_back_a(actions.doc_authors, actions.name)]
>> space
                 )
             ;
 
- doc_license =
+ local.doc_license =
                 "license" >> hard_space
- >> phrase [actions.extract_doc_license]
+ >> simple_phrase [actions.extract_doc_license]
             ;
 
- doc_last_revision =
+ local.doc_last_revision =
                 "last-revision" >> hard_space
- >> (*(~cl::eps_p(']') >> char_))
+ >> (*(~cl::eps_p(']') >> local.char_))
                                             [actions.extract_doc_last_revision]
             ;
 
- doc_source_mode =
+ local.doc_source_mode =
                 "source-mode" >> hard_space
>> (
                    cl::str_p("c++")
@@ -179,40 +171,23 @@
                 ) [cl::assign_a(actions.source_mode)]
             ;
 
- doc_biblioid =
+ local.doc_biblioid =
                 "biblioid"
>> hard_space
>> (+cl::alnum_p) [cl::assign_a(actions.doc_biblioid.first)]
>> hard_space
- >> (+(~cl::eps_p(']') >> char_))
+ >> (+(~cl::eps_p(']') >> local.char_))
                                             [actions.extract_doc_biblioid]
                                             [cl::push_back_a(actions.doc_biblioid_items, actions.doc_biblioid)]
             ;
 
- comment =
- "[/" >> *(dummy_block | (cl::anychar_p - ']')) >> ']'
- ;
-
- dummy_block =
- '[' >> *(dummy_block | (cl::anychar_p - ']')) >> ']'
+ local.doc_lang =
+ "lang" >> hard_space
+ >> (*(~cl::eps_p(']') >> local.char_))
+ [actions.extract_doc_lang]
             ;
 
- space =
- *(cl::space_p | comment)
- ;
-
- hard_space =
- (cl::eps_p - (cl::alnum_p | '_')) >> space // must not be preceded by
- ; // alpha-numeric or underscore
-
- phrase =
- *( common
- | comment
- | (cl::anychar_p - ']') [actions.plain_char]
- )
- ;
-
- char_ =
+ local.char_ =
                 cl::str_p("\\n") [actions.break_]
             | "\\ " // ignore an escaped space
             | '\\' >> cl::punct_p [actions.raw_char]
@@ -230,10 +205,4 @@
             | cl::anychar_p [actions.plain_char]
             ;
     }
-
- cl::parse_info<iterator> call_parse(
- iterator& first, iterator last, doc_info_grammar& g)
- {
- return boost::spirit::classic::parse(first, last, g);
- }
 }

Modified: branches/release/tools/quickbook/src/fwd.hpp
==============================================================================
--- branches/release/tools/quickbook/src/fwd.hpp (original)
+++ branches/release/tools/quickbook/src/fwd.hpp 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -18,10 +18,11 @@
 namespace quickbook
 {
     struct actions;
+ struct quickbook_grammar;
 
     typedef boost::spirit::classic::file_position_base<char const*> position;
     typedef boost::spirit::classic::position_iterator<
         std::string::const_iterator, position> iterator;
 }
 
-#endif
\ No newline at end of file
+#endif

Copied: branches/release/tools/quickbook/src/grammar.cpp (from r67335, /trunk/tools/quickbook/src/grammar.cpp)
==============================================================================
--- /trunk/tools/quickbook/src/grammar.cpp (original)
+++ branches/release/tools/quickbook/src/grammar.cpp 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -30,12 +30,11 @@
 
     quickbook_grammar::impl::impl(quickbook::actions& a)
         : actions(a)
- , no_eols(true)
         , store_()
     {
         init_main();
- init_block_markup();
- init_phrase_markup();
+ init_block_elements();
+ init_phrase_elements();
         init_doc_info();
     }
 }

Modified: branches/release/tools/quickbook/src/grammar.hpp
==============================================================================
--- branches/release/tools/quickbook/src/grammar.hpp (original)
+++ branches/release/tools/quickbook/src/grammar.hpp 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -17,77 +17,52 @@
 {
     namespace cl = boost::spirit::classic;
 
- struct doc_info_grammar
- : public cl::grammar<doc_info_grammar>
- {
- doc_info_grammar(quickbook::actions& actions)
- : actions(actions) {}
-
- template <typename Scanner>
- struct definition;
+ // The spirit scanner for explicitly instantiating grammars. This is a
+ // spirit implementation detail, but since classic is no longer under
+ // development, it won't change. And spirit 2 won't require such a hack.
 
- quickbook::actions& actions;
- };
+ typedef cl::scanner<iterator, cl::scanner_policies <
+ cl::iteration_policy, cl::match_policy, cl::action_policy> > scanner;
 
- struct block_grammar : cl::grammar<block_grammar>
+ struct grammar
+ : public cl::grammar<grammar>
     {
- block_grammar(quickbook::actions& actions_, bool skip_initial_spaces = false)
- : actions(actions_), skip_initial_spaces(skip_initial_spaces) { }
+ grammar(cl::rule<scanner> const& start_rule, char const* /* name */)
+ : start_rule(start_rule) {}
 
         template <typename Scanner>
- struct definition;
-
- quickbook::actions& actions;
- bool const skip_initial_spaces;
- };
-
- struct phrase_grammar
- : cl::grammar<phrase_grammar>
- {
- phrase_grammar(quickbook::actions& actions, bool& no_eols)
- : no_eols(no_eols), actions(actions) {}
+ struct definition {
+ // TODO: Statically assert that Scanner == scanner.
+
+ definition(grammar const& self) : start_rule(self.start_rule) {}
+
+ cl::rule<Scanner> const& start() const { return start_rule; }
 
- template <typename Scanner>
- struct definition;
+ cl::rule<Scanner> const& start_rule;
+ };
 
- bool& no_eols;
- quickbook::actions& actions;
+ cl::rule<scanner> const& start_rule;
     };
 
- struct simple_phrase_grammar
- : public cl::grammar<simple_phrase_grammar >
+ class quickbook_grammar
     {
- simple_phrase_grammar(quickbook::actions& actions)
- : actions(actions) {}
-
- template <typename Scanner>
- struct definition;
-
- quickbook::actions& actions;
- };
+ public:
+ struct impl;
 
- struct command_line_grammar
- : public cl::grammar<command_line_grammar>
- {
- command_line_grammar(quickbook::actions& actions)
- : actions(actions) {}
+ private:
+ boost::scoped_ptr<impl> impl_;
 
- template <typename Scanner>
- struct definition;
+ public:
+ grammar command_line_macro;
+ grammar common;
+ grammar simple_phrase;
+ grammar block;
+ grammar block_skip_initial_spaces;
+ grammar doc_info;
 
- quickbook::actions& actions;
+ quickbook_grammar(quickbook::actions&);
+ ~quickbook_grammar();
     };
-
- cl::parse_info<iterator> call_parse(
- iterator&, iterator, doc_info_grammar&);
- cl::parse_info<iterator> call_parse(
- iterator&, iterator, block_grammar&);
- cl::parse_info<iterator> call_parse(
- iterator&, iterator, phrase_grammar&);
- cl::parse_info<iterator> call_parse(
- iterator&, iterator, simple_phrase_grammar&);
- cl::parse_info<iterator> call_parse(
- iterator&, iterator, command_line_grammar&);
 }
 
 #endif

Copied: branches/release/tools/quickbook/src/grammar_impl.hpp (from r67335, /trunk/tools/quickbook/src/grammar_impl.hpp)
==============================================================================
--- /trunk/tools/quickbook/src/grammar_impl.hpp (original)
+++ branches/release/tools/quickbook/src/grammar_impl.hpp 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -22,7 +22,6 @@
     struct quickbook_grammar::impl
     {
         quickbook::actions& actions;
- bool no_eols;
         rule_store store_;
 
         // Main Grammar
@@ -31,6 +30,7 @@
         cl::rule<scanner> common;
         cl::rule<scanner> simple_phrase;
         cl::rule<scanner> phrase;
+ cl::rule<scanner> extended_phrase;
         cl::rule<scanner> inside_paragraph;
         cl::rule<scanner> command_line;
 
@@ -50,6 +50,8 @@
         cl::symbols<cl::rule<scanner>*> block_keyword_rules;
         cl::symbols<cl::rule<scanner>*> block_symbol_rules;
         
+ cl::symbols<cl::rule<scanner>*> extended_phrase_keyword_rules;
+
         // Doc Info
         cl::rule<scanner> doc_info_details;
         
@@ -58,8 +60,8 @@
     private:
 
         void init_main();
- void init_block_markup();
- void init_phrase_markup();
+ void init_block_elements();
+ void init_phrase_elements();
         void init_doc_info();
     };
 }

Modified: branches/release/tools/quickbook/src/input_path.cpp
==============================================================================
--- branches/release/tools/quickbook/src/input_path.cpp (original)
+++ branches/release/tools/quickbook/src/input_path.cpp 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -26,42 +26,11 @@
     }
 }}
 
-#elif defined(QUICKBOOK_CYGWIN_1_5)
-
-// Cygwin 1.5.x
-
-#include <boost/filesystem/v2/config.hpp>
-#include <windows.h>
-#include <sys/cygwin.h>
-
-namespace quickbook { namespace detail
-{
- void validate(boost::any& v,
- const std::vector<std::string>& values,
- input_path*, int)
- {
- std::string path
- = boost::program_options::validators::get_single_string(values);
-
- char result[MAX_PATH + 1];
-
-#if defined(BOOST_WINDOWS_PATH)
- cygwin_conv_to_win32_path(path.c_str(), result);
-#elif defined(BOOST_POSIX_PATH)
- cygwin_conv_to_posix_path(path.c_str(), result);
-#else
-# error "Boost filesystem path type doesn't seem to be set."
-#endif
-
- v = input_path(result);
- }
-}}
-
 #else
 
 // Cygwin 1.7.x
     
-#include <boost/filesystem/v2/config.hpp>
+#include <boost/filesystem/v3/config.hpp>
 #include <boost/scoped_array.hpp>
 #include <boost/program_options/errors.hpp>
 #include <windows.h>

Copied: branches/release/tools/quickbook/src/main_grammar.cpp (from r67335, /trunk/tools/quickbook/src/main_grammar.cpp)
==============================================================================
--- /trunk/tools/quickbook/src/main_grammar.cpp (original)
+++ branches/release/tools/quickbook/src/main_grammar.cpp 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -11,7 +11,6 @@
 #include "grammar_impl.hpp"
 #include "actions_class.hpp"
 #include "utils.hpp"
-#include "scoped_block.hpp"
 #include <boost/spirit/include/classic_core.hpp>
 #include <boost/spirit/include/classic_confix.hpp>
 #include <boost/spirit/include/classic_chset.hpp>
@@ -61,10 +60,10 @@
     {
         cl::rule<scanner>
                         top_level, blocks, paragraph_separator,
- block_markup, block_markup_start,
+ block_element, block_element_start,
                         code, code_line, blank_line, hr,
                         list, ordered_list, list_item,
- phrase_markup,
+ phrase_element, extended_phrase_element,
                         simple_phrase_end,
                         escape,
                         inline_code, simple_format,
@@ -101,7 +100,7 @@
         local.top_level
             = local.blocks
>> *(
- local.block_markup >> local.blocks
+ local.block_element >> !(+eol >> local.blocks)
                 | local.paragraph_separator >> local.blocks
                 | common
                 | cl::space_p [actions.space_char]
@@ -128,17 +127,17 @@
>> +eol
             ;
 
- local.block_markup
- = local.block_markup_start [actions.inside_paragraph]
+ local.block_element
+ = local.block_element_start [actions.inside_paragraph]
>> ( local.block_keyword_rule
- >> ( (space >> ']' >> +eol)
+ >> ( (space >> ']')
                     | cl::eps_p [actions.error]
                     )
                 | cl::eps_p [actions.error]
                 )
             ;
 
- local.block_markup_start
+ local.block_element_start
             = '[' >> space
>> ( block_keyword_rules [detail::assign_rule(local.block_keyword_rule)]
>> (cl::eps_p - (cl::alnum_p | '_'))
@@ -185,7 +184,7 @@
 
         common =
                 local.macro
- | local.phrase_markup
+ | local.phrase_element
             | local.code_block
             | local.inline_code
             | local.simple_format
@@ -328,6 +327,13 @@
             )
             ;
 
+ extended_phrase =
+ *( local.extended_phrase_element
+ | common
+ | (cl::anychar_p - phrase_end) [actions.plain_char]
+ )
+ ;
+
         inside_paragraph =
             (*( common
             | (cl::anychar_p - phrase_end) [actions.plain_char]
@@ -335,8 +341,9 @@
             )) [actions.inside_paragraph]
             ;
 
- local.phrase_markup
+ local.phrase_element
             = '['
+ >> space
>> ( phrase_keyword_rules [detail::assign_rule(local.phrase_keyword_rule)]
>> (cl::eps_p - (cl::alnum_p | '_'))
>> local.phrase_keyword_rule
@@ -348,6 +355,20 @@
>> ']'
             ;
 
+ local.extended_phrase_element
+ = '['
+ >> space
+ >> extended_phrase_keyword_rules [detail::assign_rule(local.block_keyword_rule)]
+ >> (cl::eps_p - (cl::alnum_p | '_'))
+ [actions.inside_paragraph]
+ >> ( local.block_keyword_rule
+ >> ( (space >> ']')
+ | cl::eps_p [actions.error]
+ )
+ | cl::eps_p [actions.error]
+ )
+ ;
+
         local.escape =
                 cl::str_p("\\n") [actions.break_]
             | cl::str_p("\\ ") // ignore an escaped space
@@ -423,7 +444,7 @@
 
         phrase_end =
             ']' |
- cl::if_p(var(no_eols))
+ cl::if_p(var(actions.no_eols))
             [
                 cl::eol_p >> *cl::blank_p >> cl::eol_p
                                                 // Make sure that we don't go

Deleted: branches/release/tools/quickbook/src/phrase_grammar.cpp
==============================================================================
--- branches/release/tools/quickbook/src/phrase_grammar.cpp 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
+++ (empty file)
@@ -1,103 +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)
-=============================================================================*/
-
-#include "phrase_grammar.hpp"
-
-namespace quickbook
-{
- template <typename Scanner>
- struct simple_phrase_grammar::definition
- {
- definition(simple_phrase_grammar const& self)
- : unused(false), common(self.actions, unused)
- {
- quickbook::actions& actions = self.actions;
-
- phrase =
- *( common
- | comment
- | (cl::anychar_p - ']') [actions.plain_char]
- )
- ;
-
- comment =
- "[/" >> *(dummy_block | (cl::anychar_p - ']')) >> ']'
- ;
-
- dummy_block =
- '[' >> *(dummy_block | (cl::anychar_p - ']')) >> ']'
- ;
- }
-
- bool unused;
- cl::rule<Scanner> phrase, comment, dummy_block;
- phrase_grammar common;
-
- cl::rule<Scanner> const&
- start() const { return phrase; }
- };
-
- template <typename Scanner>
- struct command_line_grammar::definition
- {
- definition(command_line_grammar const& self)
- : unused(false), common(self.actions, unused)
- {
- quickbook::actions& actions = self.actions;
-
- macro =
- *cl::space_p
- >> macro_identifier [actions.macro_identifier]
- >> *cl::space_p
- >> ( '='
- >> *cl::space_p
- >> phrase [actions.macro_definition]
- >> *cl::space_p
- )
- | cl::eps_p [actions.macro_definition]
- ;
-
- macro_identifier =
- +(cl::anychar_p - (cl::space_p | ']' | '='))
- ;
-
- phrase =
- *( common
- | (cl::anychar_p - ']') [actions.plain_char]
- )
- ;
- }
-
- bool unused;
- cl::rule<Scanner> macro, macro_identifier, phrase;
- phrase_grammar common;
-
- cl::rule<Scanner> const&
- start() const { return macro; }
- };
-
- cl::parse_info<iterator> call_parse(
- iterator& first, iterator last, phrase_grammar& g)
- {
- return boost::spirit::classic::parse(first, last, g);
- }
-
- cl::parse_info<iterator> call_parse(
- iterator& first, iterator last, simple_phrase_grammar& g)
- {
- return boost::spirit::classic::parse(first, last, g);
- }
-
- cl::parse_info<iterator> call_parse(
- iterator& first, iterator last, command_line_grammar& g)
- {
- return boost::spirit::classic::parse(first, last, g);
- }
-}

Deleted: branches/release/tools/quickbook/src/phrase_grammar.hpp
==============================================================================
--- branches/release/tools/quickbook/src/phrase_grammar.hpp 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
+++ (empty file)
@@ -1,487 +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_PHRASE_HPP)
-#define BOOST_SPIRIT_QUICKBOOK_PHRASE_HPP
-
-#include "grammar.hpp"
-#include "actions_class.hpp"
-#include "utils.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_assign_actor.hpp>
-#include <boost/spirit/include/classic_clear_actor.hpp>
-#include <boost/spirit/include/classic_if.hpp>
-#include <boost/spirit/include/classic_loops.hpp>
-
-namespace quickbook
-{
- namespace cl = boost::spirit::classic;
-
- template <typename Rule, typename Action>
- inline void
- simple_markup(
- Rule& simple
- , char mark
- , Action const& action
- , Rule const& close
- )
- {
- simple =
- mark >>
- (
- (
- cl::graph_p // A single char. e.g. *c*
- >> cl::eps_p(mark
- >> (cl::space_p | cl::punct_p | cl::end_p))
- // space_p, punct_p or end_p
- ) // must follow mark
- |
- ( cl::graph_p >> // graph_p must follow mark
- *(cl::anychar_p -
- ( (cl::graph_p >> mark) // Make sure that we don't go
- | close // past a single block
- )
- ) >> cl::graph_p // graph_p must precede mark
- >> cl::eps_p(mark
- >> (cl::space_p | cl::punct_p | cl::end_p))
- // space_p, punct_p or end_p
- ) // must follow mark
- ) [action]
- >> mark
- ;
- }
-
- template <typename Scanner>
- struct phrase_grammar::definition
- {
- definition(phrase_grammar const& self);
-
- cl::rule<Scanner>
- space, blank, comment, phrase, phrase_markup, image,
- simple_phrase_end, phrase_end, bold, italic, underline, teletype,
- strikethrough, escape, url, common, funcref, classref,
- memberref, enumref, macroref, headerref, conceptref, globalref,
- anchor, link, hard_space, eol, inline_code, simple_format,
- simple_bold, simple_italic, simple_underline,
- simple_teletype, source_mode, template_,
- quote, code_block, footnote, replaceable, macro,
- dummy_block, cond_phrase, macro_identifier, template_args,
- template_args_1_4, template_arg_1_4,
- template_inner_arg_1_4, brackets_1_4,
- template_args_1_5, template_arg_1_5,
- template_inner_arg_1_5, brackets_1_5
- ;
-
- cl::rule<Scanner> const&
- start() const { return common; }
- };
-
- template <typename Scanner>
- phrase_grammar::definition<Scanner>::definition(phrase_grammar const& self)
- {
- using detail::var;
- quickbook::actions& actions = self.actions;
-
- space =
- *(cl::space_p | comment)
- ;
-
- blank =
- *(cl::blank_p | comment)
- ;
-
- eol = blank >> cl::eol_p
- ;
-
- phrase_end =
- ']' |
- cl::if_p(var(self.no_eols))
- [
- eol >> eol // Make sure that we don't go
- ] // past a single block, except
- ; // when preformatted.
-
- // Follows an alphanumeric identifier - ensures that it doesn't
- // match an empty space in the middle of the identifier.
- hard_space =
- (cl::eps_p - (cl::alnum_p | '_')) >> space
- ;
-
- comment =
- "[/" >> *(dummy_block | (cl::anychar_p - ']')) >> ']'
- ;
-
- dummy_block =
- '[' >> *(dummy_block | (cl::anychar_p - ']')) >> ']'
- ;
-
- common =
- macro
- | phrase_markup
- | code_block
- | inline_code
- | simple_format
- | escape
- | comment
- ;
-
- macro =
- // must not be followed by alpha or underscore
- cl::eps_p(actions.macro
- >> (cl::eps_p - (cl::alpha_p | '_')))
- >> actions.macro [actions.do_macro]
- ;
-
- static const bool true_ = true;
- static const bool false_ = false;
-
- template_ =
- (
- cl::ch_p('`') [cl::assign_a(actions.template_escape,true_)]
- |
- cl::eps_p [cl::assign_a(actions.template_escape,false_)]
- )
- >>
- ( (
- (cl::eps_p(cl::punct_p)
- >> actions.templates.scope
- ) [cl::assign_a(actions.template_identifier)]
- [cl::clear_a(actions.template_args)]
- >> !template_args
- ) | (
- (actions.templates.scope
- >> cl::eps_p(hard_space)
- ) [cl::assign_a(actions.template_identifier)]
- [cl::clear_a(actions.template_args)]
- >> space
- >> !template_args
- ) )
- >> cl::eps_p(']')
- ;
-
- template_args =
- cl::if_p(qbk_since(105u)) [
- template_args_1_5
- ].else_p [
- template_args_1_4
- ]
- ;
-
- template_args_1_4 = template_arg_1_4 >> *(".." >> template_arg_1_4);
-
- template_arg_1_4 =
- ( cl::eps_p(*cl::blank_p >> cl::eol_p)
- [cl::assign_a(actions.template_block, true_)]
- | cl::eps_p [cl::assign_a(actions.template_block, false_)]
- )
- >> template_inner_arg_1_4 [actions.template_arg]
- ;
-
- template_inner_arg_1_4 =
- +(brackets_1_4 | (cl::anychar_p - (cl::str_p("..") | ']')))
- ;
-
- brackets_1_4 =
- '[' >> template_inner_arg_1_4 >> ']'
- ;
-
- template_args_1_5 = template_arg_1_5 >> *(".." >> template_arg_1_5);
-
- template_arg_1_5 =
- ( cl::eps_p(*cl::blank_p >> cl::eol_p)
- [cl::assign_a(actions.template_block, true_)]
- | cl::eps_p [cl::assign_a(actions.template_block, false_)]
- )
- >> (+(brackets_1_5 | ('\\' >> cl::anychar_p) | (cl::anychar_p - (cl::str_p("..") | '[' | ']'))))
- [actions.template_arg]
- ;
-
- template_inner_arg_1_5 =
- +(brackets_1_5 | ('\\' >> cl::anychar_p) | (cl::anychar_p - (cl::str_p('[') | ']')))
- ;
-
- brackets_1_5 =
- '[' >> template_inner_arg_1_5 >> ']'
- ;
-
- inline_code =
- '`' >>
- (
- *(cl::anychar_p -
- ( '`'
- | (eol >> eol) // Make sure that we don't go
- ) // past a single block
- ) >> cl::eps_p('`')
- ) [actions.inline_code]
- >> '`'
- ;
-
- code_block =
- (
- "```" >>
- (
- *(cl::anychar_p - "```")
- >> cl::eps_p("```")
- ) [actions.code_block]
- >> "```"
- )
- | (
- "``" >>
- (
- *(cl::anychar_p - "``")
- >> cl::eps_p("``")
- ) [actions.code_block]
- >> "``"
- )
- ;
-
- simple_format =
- simple_bold
- | simple_italic
- | simple_underline
- | simple_teletype
- ;
-
- simple_phrase_end = '[' | phrase_end;
-
- simple_markup(simple_bold,
- '*', actions.simple_bold, simple_phrase_end);
- simple_markup(simple_italic,
- '/', actions.simple_italic, simple_phrase_end);
- simple_markup(simple_underline,
- '_', actions.simple_underline, simple_phrase_end);
- simple_markup(simple_teletype,
- '=', actions.simple_teletype, simple_phrase_end);
-
- phrase =
- *( common
- | comment
- | (cl::anychar_p - phrase_end) [actions.plain_char]
- )
- ;
-
- phrase_markup =
- '['
- >> ( cond_phrase
- | image
- | url
- | link
- | anchor
- | source_mode
- | funcref
- | classref
- | memberref
- | enumref
- | macroref
- | headerref
- | conceptref
- | globalref
- | bold
- | italic
- | underline
- | teletype
- | strikethrough
- | quote
- | replaceable
- | footnote
- | template_ [actions.do_template]
- | cl::str_p("br") [actions.break_]
- )
- >> ']'
- ;
-
- escape =
- cl::str_p("\\n") [actions.break_]
- | cl::str_p("\\ ") // ignore an escaped space
- | '\\' >> cl::punct_p [actions.raw_char]
- | "\\u" >> cl::repeat_p(4) [cl::chset<>("0-9a-fA-F")]
- [actions.escape_unicode]
- | "\\U" >> cl::repeat_p(8) [cl::chset<>("0-9a-fA-F")]
- [actions.escape_unicode]
- | (
- ("'''" >> !eol) [actions.escape_pre]
- >> *(cl::anychar_p - "'''") [actions.raw_char]
- >> cl::str_p("'''") [actions.escape_post]
- )
- ;
-
- macro_identifier =
- +(cl::anychar_p - (cl::space_p | ']'))
- ;
-
- cond_phrase =
- '?' >> blank
- >> macro_identifier [actions.cond_phrase_pre]
- >> (!phrase) [actions.cond_phrase_post]
- ;
-
- image =
- '$' >> blank [cl::clear_a(actions.attributes)]
- >> cl::if_p(qbk_since(105u)) [
- (+(
- *cl::space_p
- >> +(cl::anychar_p - (cl::space_p | phrase_end | '['))
- )) [cl::assign_a(actions.image_fileref)]
- >> hard_space
- >> *(
- '['
- >> (*(cl::alnum_p | '_')) [cl::assign_a(actions.attribute_name)]
- >> space
- >> (*(cl::anychar_p - (phrase_end | '[')))
- [actions.attribute]
- >> ']'
- >> space
- )
- ].else_p [
- (*(cl::anychar_p - phrase_end))
- [cl::assign_a(actions.image_fileref)]
- ]
- >> cl::eps_p(']') [actions.image]
- ;
-
- url =
- '@'
- >> (*(cl::anychar_p -
- (']' | hard_space))) [actions.url_pre]
- >> hard_space
- >> phrase [actions.url_post]
- ;
-
- link =
- "link" >> hard_space
- >> (*(cl::anychar_p -
- (']' | hard_space))) [actions.link_pre]
- >> hard_space
- >> phrase [actions.link_post]
- ;
-
- anchor =
- "#"
- >> blank
- >> (*(cl::anychar_p - phrase_end)) [actions.anchor]
- ;
-
- funcref =
- "funcref" >> hard_space
- >> (*(cl::anychar_p -
- (']' | hard_space))) [actions.funcref_pre]
- >> hard_space
- >> phrase [actions.funcref_post]
- ;
-
- classref =
- "classref" >> hard_space
- >> (*(cl::anychar_p -
- (']' | hard_space))) [actions.classref_pre]
- >> hard_space
- >> phrase [actions.classref_post]
- ;
-
- memberref =
- "memberref" >> hard_space
- >> (*(cl::anychar_p -
- (']' | hard_space))) [actions.memberref_pre]
- >> hard_space
- >> phrase [actions.memberref_post]
- ;
-
- enumref =
- "enumref" >> hard_space
- >> (*(cl::anychar_p -
- (']' | hard_space))) [actions.enumref_pre]
- >> hard_space
- >> phrase [actions.enumref_post]
- ;
-
- macroref =
- "macroref" >> hard_space
- >> (*(cl::anychar_p -
- (']' | hard_space))) [actions.macroref_pre]
- >> hard_space
- >> phrase [actions.macroref_post]
- ;
-
- headerref =
- "headerref" >> hard_space
- >> (*(cl::anychar_p -
- (']' | hard_space))) [actions.headerref_pre]
- >> hard_space
- >> phrase [actions.headerref_post]
- ;
-
- conceptref =
- "conceptref" >> hard_space
- >> (*(cl::anychar_p -
- (']' | hard_space))) [actions.conceptref_pre]
- >> hard_space
- >> phrase [actions.conceptref_post]
- ;
-
- globalref =
- "globalref" >> hard_space
- >> (*(cl::anychar_p -
- (']' | hard_space))) [actions.globalref_pre]
- >> hard_space
- >> phrase [actions.globalref_post]
- ;
-
- bold =
- cl::ch_p('*') [actions.bold_pre]
- >> blank >> phrase [actions.bold_post]
- ;
-
- italic =
- cl::ch_p('\'') [actions.italic_pre]
- >> blank >> phrase [actions.italic_post]
- ;
-
- underline =
- cl::ch_p('_') [actions.underline_pre]
- >> blank >> phrase [actions.underline_post]
- ;
-
- teletype =
- cl::ch_p('^') [actions.teletype_pre]
- >> blank >> phrase [actions.teletype_post]
- ;
-
- strikethrough =
- cl::ch_p('-') [actions.strikethrough_pre]
- >> blank >> phrase [actions.strikethrough_post]
- ;
-
- quote =
- cl::ch_p('"') [actions.quote_pre]
- >> blank >> phrase [actions.quote_post]
- ;
-
- replaceable =
- cl::ch_p('~') [actions.replaceable_pre]
- >> blank >> phrase [actions.replaceable_post]
- ;
-
- source_mode =
- (
- cl::str_p("c++")
- | "python"
- | "teletype"
- ) [cl::assign_a(actions.source_mode)]
- ;
-
- footnote =
- cl::str_p("footnote") [actions.footnote_pre]
- >> blank >> phrase [actions.footnote_post]
- ;
- }
-}
-
-#endif // BOOST_SPIRIT_QUICKBOOK_PHRASE_HPP
-

Modified: branches/release/tools/quickbook/src/quickbook.cpp
==============================================================================
--- branches/release/tools/quickbook/src/quickbook.cpp (original)
+++ branches/release/tools/quickbook/src/quickbook.cpp 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -15,8 +15,8 @@
 #include "input_path.hpp"
 #include <boost/spirit/include/classic_iterator.hpp>
 #include <boost/program_options.hpp>
-#include <boost/filesystem/v2/path.hpp>
-#include <boost/filesystem/v2/operations.hpp>
+#include <boost/filesystem/v3/path.hpp>
+#include <boost/filesystem/v3/operations.hpp>
 #include <boost/ref.hpp>
 
 #include <stdexcept>
@@ -28,7 +28,7 @@
 #pragma warning(disable:4355)
 #endif
 
-#define QUICKBOOK_VERSION "Quickbook Version 1.5.3"
+#define QUICKBOOK_VERSION "Quickbook Version 1.5.4"
 
 namespace quickbook
 {
@@ -44,8 +44,6 @@
 
     static void set_macros(actions& actor)
     {
- quickbook::command_line_grammar grammar(actor);
-
         for(std::vector<std::string>::const_iterator
                 it = preset_defines.begin(),
                 end = preset_defines.end();
@@ -54,7 +52,7 @@
             iterator first(it->begin(), it->end(), "command line parameter");
             iterator last(it->end(), it->end());
 
- call_parse(first, last, grammar);
+ cl::parse(first, last, actor.grammar().command_line_macro);
             // TODO: Check result?
         }
     }
@@ -81,15 +79,13 @@
         iterator first(storage.begin(), storage.end(), filein_);
         iterator last(storage.end(), storage.end());
 
- doc_info_grammar l(actor);
- cl::parse_info<iterator> info = call_parse(first, last, l);
+ cl::parse_info<iterator> info = cl::parse(first, last, actor.grammar().doc_info);
 
         if (info.hit || ignore_docinfo)
         {
             pre(actor.out, actor, ignore_docinfo);
 
- block_grammar g(actor);
- info = call_parse(info.hit ? info.stop : first, last, g);
+ info = cl::parse(info.hit ? info.stop : first, last, actor.grammar().block);
             if (info.full)
             {
                 post(actor.out, actor, ignore_docinfo);
@@ -111,6 +107,7 @@
     parse_document(char const* filein_, fs::path const& outdir, string_stream& out, bool ignore_docinfo = false)
     {
         actions actor(filein_, outdir, out);
+
         set_macros(actor);
         bool r = parse_file(filein_, actor);
         if (actor.section_level != 0)

Deleted: branches/release/tools/quickbook/src/scoped_block.hpp
==============================================================================
--- branches/release/tools/quickbook/src/scoped_block.hpp 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
+++ (empty file)
@@ -1,134 +0,0 @@
-/*=============================================================================
- Copyright (c) 2010 Daniel James
- Copyright (c) 2003 Martin Wille
- http://spirit.sourceforge.net/
-
- Distributed under 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)
- =============================================================================*/
-
-// Used to parse an inner block, saves the streams and restores them if the
-// parse fails. On success the action is passed the resulting block.
-//
-// Might be a good idea to do something more generic in the future.
-//
-// This is based on `boost::spirit::classic::scoped_lock` by Martin Wille
-
-#ifndef BOOST_QUICKBOOK_SCOPED_BLOCK_HPP
-#define BOOST_QUICKBOOK_SCOPED_BLOCK_HPP
-
-#include <boost/spirit/home/classic/namespace.hpp>
-#include <boost/spirit/home/classic/core/composite/composite.hpp>
-#include "actions_class.hpp"
-
-namespace quickbook {
-
- namespace cl = boost::spirit::classic;
-
- struct scoped_block_push
- {
- typedef std::string attribute;
-
- scoped_block_push(quickbook::actions& actions)
- : actions(actions)
- {
- actions.out.push();
- actions.phrase.push();
- }
-
- ~scoped_block_push()
- {
- actions.phrase.pop();
- actions.out.pop();
- }
-
- std::string const& finish()
- {
- actions.inside_paragraph();
- return actions.out.str();
- }
-
- quickbook::actions& actions;
- };
-
- template <typename ParserT>
- struct scoped_block_parser
- : public cl::unary< ParserT, cl::parser< scoped_block_parser<ParserT> > >
- {
- typedef scoped_block_parser<ParserT> self_t;
- typedef cl::unary< ParserT, cl::parser< scoped_block_parser<ParserT> > > base_t;
-
- template <typename ScannerT>
- struct result
- {
- typedef cl::match<std::string> type;
- };
-
- scoped_block_parser(quickbook::actions& a, ParserT const &p)
- : base_t(p)
- , actions(a)
- {}
-
- template <typename ScannerT>
- cl::match<std::string> parse(ScannerT const &scan) const
- {
- typedef typename ScannerT::iterator_t iterator_t;
- iterator_t save = scan.first;
-
- scoped_block_push push(actions);
- typename cl::parser_result<ParserT, ScannerT>::type result
- = this->subject().parse(scan);
-
- if (result)
- return scan.create_match(result.length(), push.finish(), save, scan.first);
- else
- return scan.no_match();
- }
-
- quickbook::actions& actions;
- };
-
- ///////////////////////////////////////////////////////////////////////////
- //
- // scoped_block_parser_gen
- //
- // generator for scoped_block_parser objects
- // operator[] returns scoped_block_parser according to its argument
- //
- ///////////////////////////////////////////////////////////////////////////
- struct scoped_block_parser_gen
- {
- explicit scoped_block_parser_gen(quickbook::actions& actions)
- : actions(actions) {}
-
- template<typename ParserT>
- scoped_block_parser
- <
- typename cl::as_parser<ParserT>::type
- >
- operator[](ParserT const &p) const
- {
- typedef cl::as_parser<ParserT> as_parser_t;
- typedef typename as_parser_t::type parser_t;
-
- return scoped_block_parser<parser_t>
- (actions, as_parser_t::convert(p));
- }
-
- quickbook::actions& actions;
- };
-
-
- ///////////////////////////////////////////////////////////////////////////
- //
- // scoped_block_d parser directive
- //
- // constructs a scoped_block_parser generator from its argument
- //
- ///////////////////////////////////////////////////////////////////////////
- inline scoped_block_parser_gen scoped_block(quickbook::actions& actions) {
- return scoped_block_parser_gen(actions);
- }
-
-}
-#endif // BOOST_QUICKBOOK_SCOPED_BLOCK_HPP

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-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -53,17 +53,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);
+ cpp_p_type cpp_p(temp, escape_actions.macro, do_macro_action(temp, escape_actions), 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);
+ python_p_type python_p(temp, escape_actions.macro, do_macro_action(temp, escape_actions), 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);
+ teletype_p_type teletype_p(temp, escape_actions.macro, do_macro_action(temp, escape_actions), escape_actions);
             boost::spirit::classic::parse(first, last, teletype_p);
         }
         else
@@ -76,4 +76,4 @@
         
         return str;
     }
-}
\ No newline at end of file
+}

Modified: branches/release/tools/quickbook/src/syntax_highlight.hpp
==============================================================================
--- branches/release/tools/quickbook/src/syntax_highlight.hpp (original)
+++ branches/release/tools/quickbook/src/syntax_highlight.hpp 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -15,7 +15,7 @@
 #include <boost/spirit/include/classic_chset.hpp>
 #include <boost/spirit/include/classic_symbols.hpp>
 #include <boost/spirit/include/classic_loops.hpp>
-#include "phrase_grammar.hpp"
+#include "grammar.hpp"
 
 namespace quickbook
 {
@@ -41,8 +41,7 @@
         struct definition
         {
             definition(cpp_highlight const& self)
- : common(self.escape_actions, unused)
- , unused(false)
+ : g(self.escape_actions.grammar())
             {
                 program
                     =
@@ -70,7 +69,7 @@
                     ;
 
                 qbk_phrase =
- *( common
+ *( g.common
                     | (cl::anychar_p - cl::str_p("``"))
                                         [self.escape_actions.plain_char]
                     )
@@ -158,9 +157,8 @@
                             string_char;
 
             cl::symbols<> keyword_;
- phrase_grammar common;
+ quickbook_grammar& g;
             std::string save;
- bool unused;
 
             cl::rule<Scanner> const&
             start() const { return program; }
@@ -194,8 +192,7 @@
         struct definition
         {
             definition(python_highlight const& self)
- : common(self.escape_actions, unused)
- , unused(false)
+ : g(self.escape_actions.grammar())
             {
                 program
                     =
@@ -221,7 +218,7 @@
                     ;
 
                 qbk_phrase =
- *( common
+ *( g.common
                     | (cl::anychar_p - cl::str_p("``"))
                                         [self.escape_actions.plain_char]
                     )
@@ -316,9 +313,8 @@
                             qbk_phrase, escape, string_char;
 
             cl::symbols<> keyword_;
- phrase_grammar common;
+ quickbook_grammar& g;
             std::string save;
- bool unused;
 
             cl::rule<Scanner> const&
             start() const { return program; }
@@ -348,14 +344,13 @@
         struct definition
         {
             definition(teletype_highlight const& self)
- : common(self.escape_actions, unused)
- , unused(false)
+ : g(self.escape_actions.grammar())
             {
                 program
                     =
                     *( macro
                     | escape
- | cl::repeat_p(1)[cl::anychar_p] [CharProcess(self.out)]
+ | cl::repeat_p(1)[cl::anychar_p] [CharProcess(self.out, self.escape_actions)]
                     )
                     ;
 
@@ -367,7 +362,7 @@
                     ;
 
                 qbk_phrase =
- *( common
+ *( g.common
                     | (cl::anychar_p - cl::str_p("``"))
                                         [self.escape_actions.plain_char]
                     )
@@ -395,9 +390,8 @@
 
             cl::rule<Scanner> program, macro, qbk_phrase, escape;
 
- phrase_grammar common;
+ quickbook_grammar& g;
             std::string save;
- bool unused;
 
             cl::rule<Scanner> const&
             start() const { return program; }

Modified: branches/release/tools/quickbook/src/utils.hpp
==============================================================================
--- branches/release/tools/quickbook/src/utils.hpp (original)
+++ branches/release/tools/quickbook/src/utils.hpp 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -51,6 +51,31 @@
         return var_wrapper<T>(t);
     }
 
+ template <typename Rule>
+ struct assign_rule_impl
+ {
+ assign_rule_impl(Rule& the_rule)
+ : m_the_rule(the_rule)
+ {
+ }
+
+ void operator()(Rule* new_rule) const
+ {
+ m_the_rule = *new_rule;
+ }
+
+ private:
+
+ Rule& m_the_rule;
+ };
+
+ template <typename Rule>
+ assign_rule_impl<Rule> assign_rule(Rule& the_rule)
+ {
+ return assign_rule_impl<Rule>(the_rule);
+ }
+
+
     // un-indent a code segment
     void unindent(std::string& program);
 

Modified: branches/release/tools/quickbook/test/Jamfile.v2
==============================================================================
--- branches/release/tools/quickbook/test/Jamfile.v2 (original)
+++ branches/release/tools/quickbook/test/Jamfile.v2 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -56,7 +56,8 @@
     [ quickbook-test xml-escape_1_5 ]
     [ quickbook-test blocks ]
     [ quickbook-test newline ]
- [ quickbook-test command_line_macro : : : <quickbook-define>__macro__=*bold* ]
+ [ quickbook-test anchor ]
+ [ quickbook-test command_line_macro : : : <quickbook-test-define>__macro__=*bold* ]
     [ quickbook-fail-test fail-include ]
     [ quickbook-fail-test fail-import ]
     [ quickbook-fail-test fail-template-arguments1 ]

Copied: branches/release/tools/quickbook/test/anchor.gold (from r67335, /trunk/tools/quickbook/test/anchor.gold)
==============================================================================
--- /trunk/tools/quickbook/test/anchor.gold (original)
+++ branches/release/tools/quickbook/test/anchor.gold 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -34,10 +34,13 @@
     <anchor id="a8"/>
   </section>
   <section id="anchor_test.section_anchor">
- <anchor id="a8"/> <title>Section Anchor</title>
+ <anchor id="a9"/> <title>Section Anchor</title>
     <section id="anchor_test.nested_section">
- <title>Nested Section</title>
+ <anchor id="a10"/> <title>Nested Section</title>
     </section>
- <anchor id="a9"/>
+ <anchor id="a11"/>
+ </section>
+ <section id="anchor_test.conditional_section_anchor">
+ <anchor id="a12"/> <title>Conditional Section Anchor</title>
   </section>
 </article>

Copied: branches/release/tools/quickbook/test/anchor.quickbook (from r67335, /trunk/tools/quickbook/test/anchor.quickbook)
==============================================================================
--- /trunk/tools/quickbook/test/anchor.quickbook (original)
+++ branches/release/tools/quickbook/test/anchor.quickbook 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -23,10 +23,14 @@
 
 [endsect]
 
-[#a8]
+[#a9]
 [section Section Anchor]
-[section Nested Section]
+[#a10][section Nested Section]
 [endsect]
 [/ This anchor is invalid, I'm not sure what to do with it]
-[#a9]
+[#a11]
 [endsect]
+
+[#a12][?__not_defined__ #a13]
+[section Conditional Section Anchor]
+[endsect]
\ No newline at end of file

Modified: branches/release/tools/quickbook/test/blocks.gold
==============================================================================
--- branches/release/tools/quickbook/test/blocks.gold (original)
+++ branches/release/tools/quickbook/test/blocks.gold 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -86,4 +86,27 @@
   <para>
     [tipping point]
   </para>
+ <para>
+ Multiple paragraphs because of the inline blocks.
+ </para>
+ <warning>
+ <para>
+ Warning
+ </para>
+ </warning>
+ <para>
+ This line should appear as a separate paragraph.
+ </para>
+ <warning>
+ <para>
+ Warning
+ </para>
+ </warning>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ This should be a list item because it's preceded by block markup.
+ </simpara>
+ </listitem>
+ </itemizedlist>
 </article>

Modified: branches/release/tools/quickbook/test/blocks.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/blocks.quickbook (original)
+++ branches/release/tools/quickbook/test/blocks.quickbook 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -39,4 +39,8 @@
 [/ Unfortunately footnotes currently can't contain blocks.]
 
 [/ Quickbook shouldn't think that this is a tip]
-[tipping point]
\ No newline at end of file
+[tipping point]
+
+Multiple paragraphs because of the inline blocks. [warning Warning] This
+line should appear as a separate paragraph.[warning Warning]
+* This should be a list item because it's preceded by block markup.
\ No newline at end of file

Modified: branches/release/tools/quickbook/test/cond_phrase.gold
==============================================================================
--- branches/release/tools/quickbook/test/cond_phrase.gold (original)
+++ branches/release/tools/quickbook/test/cond_phrase.gold 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -6,4 +6,7 @@
   <para>
     This should show
   </para>
+ <para>
+ The should be no space inserted.
+ </para>
 </article>

Modified: branches/release/tools/quickbook/test/cond_phrase.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/cond_phrase.quickbook (original)
+++ branches/release/tools/quickbook/test/cond_phrase.quickbook 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -2,7 +2,9 @@
     [quickbook 1.5]
 ]
 
-[def defined]
+[def __defined__]
 
-[?defined This should show]
-[?undefined This should not show]
\ No newline at end of file
+[? __defined__ This should show]
+[? __undefined__ This should not show]
+
+The should be no sp[?__undefined__ just some junk]ace inserted.
\ No newline at end of file

Modified: branches/release/tools/quickbook/test/doc-info-1.gold
==============================================================================
--- branches/release/tools/quickbook/test/doc-info-1.gold (original)
+++ branches/release/tools/quickbook/test/doc-info-1.gold 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE article PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
-<article id="karel_vom_u00e1_u010dka_and_tom_u00e1_u0161_martin_u00edk" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
+<article id="karel_vom_u00e1_u010dka_and_tom_u00e1_u0161_martin_u00edk" lang="en"
+last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>Karel Vom&#xE1;&#x10D;ka and Tom&#xE1;&#x161; Martin&#xED;k</title>
   <articleinfo>
     <authorgroup>

Modified: branches/release/tools/quickbook/test/doc-info-1.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/doc-info-1.quickbook (original)
+++ branches/release/tools/quickbook/test/doc-info-1.quickbook 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -8,4 +8,5 @@
 [category irrelevance]
 [/ [category commented out] ]
 [biblioid uri http://www.boost.org/tools/quickbook/test/doc-info-1.quickbook]
+[lang en]
 ]

Modified: branches/release/tools/quickbook/test/include_1_5.gold
==============================================================================
--- branches/release/tools/quickbook/test/include_1_5.gold (original)
+++ branches/release/tools/quickbook/test/include_1_5.gold 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -15,4 +15,16 @@
       Just testing.
     </para>
   </section>
+ <para>
+ Just trying including in a conditional macro.
+ </para>
+ <section id="foo2.test">
+ <title><link linkend="foo2.test">Test</link></title>
+ <para>
+ Just testing.
+ </para>
+ </section>
+ <para>
+ With some text around it.
+ </para>
 </article>

Modified: branches/release/tools/quickbook/test/include_1_5.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/include_1_5.quickbook (original)
+++ branches/release/tools/quickbook/test/include_1_5.quickbook 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -8,3 +8,9 @@
 [include:foo include-sub2.quickbook]
 [include empty.quickbook]
 
+[def __defined__]
+
+[? __undefined__ [include:foo1 include-sub2.quickbook] ]
+[? __defined__
+ Just trying including in a conditional macro. [include:foo2 include-sub2.quickbook]
+ With some text around it.]

Modified: branches/release/tools/quickbook/test/include_1_6.gold
==============================================================================
--- branches/release/tools/quickbook/test/include_1_6.gold (original)
+++ branches/release/tools/quickbook/test/include_1_6.gold 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -15,4 +15,16 @@
       Just testing.
     </para>
   </section>
+ <para>
+ Just trying including in a conditional macro.
+ </para>
+ <section id="foo2.test">
+ <title><link linkend="foo2.test">Test</link></title>
+ <para>
+ Just testing.
+ </para>
+ </section>
+ <para>
+ With some text around it.
+ </para>
 </article>

Modified: branches/release/tools/quickbook/test/include_1_6.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/include_1_6.quickbook (original)
+++ branches/release/tools/quickbook/test/include_1_6.quickbook 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -5,3 +5,10 @@
 
 [include include-sub2.quickbook]
 [include:foo include-sub2.quickbook]
+
+[def __defined__]
+
+[? __undefined__ [include:foo1 include-sub2.quickbook] ]
+[? __defined__
+ Just trying including in a conditional macro. [include:foo2 include-sub2.quickbook]
+ With some text around it.]

Modified: branches/release/tools/quickbook/test/link.gold
==============================================================================
--- branches/release/tools/quickbook/test/link.gold (original)
+++ branches/release/tools/quickbook/test/link.gold 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -3,18 +3,19 @@
 <article id="link_tests" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>Link tests</title>
   <section id="link_tests.different_types_of_links">
- <title>Different types of links</title> <anchor id="link-id" />
+ <title>Different types of links</title>
     <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>
- <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 alt="foo">link text</enumname>
- <macroname alt="foo">foo</macroname> <macroname alt="foo">link text</macroname>
- <headername alt="foo">foo</headername> <headername alt="foo">link text</headername>
- <conceptname alt="foo">foo</conceptname> <conceptname alt="foo">link text</conceptname>
- <globalname alt="foo">foo</globalname> <globalname alt="foo">link text</globalname>
+ <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
+ alt="foo">link text</enumname> <macroname alt="foo">foo</macroname> <macroname
+ alt="foo">link text</macroname> <headername alt="foo">foo</headername> <headername
+ alt="foo">link text</headername> <conceptname alt="foo">foo</conceptname>
+ <conceptname alt="foo">link text</conceptname> <globalname alt="foo">foo</globalname>
+ <globalname alt="foo">link text</globalname>
     </para>
   </section>
   <section id="link_tests.side_by_side_links">

Modified: branches/release/tools/quickbook/test/quickbook-testing.jam
==============================================================================
--- branches/release/tools/quickbook/test/quickbook-testing.jam (original)
+++ branches/release/tools/quickbook/test/quickbook-testing.jam 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -16,7 +16,7 @@
 import type ;
 
 feature.feature quickbook-testing.quickbook-command : : free dependency ;
-feature.feature <quickbook-define> : : free ;
+feature.feature <quickbook-test-define> : : free ;
 
 type.register QUICKBOOK_INPUT : quickbook ;
 type.register QUICKBOOK_OUTPUT ;
@@ -95,7 +95,7 @@
 
 ################################################################################
 toolset.flags quickbook-testing.process-quickbook quickbook-command <quickbook-testing.quickbook-command> ;
-toolset.flags quickbook-testing.process-quickbook QB-DEFINES <quickbook-define> ;
+toolset.flags quickbook-testing.process-quickbook QB-DEFINES <quickbook-test-define> ;
 
 rule process-quickbook ( target : source : properties * )
 {

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-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -173,5 +173,65 @@
         </tbody>
       </tgroup>
     </table>
+ <table frame="all" id="table_1_5.section1.empty_table">
+ <title>Empty Table</title>
+ <tgroup cols="0">
+ <tbody>
+ </tbody>
+ </tgroup>
+ </table>
+ <table frame="all" id="table_1_5.section1.table_with_an_empty_cell">
+ <title>Table with an empty cell</title>
+ <tgroup cols="1">
+ <tbody>
+ <row>
+ <entry>
+ <para>
+ x
+ </para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <table frame="all" id="table_1_5.section1.indentation">
+ <title>Indentation</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>
+ <para>
+ Header 1. Paragraph 1
+ </para>
+ <para>
+ Header 1. Paragraph 2
+ </para>
+ </entry>
+ <entry>
+ <para>
+ Header 2
+ </para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>
+ Row 1. Cell 1.
+ </para>
+ </entry>
+ <entry>
+ <para>
+ Row 1. Cell 2.
+ </para>
+ <para>
+ Row 1. Cell 2. Paragraph 2.
+ </para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
   </section>
 </article>

Modified: branches/release/tools/quickbook/test/table_1_5.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/table_1_5.quickbook (original)
+++ branches/release/tools/quickbook/test/table_1_5.quickbook 2011-01-08 10:22:18 EST (Sat, 08 Jan 2011)
@@ -40,4 +40,33 @@
     [[a][b]]
 ]
 
+[table Empty Table
+]
+
+[table Table with an empty cell
+[[x]]]
+
+[table Indentation
+ [
+ [
+ Header 1. Paragraph 1
+
+ Header 1. Paragraph 2
+ ]
+ [
+ Header 2
+ ]
+ ]
+ [
+ [
+ Row 1. Cell 1.
+ ]
+ [
+ Row 1. Cell 2.
+
+ Row 1. Cell 2. Paragraph 2.
+ ]
+ ]
+]
+
 [endsect]
\ No newline at end of file


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