Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75696 - in trunk/tools/quickbook: . doc src test test/doc-info test/html test/include test/snippets test/unit test/versions
From: dnljms_at_[hidden]
Date: 2011-11-27 16:35:09


Author: danieljames
Date: 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
New Revision: 75696
URL: http://svn.boost.org/trac/boost/changeset/75696

Log:
Quickbook: Merge from quickbook-dev to trunk.
Added:
   trunk/tools/quickbook/doc/1_6.qbk
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/doc/1_6.qbk
   trunk/tools/quickbook/src/actions_state.hpp
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/src/actions_state.hpp
   trunk/tools/quickbook/src/files.cpp
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/src/files.cpp
   trunk/tools/quickbook/src/files.hpp
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/src/files.hpp
   trunk/tools/quickbook/src/id_manager.cpp
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/src/id_manager.cpp
   trunk/tools/quickbook/src/id_manager.hpp
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/src/id_manager.hpp
   trunk/tools/quickbook/src/intrusive_base.hpp
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/src/intrusive_base.hpp
   trunk/tools/quickbook/src/string_ref.cpp
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/src/string_ref.cpp
   trunk/tools/quickbook/src/string_ref.hpp
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/src/string_ref.hpp
   trunk/tools/quickbook/src/symbols.hpp
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/src/symbols.hpp
   trunk/tools/quickbook/test/anchor-1_1.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/anchor-1_1.gold
   trunk/tools/quickbook/test/anchor-1_1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/anchor-1_1.quickbook
   trunk/tools/quickbook/test/anchor-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/anchor-1_6.gold
   trunk/tools/quickbook/test/anchor-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/anchor-1_6.quickbook
   trunk/tools/quickbook/test/blocks-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/blocks-1_5.gold
   trunk/tools/quickbook/test/blocks-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/blocks-1_5.quickbook
   trunk/tools/quickbook/test/callouts-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/callouts-1_5.gold
   trunk/tools/quickbook/test/callouts-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/callouts-1_5.quickbook
   trunk/tools/quickbook/test/code-1_1.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/code-1_1.gold
   trunk/tools/quickbook/test/code-1_1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/code-1_1.quickbook
   trunk/tools/quickbook/test/code-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/code-1_5.gold
   trunk/tools/quickbook/test/code-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/code-1_5.quickbook
   trunk/tools/quickbook/test/code_cpp-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/code_cpp-1_5.gold
   trunk/tools/quickbook/test/code_cpp-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/code_cpp-1_5.quickbook
   trunk/tools/quickbook/test/code_cpp_mismatched_escape-1_4-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/code_cpp_mismatched_escape-1_4-fail.quickbook
   trunk/tools/quickbook/test/code_python-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/code_python-1_5.gold
   trunk/tools/quickbook/test/code_python-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/code_python-1_5.quickbook
   trunk/tools/quickbook/test/code_python_mismatched_escape-1_4-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/code_python_mismatched_escape-1_4-fail.quickbook
   trunk/tools/quickbook/test/code_snippet-1_1.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/code_snippet-1_1.gold
   trunk/tools/quickbook/test/code_snippet-1_1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/code_snippet-1_1.quickbook
   trunk/tools/quickbook/test/code_teletype-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/code_teletype-1_5.gold
   trunk/tools/quickbook/test/code_teletype-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/code_teletype-1_5.quickbook
   trunk/tools/quickbook/test/command_line_macro-1_1.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/command_line_macro-1_1.gold
   trunk/tools/quickbook/test/command_line_macro-1_1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/command_line_macro-1_1.quickbook
   trunk/tools/quickbook/test/cond_phrase-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/cond_phrase-1_5.gold
   trunk/tools/quickbook/test/cond_phrase-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/cond_phrase-1_5.quickbook
   trunk/tools/quickbook/test/doc-info/empty_title-1_1.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/doc-info/empty_title-1_1.gold
   trunk/tools/quickbook/test/doc-info/empty_title-1_1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/doc-info/empty_title-1_1.quickbook
   trunk/tools/quickbook/test/doc-info/empty_title-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/doc-info/empty_title-1_5.gold
   trunk/tools/quickbook/test/doc-info/empty_title-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/doc-info/empty_title-1_5.quickbook
   trunk/tools/quickbook/test/doc-info/empty_title-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/doc-info/empty_title-1_6.gold
   trunk/tools/quickbook/test/doc-info/empty_title-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/doc-info/empty_title-1_6.quickbook
   trunk/tools/quickbook/test/doc-info/id1-1.5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/doc-info/id1-1.5.gold
   trunk/tools/quickbook/test/doc-info/id1-1.5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/doc-info/id1-1.5.quickbook
   trunk/tools/quickbook/test/doc-info/id1-docinfo-no-id.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/doc-info/id1-docinfo-no-id.quickbook
   trunk/tools/quickbook/test/doc-info/id1-no-docinfo.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/doc-info/id1-no-docinfo.quickbook
   trunk/tools/quickbook/test/doc-info/missing_doc_info-1_6-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/doc-info/missing_doc_info-1_6-fail.quickbook
   trunk/tools/quickbook/test/doc-info/title_trailing_space-1_1.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/doc-info/title_trailing_space-1_1.gold
   trunk/tools/quickbook/test/doc-info/title_trailing_space-1_1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/doc-info/title_trailing_space-1_1.quickbook
   trunk/tools/quickbook/test/doc-info/title_trailing_space-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/doc-info/title_trailing_space-1_6.gold
   trunk/tools/quickbook/test/doc-info/title_trailing_space-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/doc-info/title_trailing_space-1_6.quickbook
   trunk/tools/quickbook/test/elements-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/elements-1_5.gold
   trunk/tools/quickbook/test/elements-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/elements-1_5.quickbook
   trunk/tools/quickbook/test/elements-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/elements-1_6.gold
   trunk/tools/quickbook/test/elements-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/elements-1_6.quickbook
   trunk/tools/quickbook/test/empty.qbk
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/empty.qbk
   trunk/tools/quickbook/test/escape-1_1.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/escape-1_1.gold
   trunk/tools/quickbook/test/escape-1_1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/escape-1_1.quickbook
   trunk/tools/quickbook/test/escape-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/escape-1_6.gold
   trunk/tools/quickbook/test/escape-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/escape-1_6.quickbook
   trunk/tools/quickbook/test/escape-mismatched-1_5-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/escape-mismatched-1_5-fail.quickbook
   trunk/tools/quickbook/test/heading-1_1.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/heading-1_1.gold
   trunk/tools/quickbook/test/heading-1_1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/heading-1_1.quickbook
   trunk/tools/quickbook/test/heading-1_3.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/heading-1_3.gold
   trunk/tools/quickbook/test/heading-1_3.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/heading-1_3.quickbook
   trunk/tools/quickbook/test/heading-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/heading-1_5.gold
   trunk/tools/quickbook/test/heading-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/heading-1_5.quickbook
   trunk/tools/quickbook/test/heading-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/heading-1_6.gold
   trunk/tools/quickbook/test/heading-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/heading-1_6.quickbook
   trunk/tools/quickbook/test/heading_unclosed-1_4-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/heading_unclosed-1_4-fail.quickbook
   trunk/tools/quickbook/test/hr-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/hr-1_5.gold
   trunk/tools/quickbook/test/hr-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/hr-1_5.quickbook
   trunk/tools/quickbook/test/hr-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/hr-1_6.gold
   trunk/tools/quickbook/test/hr-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/hr-1_6.quickbook
   trunk/tools/quickbook/test/html/
      - copied from r75695, /branches/quickbook-dev/tools/quickbook/test/html/
   trunk/tools/quickbook/test/identifier-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/identifier-1_5.gold
   trunk/tools/quickbook/test/identifier-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/identifier-1_5.quickbook
   trunk/tools/quickbook/test/identifier-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/identifier-1_6.gold
   trunk/tools/quickbook/test/identifier-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/identifier-1_6.quickbook
   trunk/tools/quickbook/test/image-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/image-1_5.gold
   trunk/tools/quickbook/test/image-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/image-1_5.quickbook
   trunk/tools/quickbook/test/image-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/image-1_6.gold
   trunk/tools/quickbook/test/image-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/image-1_6.quickbook
   trunk/tools/quickbook/test/import-1_1-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/import-1_1-fail.quickbook
   trunk/tools/quickbook/test/include-1_1-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include-1_1-fail.quickbook
   trunk/tools/quickbook/test/include-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include-1_5.gold
   trunk/tools/quickbook/test/include-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include-1_5.quickbook
   trunk/tools/quickbook/test/include-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include-1_6.gold
   trunk/tools/quickbook/test/include-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include-1_6.quickbook
   trunk/tools/quickbook/test/include/code-import.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/code-import.gold
   trunk/tools/quickbook/test/include/code-import.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/code-import.quickbook
   trunk/tools/quickbook/test/include/code-include.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/code-include.gold
   trunk/tools/quickbook/test/include/code-include.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/code-include.quickbook
   trunk/tools/quickbook/test/include/compatibility-1_1.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/compatibility-1_1.gold
   trunk/tools/quickbook/test/include/compatibility-1_1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/compatibility-1_1.quickbook
   trunk/tools/quickbook/test/include/compatibility-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/compatibility-1_5.gold
   trunk/tools/quickbook/test/include/compatibility-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/compatibility-1_5.quickbook
   trunk/tools/quickbook/test/include/compatibility-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/compatibility-1_6.gold
   trunk/tools/quickbook/test/include/compatibility-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/compatibility-1_6.quickbook
   trunk/tools/quickbook/test/include/compatibility-inc.qbk
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/compatibility-inc.qbk
   trunk/tools/quickbook/test/include/compatibility-inc_1_1.qbk
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/compatibility-inc_1_1.qbk
   trunk/tools/quickbook/test/include/compatibility-inc_1_5.qbk
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/compatibility-inc_1_5.qbk
   trunk/tools/quickbook/test/include/compatibility-inc_1_6.qbk
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/compatibility-inc_1_6.qbk
   trunk/tools/quickbook/test/include/doc-title1-1.5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/doc-title1-1.5.gold
   trunk/tools/quickbook/test/include/doc-title1-1.5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/doc-title1-1.5.quickbook
   trunk/tools/quickbook/test/include/doc-title1-inc1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/doc-title1-inc1.quickbook
   trunk/tools/quickbook/test/include/doc-title1-inc2.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/doc-title1-inc2.quickbook
   trunk/tools/quickbook/test/include/doc-title1-inc3.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/doc-title1-inc3.quickbook
   trunk/tools/quickbook/test/include/doc-title1a-1.5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/doc-title1a-1.5.gold
   trunk/tools/quickbook/test/include/doc-title1a-1.5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/doc-title1a-1.5.quickbook
   trunk/tools/quickbook/test/include/import-basic-1.6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/import-basic-1.6.gold
   trunk/tools/quickbook/test/include/import-basic-1.6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/import-basic-1.6.quickbook
   trunk/tools/quickbook/test/include/import-basic-inc1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/import-basic-inc1.quickbook
   trunk/tools/quickbook/test/include/import-basic-inc2.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/import-basic-inc2.quickbook
   trunk/tools/quickbook/test/include/in_section-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/in_section-1_5.gold
   trunk/tools/quickbook/test/include/in_section-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/in_section-1_5.quickbook
   trunk/tools/quickbook/test/include/in_section-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/in_section-1_6.gold
   trunk/tools/quickbook/test/include/in_section-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/in_section-1_6.quickbook
   trunk/tools/quickbook/test/include/in_section-include1.qbk
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/in_section-include1.qbk
   trunk/tools/quickbook/test/include/in_section-include2.qbk
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/in_section-include2.qbk
   trunk/tools/quickbook/test/include/include-id-1.5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/include-id-1.5.gold
   trunk/tools/quickbook/test/include/include-id-1.5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/include-id-1.5.quickbook
   trunk/tools/quickbook/test/include/include-id-1.6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/include-id-1.6.gold
   trunk/tools/quickbook/test/include/include-id-1.6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/include-id-1.6.quickbook
   trunk/tools/quickbook/test/include/include-id-inc1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/include-id-inc1.quickbook
   trunk/tools/quickbook/test/include/include-id-inc2.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/include-id-inc2.quickbook
   trunk/tools/quickbook/test/include/include-id-inc3.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/include-id-inc3.quickbook
   trunk/tools/quickbook/test/include/include_id_unbalanced-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/include_id_unbalanced-1_6.gold
   trunk/tools/quickbook/test/include/include_id_unbalanced-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/include_id_unbalanced-1_6.quickbook
   trunk/tools/quickbook/test/include/include_id_unbalanced-inc1.qbk
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/include_id_unbalanced-inc1.qbk
   trunk/tools/quickbook/test/include/include_id_unbalanced-inc1a.qbk
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/include_id_unbalanced-inc1a.qbk
   trunk/tools/quickbook/test/include/include_id_unbalanced-inc2.qbk
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/include_id_unbalanced-inc2.qbk
   trunk/tools/quickbook/test/include/include_id_unbalanced-inc2a.qbk
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/include_id_unbalanced-inc2a.qbk
   trunk/tools/quickbook/test/include/macros-1.5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/macros-1.5.gold
   trunk/tools/quickbook/test/include/macros-1.5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/macros-1.5.quickbook
   trunk/tools/quickbook/test/include/macros-1.6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/macros-1.6.gold
   trunk/tools/quickbook/test/include/macros-1.6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/macros-1.6.quickbook
   trunk/tools/quickbook/test/include/macros-inc1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/macros-inc1.quickbook
   trunk/tools/quickbook/test/include/nested_compatibility-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/nested_compatibility-1_5.gold
   trunk/tools/quickbook/test/include/nested_compatibility-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/nested_compatibility-1_5.quickbook
   trunk/tools/quickbook/test/include/nested_compatibility-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/nested_compatibility-1_6.gold
   trunk/tools/quickbook/test/include/nested_compatibility-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/nested_compatibility-1_6.quickbook
   trunk/tools/quickbook/test/include/nested_compatibility_inc-1_5.qbk
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/nested_compatibility_inc-1_5.qbk
   trunk/tools/quickbook/test/include/nested_compatibility_inc-1_6.qbk
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/nested_compatibility_inc-1_6.qbk
   trunk/tools/quickbook/test/include/section-fail1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/section-fail1.quickbook
   trunk/tools/quickbook/test/include/section-fail2.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/section-fail2.quickbook
   trunk/tools/quickbook/test/include/section-inc1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/section-inc1.quickbook
   trunk/tools/quickbook/test/include/section-inc2.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/section-inc2.quickbook
   trunk/tools/quickbook/test/include/section-unclosed.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/section-unclosed.gold
   trunk/tools/quickbook/test/include/section-unclosed.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/section-unclosed.quickbook
   trunk/tools/quickbook/test/include/section.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/section.gold
   trunk/tools/quickbook/test/include/section.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/section.quickbook
   trunk/tools/quickbook/test/include/source_mode-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/source_mode-1_5.gold
   trunk/tools/quickbook/test/include/source_mode-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/source_mode-1_5.quickbook
   trunk/tools/quickbook/test/include/source_mode-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/source_mode-1_6.gold
   trunk/tools/quickbook/test/include/source_mode-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/source_mode-1_6.quickbook
   trunk/tools/quickbook/test/include/source_mode-inc1.qbk
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/source_mode-inc1.qbk
   trunk/tools/quickbook/test/include/templates-1.5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/templates-1.5.gold
   trunk/tools/quickbook/test/include/templates-1.5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/templates-1.5.quickbook
   trunk/tools/quickbook/test/include/templates-1.6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/templates-1.6.gold
   trunk/tools/quickbook/test/include/templates-1.6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/templates-1.6.quickbook
   trunk/tools/quickbook/test/include/templates-inc1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include/templates-inc1.quickbook
   trunk/tools/quickbook/test/include2-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include2-1_6.gold
   trunk/tools/quickbook/test/include2-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include2-1_6.quickbook
   trunk/tools/quickbook/test/include_sub-1_5.qbk
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include_sub-1_5.qbk
   trunk/tools/quickbook/test/include_sub.qbk
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include_sub.qbk
   trunk/tools/quickbook/test/include_win_path-1_6-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/include_win_path-1_6-fail.quickbook
   trunk/tools/quickbook/test/link-1_1.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/link-1_1.gold
   trunk/tools/quickbook/test/link-1_1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/link-1_1.quickbook
   trunk/tools/quickbook/test/link-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/link-1_6.gold
   trunk/tools/quickbook/test/link-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/link-1_6.quickbook
   trunk/tools/quickbook/test/list_test-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/list_test-1_5.gold
   trunk/tools/quickbook/test/list_test-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/list_test-1_5.quickbook
   trunk/tools/quickbook/test/list_test-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/list_test-1_6.gold
   trunk/tools/quickbook/test/list_test-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/list_test-1_6.quickbook
   trunk/tools/quickbook/test/macro-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/macro-1_5.gold
   trunk/tools/quickbook/test/macro-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/macro-1_5.quickbook
   trunk/tools/quickbook/test/macro-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/macro-1_6.gold
   trunk/tools/quickbook/test/macro-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/macro-1_6.quickbook
   trunk/tools/quickbook/test/mismatched_brackets-1_1-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/mismatched_brackets-1_1-fail.quickbook
   trunk/tools/quickbook/test/mismatched_brackets1-1_1.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/mismatched_brackets1-1_1.gold
   trunk/tools/quickbook/test/mismatched_brackets1-1_1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/mismatched_brackets1-1_1.quickbook
   trunk/tools/quickbook/test/mismatched_brackets2-1_1.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/mismatched_brackets2-1_1.gold
   trunk/tools/quickbook/test/mismatched_brackets2-1_1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/mismatched_brackets2-1_1.quickbook
   trunk/tools/quickbook/test/newline-1_1.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/newline-1_1.gold
   trunk/tools/quickbook/test/newline-1_1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/newline-1_1.quickbook
   trunk/tools/quickbook/test/para_test-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/para_test-1_5.gold
   trunk/tools/quickbook/test/para_test-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/para_test-1_5.quickbook
   trunk/tools/quickbook/test/post_process-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/post_process-fail.quickbook
   trunk/tools/quickbook/test/preformatted-1_1.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/preformatted-1_1.gold
   trunk/tools/quickbook/test/preformatted-1_1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/preformatted-1_1.quickbook
   trunk/tools/quickbook/test/preformatted-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/preformatted-1_6.gold
   trunk/tools/quickbook/test/preformatted-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/preformatted-1_6.quickbook
   trunk/tools/quickbook/test/quickbook_manual-1_4.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/quickbook_manual-1_4.gold
   trunk/tools/quickbook/test/quickbook_manual-1_4.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/quickbook_manual-1_4.quickbook
   trunk/tools/quickbook/test/role-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/role-1_6.gold
   trunk/tools/quickbook/test/role-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/role-1_6.quickbook
   trunk/tools/quickbook/test/section-1_4.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/section-1_4.gold
   trunk/tools/quickbook/test/section-1_4.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/section-1_4.quickbook
   trunk/tools/quickbook/test/section-1_5-unclosed.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/section-1_5-unclosed.gold
   trunk/tools/quickbook/test/section-1_5-unclosed.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/section-1_5-unclosed.quickbook
   trunk/tools/quickbook/test/section-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/section-1_5.gold
   trunk/tools/quickbook/test/section-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/section-1_5.quickbook
   trunk/tools/quickbook/test/simple_markup-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/simple_markup-1_5.gold
   trunk/tools/quickbook/test/simple_markup-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/simple_markup-1_5.quickbook
   trunk/tools/quickbook/test/snippets/unbalanced_snippet1-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/snippets/unbalanced_snippet1-1_5.gold
   trunk/tools/quickbook/test/snippets/unbalanced_snippet1-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/snippets/unbalanced_snippet1-1_5.quickbook
   trunk/tools/quickbook/test/snippets/unbalanced_snippet1-1_6-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/snippets/unbalanced_snippet1-1_6-fail.quickbook
   trunk/tools/quickbook/test/snippets/unbalanced_snippet1.cpp
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/snippets/unbalanced_snippet1.cpp
   trunk/tools/quickbook/test/snippets/unbalanced_snippet2-1_6-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/snippets/unbalanced_snippet2-1_6-fail.quickbook
   trunk/tools/quickbook/test/snippets/unbalanced_snippet2.cpp
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/snippets/unbalanced_snippet2.cpp
   trunk/tools/quickbook/test/svg-1_1.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/svg-1_1.gold
   trunk/tools/quickbook/test/svg-1_1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/svg-1_1.quickbook
   trunk/tools/quickbook/test/table-1_3.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/table-1_3.gold
   trunk/tools/quickbook/test/table-1_3.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/table-1_3.quickbook
   trunk/tools/quickbook/test/table-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/table-1_5.gold
   trunk/tools/quickbook/test/table-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/table-1_5.quickbook
   trunk/tools/quickbook/test/table-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/table-1_6.gold
   trunk/tools/quickbook/test/table-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/table-1_6.quickbook
   trunk/tools/quickbook/test/template_arguments1-1_1-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/template_arguments1-1_1-fail.quickbook
   trunk/tools/quickbook/test/template_arguments2-1_1-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/template_arguments2-1_1-fail.quickbook
   trunk/tools/quickbook/test/template_arguments3-1_1-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/template_arguments3-1_1-fail.quickbook
   trunk/tools/quickbook/test/template_section-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/template_section-1_5.gold
   trunk/tools/quickbook/test/template_section-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/template_section-1_5.quickbook
   trunk/tools/quickbook/test/template_section1-1_5-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/template_section1-1_5-fail.quickbook
   trunk/tools/quickbook/test/template_section2-1_5-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/template_section2-1_5-fail.quickbook
   trunk/tools/quickbook/test/template_section3-1_5-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/template_section3-1_5-fail.quickbook
   trunk/tools/quickbook/test/templates-1_3.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/templates-1_3.gold
   trunk/tools/quickbook/test/templates-1_3.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/templates-1_3.quickbook
   trunk/tools/quickbook/test/templates-1_4.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/templates-1_4.gold
   trunk/tools/quickbook/test/templates-1_4.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/templates-1_4.quickbook
   trunk/tools/quickbook/test/templates-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/templates-1_5.gold
   trunk/tools/quickbook/test/templates-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/templates-1_5.quickbook
   trunk/tools/quickbook/test/unicode_escape-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/unicode_escape-1_5.gold
   trunk/tools/quickbook/test/unicode_escape-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/unicode_escape-1_5.quickbook
   trunk/tools/quickbook/test/unit/symbols_find_null.cpp
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/unit/symbols_find_null.cpp
   trunk/tools/quickbook/test/unit/symbols_tests.cpp
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/unit/symbols_tests.cpp
   trunk/tools/quickbook/test/unmatched_element-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/unmatched_element-1_5.gold
   trunk/tools/quickbook/test/unmatched_element-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/unmatched_element-1_5.quickbook
   trunk/tools/quickbook/test/unmatched_element-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/unmatched_element-1_6.gold
   trunk/tools/quickbook/test/unmatched_element-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/unmatched_element-1_6.quickbook
   trunk/tools/quickbook/test/utf16be_bom-1_5-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/utf16be_bom-1_5-fail.quickbook
   trunk/tools/quickbook/test/utf16le_bom-1_5-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/utf16le_bom-1_5-fail.quickbook
   trunk/tools/quickbook/test/utf8-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/utf8-1_5.gold
   trunk/tools/quickbook/test/utf8-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/utf8-1_5.quickbook
   trunk/tools/quickbook/test/utf8_bom-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/utf8_bom-1_5.gold
   trunk/tools/quickbook/test/utf8_bom-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/utf8_bom-1_5.quickbook
   trunk/tools/quickbook/test/variablelist-1_5-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/variablelist-1_5-fail.quickbook
   trunk/tools/quickbook/test/variablelist-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/variablelist-1_5.gold
   trunk/tools/quickbook/test/variablelist-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/variablelist-1_5.quickbook
   trunk/tools/quickbook/test/version-0_1-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/version-0_1-fail.quickbook
   trunk/tools/quickbook/test/version-1_7-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/version-1_7-fail.quickbook
   trunk/tools/quickbook/test/version-2_0-fail.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/version-2_0-fail.quickbook
   trunk/tools/quickbook/test/versions/
      - copied from r75695, /branches/quickbook-dev/tools/quickbook/test/versions/
   trunk/tools/quickbook/test/xinclude-1_1.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/xinclude-1_1.gold
   trunk/tools/quickbook/test/xinclude-1_1.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/xinclude-1_1.quickbook
   trunk/tools/quickbook/test/xml_escape-1_2.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/xml_escape-1_2.gold
   trunk/tools/quickbook/test/xml_escape-1_2.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/xml_escape-1_2.quickbook
   trunk/tools/quickbook/test/xml_escape-1_5.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/xml_escape-1_5.gold
   trunk/tools/quickbook/test/xml_escape-1_5.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/xml_escape-1_5.quickbook
   trunk/tools/quickbook/test/xmlbase-1_6.gold
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/xmlbase-1_6.gold
   trunk/tools/quickbook/test/xmlbase-1_6.quickbook
      - copied unchanged from r75695, /branches/quickbook-dev/tools/quickbook/test/xmlbase-1_6.quickbook
Removed:
   trunk/tools/quickbook/src/id_generator.hpp
   trunk/tools/quickbook/test/anchor.quickbook
   trunk/tools/quickbook/test/blocks.quickbook
   trunk/tools/quickbook/test/code-block-1.quickbook
   trunk/tools/quickbook/test/code-block-2.quickbook
   trunk/tools/quickbook/test/code-block-cpp.quickbook
   trunk/tools/quickbook/test/code-block-python.quickbook
   trunk/tools/quickbook/test/code-block-teletype.quickbook
   trunk/tools/quickbook/test/code-block.quickbook
   trunk/tools/quickbook/test/code-snippet.gold
   trunk/tools/quickbook/test/code-snippet.quickbook
   trunk/tools/quickbook/test/command_line_macro.gold
   trunk/tools/quickbook/test/command_line_macro.quickbook
   trunk/tools/quickbook/test/cond_phrase.gold
   trunk/tools/quickbook/test/cond_phrase.quickbook
   trunk/tools/quickbook/test/elements_1_5.gold
   trunk/tools/quickbook/test/elements_1_5.quickbook
   trunk/tools/quickbook/test/elements_1_6.gold
   trunk/tools/quickbook/test/elements_1_6.quickbook
   trunk/tools/quickbook/test/empty.quickbook
   trunk/tools/quickbook/test/escape.gold
   trunk/tools/quickbook/test/escape.quickbook
   trunk/tools/quickbook/test/fail-cpp-mismatched-escape.quickbook
   trunk/tools/quickbook/test/fail-import.quickbook
   trunk/tools/quickbook/test/fail-include.quickbook
   trunk/tools/quickbook/test/fail-mismatched-boostbook-escape.quickbook
   trunk/tools/quickbook/test/fail-parse-error1.quickbook
   trunk/tools/quickbook/test/fail-parse-error2.quickbook
   trunk/tools/quickbook/test/fail-post-process.quickbook
   trunk/tools/quickbook/test/fail-python-mismatched-escape.quickbook
   trunk/tools/quickbook/test/fail-template-arguments1.quickbook
   trunk/tools/quickbook/test/fail-template-arguments2.quickbook
   trunk/tools/quickbook/test/fail-template-arguments3.quickbook
   trunk/tools/quickbook/test/fail-template-lookup1.quickbook
   trunk/tools/quickbook/test/fail-template-section-1.quickbook
   trunk/tools/quickbook/test/fail-template-section-2.quickbook
   trunk/tools/quickbook/test/fail-template-section-3.quickbook
   trunk/tools/quickbook/test/fail-unknown-quickbook-1.quickbook
   trunk/tools/quickbook/test/fail-unknown-quickbook-2.quickbook
   trunk/tools/quickbook/test/fail-unknown-quickbook-3.quickbook
   trunk/tools/quickbook/test/heading_1_6.quickbook
   trunk/tools/quickbook/test/identifier_1_5.quickbook
   trunk/tools/quickbook/test/identifier_1_6.quickbook
   trunk/tools/quickbook/test/image_1_5.gold
   trunk/tools/quickbook/test/image_1_5.quickbook
   trunk/tools/quickbook/test/include-sub.quickbook
   trunk/tools/quickbook/test/include-sub2.quickbook
   trunk/tools/quickbook/test/include_1_5.gold
   trunk/tools/quickbook/test/include_1_5.quickbook
   trunk/tools/quickbook/test/include_1_6-2.gold
   trunk/tools/quickbook/test/include_1_6-2.quickbook
   trunk/tools/quickbook/test/include_1_6.gold
   trunk/tools/quickbook/test/include_1_6.quickbook
   trunk/tools/quickbook/test/link.gold
   trunk/tools/quickbook/test/link.quickbook
   trunk/tools/quickbook/test/list_test.gold
   trunk/tools/quickbook/test/list_test.quickbook
   trunk/tools/quickbook/test/macro.gold
   trunk/tools/quickbook/test/macro.quickbook
   trunk/tools/quickbook/test/mismatched-brackets-1.gold
   trunk/tools/quickbook/test/mismatched-brackets-1.quickbook
   trunk/tools/quickbook/test/mismatched-brackets-2.gold
   trunk/tools/quickbook/test/mismatched-brackets-2.quickbook
   trunk/tools/quickbook/test/mismatched-brackets-3.quickbook
   trunk/tools/quickbook/test/newline.gold
   trunk/tools/quickbook/test/newline.quickbook
   trunk/tools/quickbook/test/para-test.gold
   trunk/tools/quickbook/test/para-test.quickbook
   trunk/tools/quickbook/test/preformatted.quickbook
   trunk/tools/quickbook/test/quickbook-manual.quickbook
   trunk/tools/quickbook/test/section_1_4.gold
   trunk/tools/quickbook/test/section_1_4.quickbook
   trunk/tools/quickbook/test/section_1_5.gold
   trunk/tools/quickbook/test/section_1_5.quickbook
   trunk/tools/quickbook/test/simple_markup.gold
   trunk/tools/quickbook/test/simple_markup.quickbook
   trunk/tools/quickbook/test/table_1_3.gold
   trunk/tools/quickbook/test/table_1_3.quickbook
   trunk/tools/quickbook/test/table_1_5.gold
   trunk/tools/quickbook/test/table_1_5.quickbook
   trunk/tools/quickbook/test/template-section.quickbook
   trunk/tools/quickbook/test/templates.quickbook
   trunk/tools/quickbook/test/templates_1_4.gold
   trunk/tools/quickbook/test/templates_1_4.quickbook
   trunk/tools/quickbook/test/templates_1_5.gold
   trunk/tools/quickbook/test/templates_1_5.quickbook
   trunk/tools/quickbook/test/unicode-escape.quickbook
   trunk/tools/quickbook/test/unit/iterator_tests.cpp
   trunk/tools/quickbook/test/utf-16be-bom.quickbook
   trunk/tools/quickbook/test/utf-16le-bom.quickbook
   trunk/tools/quickbook/test/utf-8-bom.quickbook
   trunk/tools/quickbook/test/utf-8.quickbook
   trunk/tools/quickbook/test/variablelist.gold
   trunk/tools/quickbook/test/variablelist.quickbook
   trunk/tools/quickbook/test/xinclude.gold
   trunk/tools/quickbook/test/xinclude.quickbook
   trunk/tools/quickbook/test/xml-escape_1_2.gold
   trunk/tools/quickbook/test/xml-escape_1_2.quickbook
   trunk/tools/quickbook/test/xml-escape_1_5.gold
   trunk/tools/quickbook/test/xml-escape_1_5.quickbook
Properties modified:
   trunk/tools/quickbook/ (props changed)
Text files modified:
   trunk/tools/quickbook/doc/quickbook.qbk | 19
   trunk/tools/quickbook/src/Jamfile.v2 | 4
   trunk/tools/quickbook/src/actions.cpp | 1418 +++++++++++++++++++--------------------
   trunk/tools/quickbook/src/actions.hpp | 241 ++----
   trunk/tools/quickbook/src/actions_class.cpp | 159 +--
   trunk/tools/quickbook/src/actions_class.hpp | 99 -
   trunk/tools/quickbook/src/block_element_grammar.cpp | 68 +
   trunk/tools/quickbook/src/block_tags.hpp | 4
   trunk/tools/quickbook/src/code_snippet.cpp | 424 +++++++----
   trunk/tools/quickbook/src/doc_info_actions.cpp | 394 +++++++----
   trunk/tools/quickbook/src/doc_info_grammar.cpp | 184 +++--
   trunk/tools/quickbook/src/doc_info_tags.hpp | 10
   trunk/tools/quickbook/src/fwd.hpp | 9
   trunk/tools/quickbook/src/grammar.cpp | 5
   trunk/tools/quickbook/src/grammar.hpp | 24
   trunk/tools/quickbook/src/grammar_impl.hpp | 39
   trunk/tools/quickbook/src/input_path.cpp | 19
   trunk/tools/quickbook/src/input_path.hpp | 3
   trunk/tools/quickbook/src/iterator.hpp | 51 -
   trunk/tools/quickbook/src/main_grammar.cpp | 699 ++++++++++++++-----
   trunk/tools/quickbook/src/markups.cpp | 1
   trunk/tools/quickbook/src/parsers.hpp | 9
   trunk/tools/quickbook/src/phrase_element_grammar.cpp | 80 +
   trunk/tools/quickbook/src/phrase_tags.hpp | 1
   trunk/tools/quickbook/src/quickbook.cpp | 131 ++-
   trunk/tools/quickbook/src/quickbook.hpp | 8
   trunk/tools/quickbook/src/scoped.hpp | 3
   trunk/tools/quickbook/src/syntax_highlight.cpp | 314 ++++++--
   trunk/tools/quickbook/src/template_stack.cpp | 50
   trunk/tools/quickbook/src/template_stack.hpp | 57 -
   trunk/tools/quickbook/src/template_tags.hpp | 1
   trunk/tools/quickbook/src/utils.cpp | 190 -----
   trunk/tools/quickbook/src/utils.hpp | 20
   trunk/tools/quickbook/src/values.cpp | 432 +++--------
   trunk/tools/quickbook/src/values.hpp | 62 -
   trunk/tools/quickbook/src/values_parse.hpp | 40
   trunk/tools/quickbook/test/Jamfile.v2 | 165 ++--
   trunk/tools/quickbook/test/doc-info/Jamfile.v2 | 7
   trunk/tools/quickbook/test/doc-info/escape-1.6.gold | 4
   trunk/tools/quickbook/test/doc-info/source-mode-1.6.gold | 28
   trunk/tools/quickbook/test/doc-info/source-mode-cpp-include.quickbook | 3
   trunk/tools/quickbook/test/include/Jamfile.v2 | 28
   trunk/tools/quickbook/test/snippets/Jamfile.v2 | 3
   trunk/tools/quickbook/test/snippets/pass_thru.gold | 10
   trunk/tools/quickbook/test/stub.c | 6
   trunk/tools/quickbook/test/stub.cpp | 3
   trunk/tools/quickbook/test/stub.py | 3
   trunk/tools/quickbook/test/unit/Jamfile.v2 | 14
   trunk/tools/quickbook/test/unit/values_test.cpp | 98 --
   49 files changed, 2940 insertions(+), 2704 deletions(-)

Modified: trunk/tools/quickbook/doc/quickbook.qbk
==============================================================================
--- trunk/tools/quickbook/doc/quickbook.qbk (original)
+++ trunk/tools/quickbook/doc/quickbook.qbk 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -1,5 +1,6 @@
 [article Quickbook
- [quickbook 1.5]
+ [quickbook 1.6]
+ [compatibility-mode 1.5]
     [version 1.5]
     [authors [de Guzman, Joel], [Niebler, Eric]]
     [copyright 2002 2004 2006 Joel de Guzman, Eric Niebler]
@@ -117,7 +118,11 @@
 
 [section:change_log Change Log]
 
-[h3 Version 1.3]
+[h3:version_1_1 Version 1.1 - Boost 1.33.0]
+
+* First version to be included in boost.
+
+[h3:version_1_3 Version 1.3 - Boost 1.34.0 to 1.34.1]
 
 * Quickbook file inclusion \[include\].
 * Better xml output (pretty layout). Check out the generated XML.
@@ -148,7 +153,7 @@
 * Post-processor bug fix for escaped XML code that it does not recognize.
 * Replaceable, with the \[~replacement\] syntax.
 
-[h3 Version 1.4]
+[h3:version_1_4 Version 1.4 - Boost 1.35.0 to 1.40.0]
 
 * Generic Headers
 * Code changes to allow full recursion (i.e. Collectors and push/pop functions)
@@ -169,7 +174,7 @@
 * Searching of included and imported files in an extensible search path with
   `--include-path` (`-I`) option.
   
-[h3 Version 1.5]
+[h3:version_1_5 Version 1.5 - Boost 1.41.0 to 1.42.0]
 
 * Support multiple copyright entrys in document info.
 * Improved SVG support.
@@ -445,7 +450,7 @@
   which can be a common mistake, does not corrupt anything past a single block.
   We do not want the rest of the document to be rendered bold just because we
   forgot a trailing '*'. A single block is terminated by two end of lines or
- the close bracket: ']'.
+ the close bracket: '\]'.
 * A line starting with the star will be interpreted as an unordered list.
   See __unordered_lists__.
 
@@ -1183,7 +1188,7 @@
 [section Preformatted]
 
 Sometimes, you don't want some preformatted text to be parsed as C++. In such
-cases, use the [^[pre ... \]] markup block.
+cases, use the [^\[pre ... \]] markup block.
 
 [pre'''
 [pre
@@ -2017,6 +2022,8 @@
 
 [endsect] [/Syntax Summary]
 
+[include 1_6.qbk]
+
 [section:install Installation and configuration]
 
 This section provides some guidelines on how to install and configure

Modified: trunk/tools/quickbook/src/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/src/Jamfile.v2 (original)
+++ trunk/tools/quickbook/src/Jamfile.v2 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -26,9 +26,11 @@
     doc_info_actions.cpp
     actions_class.cpp
     utils.cpp
+ files.cpp
+ string_ref.cpp
     input_path.cpp
     values.cpp
- id_generator.cpp
+ id_manager.cpp
     post_process.cpp
     collector.cpp
     template_stack.cpp

Modified: trunk/tools/quickbook/src/actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions.cpp (original)
+++ trunk/tools/quickbook/src/actions.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -23,13 +23,15 @@
 #include "quickbook.hpp"
 #include "actions.hpp"
 #include "utils.hpp"
+#include "files.hpp"
 #include "markups.hpp"
 #include "actions_class.hpp"
+#include "actions_state.hpp"
 #include "grammar.hpp"
 #include "input_path.hpp"
 #include "block_tags.hpp"
 #include "phrase_tags.hpp"
-#include "id_generator.hpp"
+#include "id_manager.hpp"
 
 namespace quickbook
 {
@@ -39,18 +41,6 @@
     unsigned qbk_version_n = 0; // qbk_major_version * 100 + qbk_minor_version
 
     namespace {
- std::string fully_qualified_id(std::string const& library_id,
- std::string const& qualified_section_id,
- std::string const& section_id)
- {
- std::string id = library_id;
- if(!id.empty() && !qualified_section_id.empty()) id += '.';
- id += qualified_section_id;
- if(!id.empty() && !section_id.empty()) id += '.';
- id += section_id;
- return id;
- }
-
         void write_anchors(quickbook::actions& actions, collector& tgt)
         {
             for(quickbook::actions::string_list::iterator
@@ -68,19 +58,19 @@
         
         std::string add_anchor(quickbook::actions& actions,
                 std::string const& id,
- id_generator::categories category = id_generator::explicit_id)
+ id_category::categories category =
+ id_category::explicit_anchor_id)
         {
- std::string placeholder = actions.ids.add(id, category);
+ std::string placeholder = actions.ids.add_anchor(id, category);
             actions.anchors.push_back(placeholder);
             return placeholder;
         }
     }
 
- void list_action(quickbook::actions&, value);
     void explicit_list_action(quickbook::actions&, value);
     void header_action(quickbook::actions&, value);
     void begin_section_action(quickbook::actions&, value);
- void end_section_action(quickbook::actions&, value, file_position);
+ void end_section_action(quickbook::actions&, value, string_iterator);
     void block_action(quickbook::actions&, value);
     void block_empty_action(quickbook::actions&, value);
     void macro_definition_action(quickbook::actions&, value);
@@ -88,28 +78,26 @@
     void variable_list_action(quickbook::actions&, value);
     void table_action(quickbook::actions&, value);
     void xinclude_action(quickbook::actions&, value);
- void import_action(quickbook::actions&, value);
- void include_action(quickbook::actions&, value);
+ void include_action(quickbook::actions&, value, string_iterator);
     void image_action(quickbook::actions&, value);
     void anchor_action(quickbook::actions&, value);
     void link_action(quickbook::actions&, value);
     void phrase_action(quickbook::actions&, value);
+ void role_action(quickbook::actions&, value);
     void footnote_action(quickbook::actions&, value);
     void raw_phrase_action(quickbook::actions&, value);
     void source_mode_action(quickbook::actions&, value);
- void do_template_action(quickbook::actions&, value, file_position);
+ void do_template_action(quickbook::actions&, value, string_iterator);
     
- void element_action::operator()(iterator first, iterator) const
+ void element_action::operator()(parse_iterator first, parse_iterator) const
     {
         value_consumer values = actions.values.release();
- if(!values.check()) return;
+ if(!values.check() || !actions.conditional) return;
         value v = values.consume();
- if(values.check()) return;
+ values.finish();
         
         switch(v.get_tag())
         {
- case block_tags::list:
- return list_action(actions, v);
         case block_tags::ordered_list:
         case block_tags::itemized_list:
             return explicit_list_action(actions, v);
@@ -124,7 +112,7 @@
         case block_tags::begin_section:
             return begin_section_action(actions, v);
         case block_tags::end_section:
- return end_section_action(actions, v, first.get_position());
+ return end_section_action(actions, v, first.base());
         case block_tags::blurb:
         case block_tags::preformatted:
         case block_tags::blockquote:
@@ -133,6 +121,7 @@
         case block_tags::important:
         case block_tags::note:
         case block_tags::tip:
+ case block_tags::block:
             return block_action(actions,v);
         case block_tags::hr:
             return block_empty_action(actions,v);
@@ -147,9 +136,8 @@
         case block_tags::xinclude:
             return xinclude_action(actions, v);
         case block_tags::import:
- return import_action(actions, v);
         case block_tags::include:
- return include_action(actions, v);
+ return include_action(actions, v, first.base());
         case phrase_tags::image:
             return image_action(actions, v);
         case phrase_tags::anchor:
@@ -177,34 +165,33 @@
             return footnote_action(actions, v);
         case phrase_tags::escape:
             return raw_phrase_action(actions, v);
+ case phrase_tags::role:
+ return role_action(actions, v);
         case source_mode_tags::cpp:
         case source_mode_tags::python:
         case source_mode_tags::teletype:
             return source_mode_action(actions, v);
         case template_tags::template_:
- return do_template_action(actions, v, first.get_position());
+ return do_template_action(actions, v, first.base());
         default:
             break;
         }
     }
 
- // Handles line-breaks (DEPRECATED!!!)
- void break_action::operator()(iterator first, iterator) const
+ void break_action::operator()(parse_iterator first, parse_iterator) const
     {
- if (actions.suppress) return;
         write_anchors(actions, phrase);
 
- file_position const pos = first.get_position();
         if(*first == '\\')
         {
- detail::outwarn(actions.filename, pos.line)
- << "in column:" << pos.column << ", "
+ detail::outwarn(actions.current_file, first.base())
+ //<< "in column:" << pos.column << ", "
                 << "'\\n' is deprecated, pleases use '[br]' instead" << ".\n";
         }
 
         if(!actions.warned_about_breaks)
         {
- detail::outwarn(actions.filename, pos.line)
+ detail::outwarn(actions.current_file, first.base())
                 << "line breaks generate invalid boostbook "
                    "(will only note first occurrence).\n";
 
@@ -214,9 +201,9 @@
         phrase << detail::get_markup(phrase_tags::break_mark).pre;
     }
 
- void error_message_action::operator()(iterator first, iterator last) const
+ void error_message_action::operator()(parse_iterator first, parse_iterator last) const
     {
- file_position const pos = first.get_position();
+ file_position const pos = actions.current_file->position_of(first.base());
 
         std::string value(first, last);
         std::string formatted_message = message;
@@ -224,34 +211,33 @@
         boost::replace_all(formatted_message, "%c",
             boost::lexical_cast<std::string>(pos.column));
 
- detail::outerr(actions.filename, pos.line)
+ detail::outerr(actions.current_file->path, pos.line)
             << detail::utf8(formatted_message) << std::endl;
         ++actions.error_count;
     }
 
- void error_action::operator()(iterator first, iterator /*last*/) const
+ void error_action::operator()(parse_iterator first, parse_iterator /*last*/) const
     {
- file_position const pos = first.get_position();
- detail::outerr(actions.filename, pos.line)
+ file_position const pos = actions.current_file->position_of(first.base());
+
+ detail::outerr(actions.current_file->path, pos.line)
             << "Syntax Error near column " << pos.column << ".\n";
         ++actions.error_count;
     }
 
     void block_action(quickbook::actions& actions, value block)
     {
- if (actions.suppress) return;
         write_anchors(actions, actions.out);
 
         detail::markup markup = detail::get_markup(block.get_tag());
 
         value_consumer values = block;
- actions.out << markup.pre << values.consume().get_boostbook() << markup.post;
+ actions.out << markup.pre << values.consume().get_encoded() << markup.post;
         values.finish();
     }
 
     void block_empty_action(quickbook::actions& actions, value block)
     {
- if (actions.suppress) return;
         write_anchors(actions, actions.out);
 
         detail::markup markup = detail::get_markup(block.get_tag());
@@ -260,36 +246,46 @@
 
     void phrase_action(quickbook::actions& actions, value phrase)
     {
- if (actions.suppress) return;
         write_anchors(actions, actions.phrase);
 
         detail::markup markup = detail::get_markup(phrase.get_tag());
 
         value_consumer values = phrase;
- actions.phrase << markup.pre << values.consume().get_boostbook() << markup.post;
+ actions.phrase << markup.pre << values.consume().get_encoded() << markup.post;
+ values.finish();
+ }
+
+ void role_action(quickbook::actions& actions, value role)
+ {
+ write_anchors(actions, actions.phrase);
+
+ value_consumer values = role;
+ actions.phrase
+ << "<phrase role=\"";
+ detail::print_string(values.consume().get_quickbook(), actions.phrase.get());
+ actions.phrase
+ << "\">"
+ << values.consume().get_encoded()
+ << "</phrase>";
         values.finish();
     }
 
     void footnote_action(quickbook::actions& actions, value phrase)
     {
- if (actions.suppress) return;
         write_anchors(actions, actions.phrase);
 
         value_consumer values = phrase;
         actions.phrase
             << "<footnote id=\""
- << actions.ids.add(fully_qualified_id(actions.doc_id,
- actions.qualified_section_id, "f"),
- id_generator::numbered)
+ << actions.ids.add_id("f", id_category::numbered)
             << "\"><para>"
- << values.consume().get_boostbook()
+ << values.consume().get_encoded()
             << "</para></footnote>";
         values.finish();
     }
 
     void raw_phrase_action(quickbook::actions& actions, value phrase)
     {
- if (actions.suppress) return;
         write_anchors(actions, actions.phrase);
 
         detail::markup markup = detail::get_markup(phrase.get_tag());
@@ -298,8 +294,6 @@
 
     void paragraph_action::operator()() const
     {
- if(actions.suppress) return;
-
         std::string str;
         actions.phrase.swap(str);
 
@@ -316,6 +310,19 @@
             actions.out << markup.post;
         }
     }
+
+ void list_item_action::operator()() const
+ {
+ std::string str;
+ actions.phrase.swap(str);
+ actions.out << str;
+ write_anchors(actions, actions.out);
+ }
+
+ void phrase_end_action::operator()() const
+ {
+ write_anchors(actions, actions.phrase);
+ }
     
     namespace {
         void write_bridgehead(quickbook::actions& actions, int level,
@@ -325,10 +332,7 @@
             {
                 actions.out << "<bridgehead renderas=\"sect" << level << "\"";
                 actions.out << " id=\"";
- actions.out << actions.ids.add(
- fully_qualified_id(actions.doc_id,
- actions.qualified_section_id, "h"),
- id_generator::numbered),
+ actions.out << actions.ids.add_id("h", id_category::numbered);
                 actions.out << "\">";
                 actions.out << "<phrase id=\"" << id << "\"/>";
                 actions.out << "<link linkend=\"" << id << "\">";
@@ -349,8 +353,6 @@
 
     void header_action(quickbook::actions& actions, value heading_list)
     {
- if(actions.suppress) return;
-
         value_consumer values = heading_list;
 
         bool generic = heading_list.get_tag() == block_tags::generic_heading;
@@ -362,10 +364,9 @@
 
         if (generic)
         {
- level = actions.section_level + 2;
- // section_level is zero-based. We need to use a
- // one-based heading which is one greater
- // than the current. Thus: section_level + 2.
+ level = actions.ids.section_level() + 1;
+ // We need to use a heading which is one greater
+ // than the current.
             if (level > 6 ) // The max is h6, clip it if it goes
                 level = 6; // further than that
         }
@@ -376,45 +377,45 @@
 
         write_anchors(actions, actions.out);
 
- if (!generic && qbk_version_n < 103) // version 1.2 and below
+ if (!element_id.empty())
         {
- std::string anchor = actions.ids.add(
- actions.section_id + '.' +
- detail::make_identifier(content.get_boostbook()),
- id_generator::generated_heading);
+ std::string anchor = actions.ids.add_id(
+ element_id.get_quickbook(),
+ id_category::explicit_id);
 
             write_bridgehead(actions, level,
- content.get_boostbook(), anchor, false);
+ content.get_encoded(), anchor, self_linked_headers);
+ }
+ else if (!generic && actions.ids.compatibility_version() < 103) // version 1.2 and below
+ {
+ // This generates the old id style if both the interpreting
+ // version and the generation version are less then 103u.
+
+ std::string anchor = actions.ids.old_style_id(
+ detail::make_identifier(content.get_encoded()),
+ id_category::generated_heading);
+
+ write_bridgehead(actions, level,
+ content.get_encoded(), anchor, false);
+
         }
         else
         {
- id_generator::categories category =
- !element_id.empty() ?
- id_generator::explicit_id :
- id_generator::generated_heading;
-
- std::string id =
- !element_id.empty() ?
- element_id.get_quickbook() :
- detail::make_identifier(
- qbk_version_n >= 106 ?
- content.get_quickbook() :
- content.get_boostbook()
- );
-
- std::string anchor = actions.ids.add(
- fully_qualified_id(actions.doc_id,
- actions.qualified_section_id, id),
- category);;
+ std::string anchor = actions.ids.add_id(
+ detail::make_identifier(
+ actions.ids.compatibility_version() >= 106 ?
+ content.get_quickbook() :
+ content.get_encoded()
+ ),
+ id_category::generated_heading);
 
             write_bridgehead(actions, level,
- content.get_boostbook(), anchor, true);
+ content.get_encoded(), anchor, self_linked_headers);
         }
     }
 
     void simple_phrase_action::operator()(char mark) const
     {
- if (actions.suppress) return;
         write_anchors(actions, out);
 
         int tag =
@@ -432,26 +433,43 @@
         values.finish();
 
         out << markup.pre;
- out << content.get_boostbook();
+ out << content.get_encoded();
         out << markup.post;
     }
 
     bool cond_phrase_push::start()
     {
- saved_suppress = actions.suppress;
-
         value_consumer values = actions.values.release();
- bool condition = find(actions.macro,
- values.consume().get_quickbook().c_str());
-
- actions.suppress = actions.suppress || !condition;
+
+ saved_conditional = actions.conditional;
+
+ if (saved_conditional)
+ {
+ string_ref macro1 = values.consume().get_quickbook();
+ std::string macro(macro1.begin(), macro1.end());
+
+ actions.conditional = find(actions.macro, macro.c_str());
+
+ if (!actions.conditional) {
+ actions.phrase.push();
+ actions.out.push();
+ actions.anchors.swap(anchors);
+ }
+ }
 
         return true;
     }
     
     void cond_phrase_push::cleanup()
     {
- actions.suppress = saved_suppress;
+ if (saved_conditional && !actions.conditional)
+ {
+ actions.phrase.pop();
+ actions.out.pop();
+ actions.anchors.swap(anchors);
+ }
+
+ actions.conditional = saved_conditional;
     }
 
     namespace {
@@ -473,83 +491,34 @@
         }
     }
 
- void list_action(quickbook::actions& actions, value list)
+ void actions::start_list(char mark)
     {
- if (actions.suppress) return;
- write_anchors(actions, actions.out);
-
- typedef std::pair<char, int> mark_type;
- std::stack<mark_type> list_marks;
- int list_indent = -1;
-
- BOOST_FOREACH(value_consumer values, list)
- {
- int new_indent = indent_length(
- values.consume(general_tags::list_indent).get_quickbook());
- value mark_value = values.consume(general_tags::list_mark);
- std::string content = values.consume().get_boostbook();
- values.finish();
-
- char mark = mark_value.get_quickbook()[0];
- assert(mark == '*' || mark == '#');
-
- if(list_indent == -1) {
- assert(new_indent == 0);
- }
-
- if(new_indent > list_indent)
- {
- list_indent = new_indent;
- list_marks.push(mark_type(mark, list_indent));
-
- actions.out << ((mark == '#') ? "<orderedlist>\n" : "<itemizedlist>\n");
- }
- else if (new_indent < list_indent)
- {
- BOOST_ASSERT(!list_marks.empty());
- list_indent = new_indent;
+ write_anchors(*this, out);
+ assert(mark == '*' || mark == '#');
+ out << ((mark == '#') ? "<orderedlist>\n" : "<itemizedlist>\n");
+ }
 
- while (!list_marks.empty() && (list_indent < list_marks.top().second))
- {
- char mark = list_marks.top().first;
- list_marks.pop();
- actions.out << "</simpara></listitem>";
- actions.out << ((mark == '#') ? "\n</orderedlist>" : "\n</itemizedlist>");
- }
- actions.out << "</simpara></listitem>";
- }
- else
- {
- actions.out << "</simpara></listitem>";
- }
+ void actions::end_list(char mark)
+ {
+ write_anchors(*this, out);
+ assert(mark == '*' || mark == '#');
+ out << ((mark == '#') ? "\n</orderedlist>" : "\n</itemizedlist>");
+ }
 
- if (mark != list_marks.top().first) // new_indent == list_indent
- {
- file_position const pos = mark_value.get_position();
- detail::outerr(actions.filename, pos.line)
- << "Illegal change of list style near column " << pos.column << ".\n";
- detail::outwarn(actions.filename, pos.line)
- << "Ignoring change of list style" << std::endl;
- ++actions.error_count;
- }
-
- actions.out << "<listitem><simpara>";
- actions.out << content;
- }
+ void actions::start_list_item()
+ {
+ out << "<listitem><simpara>";
+ write_anchors(*this, out);
+ }
 
- assert(!list_marks.empty());
- while (!list_marks.empty())
- {
- char mark = list_marks.top().first;
- list_marks.pop();
- actions.out << "</simpara></listitem>";
- actions.out << ((mark == '#') ? "\n</orderedlist>" : "\n</itemizedlist>");
- }
+ void actions::end_list_item()
+ {
+ write_anchors(*this, out);
+ out << "</simpara></listitem>";
     }
 
     void explicit_list_action(quickbook::actions& actions, value list)
     {
- if (actions.suppress) return;
         write_anchors(actions, actions.out);
 
         detail::markup markup = detail::get_markup(list.get_tag());
@@ -559,65 +528,26 @@
         BOOST_FOREACH(value item, list)
         {
             actions.out << "<listitem>";
- actions.out << item.get_boostbook();
+ actions.out << item.get_encoded();
             actions.out << "</listitem>";
         }
 
         actions.out << markup.post;
     }
 
- // TODO: No need to check suppress since this is only used in the syntax
- // highlighter. I should move this or something.
- void span::operator()(iterator first, iterator last) const
- {
- if (name) out << "<phrase role=\"" << name << "\">";
- while (first != last)
- detail::print_char(*first++, out.get());
- if (name) out << "</phrase>";
- }
-
- void span_start::operator()(iterator first, iterator last) const
- {
- out << "<phrase role=\"" << name << "\">";
- while (first != last)
- detail::print_char(*first++, out.get());
- }
-
- void span_end::operator()(iterator first, iterator last) const
- {
- while (first != last)
- detail::print_char(*first++, out.get());
- out << "</phrase>";
- }
-
- void unexpected_char::operator()(iterator first, iterator last) const
- {
- file_position const pos = first.get_position();
-
- detail::outwarn(actions.filename, pos.line)
- << "in column:" << pos.column
- << ", unexpected character: " << detail::utf8(first, last)
- << "\n";
-
- // print out an unexpected character
- out << "<phrase role=\"error\">";
- while (first != last)
- detail::print_char(*first++, out.get());
- out << "</phrase>";
- }
-
     void anchor_action(quickbook::actions& actions, value anchor)
     {
- if(actions.suppress) return;
-
         value_consumer values = anchor;
- add_anchor(actions, values.consume().get_quickbook());
+ value anchor_id = values.consume();
+ // Note: anchor_id is never encoded as boostbook. If it
+ // is encoded, it's just things like escapes.
+ add_anchor(actions, anchor_id.is_encoded() ?
+ anchor_id.get_encoded() : anchor_id.get_quickbook());
         values.finish();
     }
 
     void do_macro_action::operator()(std::string const& str) const
     {
- if (actions.suppress) return;
         write_anchors(actions, phrase);
 
         if (str == quickbook_get_date)
@@ -638,27 +568,15 @@
         }
     }
 
- void space::operator()(char ch) const
+ void raw_char_action::operator()(char ch) const
     {
- detail::print_space(ch, out.get());
+ out << ch;
     }
 
- void space::operator()(iterator first, iterator last) const
+ void raw_char_action::operator()(parse_iterator first, parse_iterator last) const
     {
         while (first != last)
- detail::print_space(*first++, out.get());
- }
-
- void pre_escape_back::operator()(iterator, iterator) const
- {
- escape_actions.phrase.push(); // save the stream
- }
-
- void post_escape_back::operator()(iterator, iterator) const
- {
- write_anchors(escape_actions, escape_actions.phrase);
- out << escape_actions.phrase.str();
- escape_actions.phrase.pop(); // restore the stream
+ out << *first++;
     }
 
     void source_mode_action(quickbook::actions& actions, value source_mode)
@@ -666,29 +584,30 @@
         actions.source_mode = source_mode_tags::name(source_mode.get_tag());
     }
 
- void code_action::operator()(iterator first, iterator last) const
+ void code_action::operator()(parse_iterator first, parse_iterator last) const
     {
- if (actions.suppress) return;
         write_anchors(actions, out);
 
         // preprocess the code section to remove the initial indentation
- std::string program(first, last);
- detail::unindent(program);
- if (program.size() == 0)
+ mapped_file_builder mapped;
+ mapped.start(actions.current_file);
+ mapped.unindent_and_add(first.base(), last.base());
+
+ file_ptr f = mapped.release();
+
+ if (f->source.empty())
             return; // Nothing left to do here. The program is empty.
 
- iterator first_(program.begin(), first.get_position());
- iterator last_(program.end());
+ parse_iterator first_(f->source.begin());
+ parse_iterator last_(f->source.end());
 
- // TODO: Shouldn't phrase be empty here? Why would it be output
- // after the code block?
- std::string save;
- phrase.swap(save);
+ file_ptr saved_file = f;
+ boost::swap(actions.current_file, saved_file);
 
         // print the code with syntax coloring
         std::string str = syntax_highlight(first_, last_, actions, actions.source_mode);
 
- phrase.swap(save);
+ boost::swap(actions.current_file, saved_file);
 
         //
         // We must not place a \n after the <programlisting> tag
@@ -699,9 +618,8 @@
         out << "</programlisting>\n";
     }
 
- void inline_code_action::operator()(iterator first, iterator last) const
+ void inline_code_action::operator()(parse_iterator first, parse_iterator last) const
     {
- if (actions.suppress) return;
         write_anchors(actions, out);
 
         std::string save;
@@ -719,23 +637,21 @@
 
     void plain_char_action::operator()(char ch) const
     {
- if (actions.suppress) return;
         write_anchors(actions, phrase);
 
         detail::print_char(ch, phrase.get());
     }
 
- void plain_char_action::operator()(iterator first, iterator /*last*/) const
+ void plain_char_action::operator()(parse_iterator first, parse_iterator last) const
     {
- if (actions.suppress) return;
         write_anchors(actions, phrase);
 
- detail::print_char(*first, phrase.get());
+ while (first != last)
+ detail::print_char(*first++, phrase.get());
     }
 
- void escape_unicode_action::operator()(iterator first, iterator last) const
+ void escape_unicode_action::operator()(parse_iterator first, parse_iterator last) const
     {
- if (actions.suppress) return;
         write_anchors(actions, phrase);
 
         while(first != last && *first == '0') ++first;
@@ -755,11 +671,30 @@
         }
     }
 
+ void write_plain_text(std::ostream& out, value const& v)
+ {
+ if (v.is_encoded())
+ {
+ detail::print_string(v.get_encoded(), out);
+ }
+ else {
+ std::string value = v.get_quickbook();
+ for(std::string::const_iterator
+ first = value.begin(), last = value.end();
+ first != last; ++first)
+ {
+ if (*first == '\\' && ++first == last) break;
+ detail::print_char(*first, out);
+ }
+ }
+ }
+
     void image_action(quickbook::actions& actions, value image)
     {
- if (actions.suppress) return;
         write_anchors(actions, actions.phrase);
 
+ // Note: attributes are never encoded as boostbook, if they're
+ // encoded, it's just things like escapes.
         typedef std::map<std::string, value> attribute_map;
         attribute_map attributes;
 
@@ -774,7 +709,7 @@
             pair.finish();
             if(!attributes.insert(std::make_pair(name.get_quickbook(), value)).second)
             {
- detail::outwarn(actions.filename, name.get_position().line)
+ detail::outwarn(name.get_file(), name.get_position())
                     << "Duplicate image attribute: "
                     << detail::utf8(name.get_quickbook())
                     << std::endl;
@@ -788,18 +723,23 @@
         // Not using Boost.Filesystem because I want to stay in UTF-8.
         // Need to think about uri encoding.
         
- std::string fileref = attributes["fileref"].get_quickbook();
+ std::string fileref = attributes["fileref"].is_encoded() ?
+ attributes["fileref"].get_encoded() :
+ attributes["fileref"].get_quickbook();
 
         // Check for windows paths, then convert.
         // A bit crude, but there you go.
 
         if(fileref.find('\\') != std::string::npos)
         {
- detail::outwarn(actions.filename, attributes["fileref"].get_position().line)
+ (qbk_version_n >= 106u ?
+ detail::outerr(attributes["fileref"].get_file(), attributes["fileref"].get_position()) :
+ detail::outwarn(attributes["fileref"].get_file(), attributes["fileref"].get_position()))
                 << "Image path isn't portable: '"
                 << detail::utf8(fileref)
                 << "'"
                 << std::endl;
+ if (qbk_version_n >= 106u) ++actions.error_count;
         }
 
         boost::replace(fileref, '\\', '/');
@@ -810,7 +750,7 @@
         // Need to think about uri encoding.
 
         std::string::size_type pos;
- std::string stem,extension;
+ std::string stem, extension;
 
         pos = fileref.rfind('/');
         stem = pos == std::string::npos ?
@@ -826,15 +766,11 @@
 
         // Extract the alt tag, to use as a text description.
         // Or if there isn't one, use the stem of the file name.
- // TODO: IMO if there isn't an alt tag, then the description should
- // be empty or missing.
 
- attribute_map::iterator alt_pos = attributes.find("alt");
- std::string alt_text = alt_pos != attributes.end() ?
- alt_pos->second.get_quickbook() : stem;
+ quickbook::value alt_text = attributes["alt"];
         attributes.erase("alt");
 
- if(extension == ".svg")
+ if(extension == "svg")
         {
            //
            // SVG's need special handling:
@@ -848,16 +784,15 @@
            // fit in a tiny box (IE7).
            //
 
- attributes.insert(attribute_map::value_type("format", qbk_value("SVG")));
+ attributes.insert(attribute_map::value_type("format",
+ encoded_value("SVG")));
 
            //
            // Image paths are relative to the html subdirectory:
            //
- // TODO: This seems wrong to me.
- //
            fs::path img = detail::generic_to_path(fileref);
- if(img.root_path().empty())
- img = "html" / img; // relative path
+ if (!img.has_root_directory())
+ img = quickbook::image_location / img; // relative path
 
            //
            // Now load the SVG file:
@@ -885,7 +820,7 @@
            if(a != std::string::npos)
            {
               attributes.insert(std::make_pair(
- "contentwidth", qbk_value(std::string(
+ "contentwidth", encoded_value(std::string(
                     svg_text.begin() + a + 1, svg_text.begin() + b))
                 ));
            }
@@ -896,7 +831,7 @@
            if(a != std::string::npos)
            {
               attributes.insert(std::make_pair(
- "contentdepth", qbk_value(std::string(
+ "contentdepth", encoded_value(std::string(
                     svg_text.begin() + a + 1, svg_text.begin() + b))
                 ));
            }
@@ -909,16 +844,7 @@
         BOOST_FOREACH(attribute_map::value_type const& attr, attributes)
         {
             actions.phrase << " " << attr.first << "=\"";
-
- std::string value = attr.second.get_quickbook();
- for(std::string::const_iterator
- first = value.begin(), last = value.end();
- first != last; ++first)
- {
- if (*first == '\\' && ++first == last) break;
- detail::print_char(*first, actions.phrase.get());
- }
-
+ write_plain_text(actions.phrase.get(), attr.second);
             actions.phrase << "\"";
         }
 
@@ -926,23 +852,36 @@
 
         // Add a textobject containing the alt tag from earlier.
         // This will be used for the alt tag in html.
- actions.phrase << "<textobject><phrase>";
- detail::print_string(alt_text, actions.phrase.get());
- actions.phrase << "</phrase></textobject>";
+ if (alt_text.check()) {
+ actions.phrase << "<textobject><phrase>";
+ write_plain_text(actions.phrase.get(), alt_text);
+ actions.phrase << "</phrase></textobject>";
+ }
 
         actions.phrase << "</inlinemediaobject>";
     }
 
     void macro_definition_action(quickbook::actions& actions, quickbook::value macro_definition)
     {
- if(actions.suppress) return;
-
         value_consumer values = macro_definition;
         std::string macro_id = values.consume().get_quickbook();
- std::string phrase = values.consume().get_boostbook();
+ std::string phrase = values.consume().get_encoded();
         values.finish();
 
- actions.copy_macros_for_write();
+ std::string* existing_macro =
+ boost::spirit::classic::find(actions.macro, macro_id.c_str());
+ quickbook::ignore_variable(&existing_macro);
+
+ if (existing_macro)
+ {
+ if (qbk_version_n < 106) return;
+
+ // Do this if you're using spirit's TST.
+ //
+ // *existing_macro = phrase;
+ // return;
+ }
+
         actions.macro.add(
             macro_id.begin()
           , macro_id.end()
@@ -951,8 +890,6 @@
 
     void template_body_action(quickbook::actions& actions, quickbook::value template_definition)
     {
- if(actions.suppress) return;
-
         value_consumer values = template_definition;
         std::string identifier = values.consume().get_quickbook();
 
@@ -970,11 +907,9 @@
                 identifier,
                 template_values,
                 body,
- actions.filename,
                 &actions.templates.top_scope())))
         {
- file_position const pos = body.get_position();
- detail::outerr(actions.filename, pos.line)
+ detail::outwarn(body.get_file(), body.get_position())
                 << "Template Redefinition: " << detail::utf8(identifier) << std::endl;
             ++actions.error_count;
         }
@@ -982,7 +917,7 @@
 
     namespace
     {
- iterator find_first_seperator(iterator begin, iterator end)
+ string_iterator find_first_seperator(string_iterator begin, string_iterator end)
         {
             if(qbk_version_n < 105) {
                 for(;begin != end; ++begin)
@@ -1029,9 +964,9 @@
             return begin;
         }
         
- std::pair<iterator, iterator> find_seperator(iterator begin, iterator end)
+ std::pair<string_iterator, string_iterator> find_seperator(string_iterator begin, string_iterator end)
         {
- iterator first = begin = find_first_seperator(begin, end);
+ string_iterator first = begin = find_first_seperator(begin, end);
 
             for(;begin != end; ++begin)
             {
@@ -1050,11 +985,10 @@
             return std::make_pair(first, begin);
         }
     
- bool break_arguments(
- std::vector<template_body>& args
+ void break_arguments(
+ std::vector<value>& args
           , std::vector<std::string> const& params
           , fs::path const& filename
- , file_position const& pos
         )
         {
             // Quickbook 1.4-: If there aren't enough parameters seperated by
@@ -1074,58 +1008,44 @@
                     // recursively until we have all the expected number of
                     // arguments, or if there are no more spaces left.
 
- template_body& body = args.back();
- iterator begin = body.content.get_quickbook_range().begin();
- iterator end = body.content.get_quickbook_range().end();
+ value last_arg = args.back();
+ string_iterator begin = last_arg.get_quickbook().begin();
+ string_iterator end = last_arg.get_quickbook().end();
                     
- std::pair<iterator, iterator> pos =
+ std::pair<string_iterator, string_iterator> pos =
                         find_seperator(begin, end);
                     if (pos.second == end) break;
- template_body second(
- qbk_value(pos.second, end, template_tags::phrase),
- body.filename);
-
- body.content = qbk_value(begin, pos.first,
- body.content.get_tag());
- args.push_back(second);
+ value new_arg(
+ qbk_value(last_arg.get_file(),
+ pos.second, end, template_tags::phrase));
+
+ args.back() = qbk_value(last_arg.get_file(),
+ begin, pos.first, last_arg.get_tag());
+ args.push_back(new_arg);
                 }
             }
-
- if (args.size() != params.size())
- {
- detail::outerr(filename, pos.line)
- << "Invalid number of arguments passed. Expecting: "
- << params.size()
- << " argument(s), got: "
- << args.size()
- << " argument(s) instead."
- << std::endl;
- return false;
- }
- return true;
         }
 
         std::pair<bool, std::vector<std::string>::const_iterator>
         get_arguments(
- std::vector<template_body>& args
+ std::vector<value> const& args
           , std::vector<std::string> const& params
           , template_scope const& scope
- , file_position const& pos
+ , string_iterator first
           , quickbook::actions& actions
         )
         {
- std::vector<template_body>::const_iterator arg = args.begin();
+ std::vector<value>::const_iterator arg = args.begin();
             std::vector<std::string>::const_iterator tpl = params.begin();
             std::vector<std::string> empty_params;
 
-
             // Store each of the argument passed in as local templates:
             while (arg != args.end())
             {
                 if (!actions.templates.add(
                         template_symbol(*tpl, empty_params, *arg, &scope)))
                 {
- detail::outerr(actions.filename, pos.line)
+ detail::outerr(actions.current_file, first)
                         << "Duplicate Symbol Found" << std::endl;
                     ++actions.error_count;
                     return std::make_pair(false, tpl);
@@ -1136,84 +1056,50 @@
         }
         
         bool parse_template(
- template_body const& body
- , bool escape
+ value const& content
           , quickbook::actions& actions
         )
         {
- // How do we know if we are to parse the template as a block or
- // a phrase? We apply a simple heuristic: if the body starts with
- // a newline, then we regard it as a block, otherwise, we parse
- // it as a phrase.
- //
- // Note: this is now done in the grammar.
+ file_ptr saved_current_file = actions.current_file;
 
- // TODO: For escape, should this be surrounded in escape comments?
- if (body.type == template_body::raw_output || escape)
- {
- // escape the body of the template
- // we just copy out the literal body
- (body.is_block() ? actions.out : actions.phrase) << body.content.get_quickbook();
- return true;
- }
- else
- {
- if (!body.is_block())
- {
- // do a phrase level parse
- actions.filename = body.filename;
- iterator first = body.content.get_quickbook_range().begin();
- iterator last = body.content.get_quickbook_range().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.
-
- actions.filename = body.filename;
- std::string content = body.content.get_quickbook() + "\n\n";
- iterator first(content.begin(), body.content.get_position());
- iterator last(content.end());
+ actions.current_file = content.get_file();
+ string_ref source = content.get_quickbook();
 
- return cl::parse(first, last, actions.grammar().block).full;
- }
- }
- }
- }
+ parse_iterator first(source.begin());
+ parse_iterator last(source.end());
 
- void do_template_action(quickbook::actions& actions, value template_list,
- file_position pos)
- {
- if(actions.suppress) return;
-
- // Get the arguments
- value_consumer values = template_list;
+ bool r = cl::parse(first, last,
+ content.get_tag() == template_tags::block ?
+ actions.grammar().block :
+ actions.grammar().inline_phrase
+ ).full;
 
- bool template_escape = values.check(template_tags::escape);
- if(template_escape) values.consume();
+ boost::swap(actions.current_file, saved_current_file);
 
- std::string identifier = values.consume(template_tags::identifier).get_quickbook();
+ return r;
+ }
+ }
 
- std::vector<std::string> callout_ids;
- std::vector<template_body> args;
+ void call_template(quickbook::actions& actions,
+ template_symbol const* symbol,
+ std::vector<value> const& args,
+ string_iterator first)
+ {
+ // If this template contains already encoded text, then just
+ // write it out, without going through any of the rigamarole.
 
- BOOST_FOREACH(value arg, values)
+ if (symbol->content.is_encoded())
         {
- args.push_back(template_body(arg, actions.filename));
- }
-
- values.finish();
+ if (symbol->content.get_tag() == template_tags::block)
+ {
+ actions.paragraph();
+ actions.out << symbol->content.get_encoded();
+ }
+ else
+ {
+ actions.phrase << symbol->content.get_encoded();
+ }
 
- ++actions.template_depth;
- if (actions.template_depth > actions.max_template_depth)
- {
- detail::outerr(actions.filename, pos.line)
- << "Infinite loop detected" << std::endl;
- --actions.template_depth;
- ++actions.error_count;
             return;
         }
 
@@ -1224,155 +1110,151 @@
         // arguments are expanded.
         template_scope const& call_scope = actions.templates.top_scope();
 
- template_symbol const* symbol = actions.templates.find(identifier);
- BOOST_ASSERT(symbol);
-
         std::string block;
         std::string phrase;
 
- actions.push(); // scope the actions' states
         {
- // Store the current section level so that we can ensure that
- // [section] and [endsect] tags in the template are balanced.
- actions.min_section_level = actions.section_level;
+ template_state state(actions);
+ actions.templates.start_template(symbol);
 
- // Quickbook 1.4-: When expanding the tempalte continue to use the
- // current scope (the dynamic scope).
- // Quickbook 1.5+: Use the scope the template was defined in
- // (the static scope).
- if (qbk_version_n >= 105)
- actions.templates.set_parent_scope(*symbol->parent);
+ qbk_version_n = symbol->content.get_file()->version();
 
- ///////////////////////////////////
- // Initialise the arguments
-
- if (!symbol->callouts.check())
+ ++actions.template_depth;
+ if (actions.template_depth > actions.max_template_depth)
             {
- // Break the arguments for a template
-
- if (!break_arguments(args, symbol->params, actions.filename, pos))
- {
- actions.pop(); // restore the actions' states
- --actions.template_depth;
- ++actions.error_count;
- return;
- }
+ detail::outerr(actions.current_file, first)
+ << "Infinite loop detected" << std::endl;
+ ++actions.error_count;
+ return;
             }
- else
- {
- if (!args.empty())
- {
- detail::outerr(actions.filename, pos.line)
- << "Arguments for code snippet."
- <<std::endl;
- ++actions.error_count;
-
- args.clear();
- }
-
- unsigned int size = symbol->params.size();
- std::string callout_base_id =
- fully_qualified_id(actions.doc_id,
- actions.qualified_section_id, "c");
 
- for(unsigned int i = 0; i < size; ++i)
- {
- std::string callout_id1 = actions.ids.add(
- callout_base_id, id_generator::numbered);
- std::string callout_id2 = actions.ids.add(
- callout_base_id, id_generator::numbered);
-
- std::string code;
- code += "<co id=\"" + callout_id1 + "\" ";
- code += "linkends=\"" + callout_id2 + "\" />";
-
- // TODO: This isn't a qbk_value...
- args.push_back(template_body(
- qbk_value(code, pos, template_tags::phrase),
- actions.filename, template_body::raw_output));
- callout_ids.push_back(callout_id1);
- callout_ids.push_back(callout_id2);
- }
- }
+ // Store the current section level so that we can ensure that
+ // [section] and [endsect] tags in the template are balanced.
+ actions.min_section_level = actions.ids.section_level();
 
             ///////////////////////////////////
             // Prepare the arguments as local templates
             bool get_arg_result;
             std::vector<std::string>::const_iterator tpl;
             boost::tie(get_arg_result, tpl) =
- get_arguments(args, symbol->params,
- call_scope, pos, actions);
+ get_arguments(args, symbol->params, call_scope, first, actions);
 
             if (!get_arg_result)
             {
- actions.pop(); // restore the actions' states
- --actions.template_depth;
                 return;
             }
 
             ///////////////////////////////////
             // parse the template body:
 
- if (!parse_template(symbol->body, template_escape, actions))
+ if (!parse_template(symbol->content, actions))
             {
- detail::outerr(actions.filename, pos.line)
+ detail::outerr(actions.current_file, first)
                     << "Expanding "
- << (symbol->body.is_block() ? "block" : "phrase")
+ << (symbol->content.get_tag() == template_tags::block ? "block" : "phrase")
                     << " template: " << detail::utf8(symbol->identifier) << std::endl
                     << std::endl
                     << "------------------begin------------------" << std::endl
- << detail::utf8(symbol->body.content.get_quickbook())
+ << detail::utf8(symbol->content.get_quickbook())
                     << "------------------end--------------------" << std::endl
                     << std::endl;
- actions.pop(); // restore the actions' states
- --actions.template_depth;
                 ++actions.error_count;
                 return;
             }
 
- if (actions.section_level != actions.min_section_level)
+ if (actions.ids.section_level() != actions.min_section_level)
             {
- detail::outerr(actions.filename, pos.line)
- << "Mismatched sections in template " << detail::utf8(identifier) << std::endl;
- actions.pop(); // restore the actions' states
- --actions.template_depth;
+ detail::outerr(actions.current_file, first)
+ << "Mismatched sections in template "
+ << detail::utf8(symbol->identifier)
+ << std::endl;
                 ++actions.error_count;
                 return;
             }
+
+ actions.out.swap(block);
+ actions.phrase.swap(phrase);
         }
 
- actions.out.swap(block);
- actions.phrase.swap(phrase);
- actions.pop(); // restore the actions' states
+ if(symbol->content.get_tag() == template_tags::block || !block.empty()) {
+ actions.paragraph(); // For paragraphs before the template call.
+ actions.out << block;
+ actions.phrase << phrase;
+ actions.paragraph();
+ }
+ else {
+ actions.phrase << phrase;
+ }
+ }
+
+ void call_code_snippet(quickbook::actions& actions,
+ template_symbol const* symbol,
+ string_iterator first)
+ {
+ value_consumer values = symbol->content;
+ value content = values.consume(template_tags::block);
+ value callouts = values.consume();
+ values.finish();
 
- if(!symbol->callouts.empty())
+ std::vector<std::string> callout_ids;
+ std::vector<value> args;
+ unsigned int size = symbol->params.size();
+ std::string callout_base("c");
+
+ for(unsigned int i = 0; i < size; ++i)
+ {
+ std::string callout_id1 = actions.ids.add_id(callout_base, id_category::numbered);
+ std::string callout_id2 = actions.ids.add_id(callout_base, id_category::numbered);
+
+ std::string code;
+ code += "<co id=\"" + callout_id1 + "\" ";
+ code += "linkends=\"" + callout_id2 + "\" />";
+
+ args.push_back(encoded_value(code, template_tags::phrase));
+ callout_ids.push_back(callout_id1);
+ callout_ids.push_back(callout_id2);
+ }
+
+ // Create a fake symbol for call_template
+ template_symbol t(
+ symbol->identifier,
+ symbol->params,
+ content,
+ symbol->lexical_parent);
+ call_template(actions, &t, args, first);
+
+ std::string block;
+
+ if(!callouts.empty())
         {
- BOOST_ASSERT(phrase.empty());
             block += "<calloutlist>";
             int i = 0;
- BOOST_FOREACH(value c, symbol->callouts)
+ BOOST_FOREACH(value c, callouts)
             {
                 std::string callout_id1 = callout_ids[i++];
                 std::string callout_id2 = callout_ids[i++];
-
+
                 std::string callout_value;
- actions.push();
- bool r = parse_template(
- template_body(c, symbol->body.filename), false, actions);
- actions.out.swap(callout_value);
- actions.pop();
-
- if(!r)
                 {
- detail::outerr(symbol->body.filename, c.get_position().line)
- << "Expanding callout." << std::endl
- << "------------------begin------------------" << std::endl
- << detail::utf8(c.get_quickbook())
- << std::endl
- << "------------------end--------------------" << std::endl
- ;
- ++actions.error_count;
- return;
+ template_state state(actions);
+ ++actions.template_depth;
+
+ bool r = parse_template(c, actions);
+
+ if(!r)
+ {
+ detail::outerr(c.get_file(), c.get_position())
+ << "Expanding callout." << std::endl
+ << "------------------begin------------------" << std::endl
+ << detail::utf8(c.get_quickbook())
+ << std::endl
+ << "------------------end--------------------" << std::endl
+ ;
+ ++actions.error_count;
+ return;
+ }
+
+ actions.out.swap(callout_value);
                 }
                 
                 block += "<callout arearefs=\"" + callout_id1 + "\" ";
@@ -1383,45 +1265,151 @@
             block += "</calloutlist>";
         }
 
- if(symbol->body.is_block() || !block.empty()) {
- actions.paragraph(); // For paragraphs before the template call.
- actions.out << block;
- actions.phrase << phrase;
- actions.paragraph();
+ actions.out << block;
+ }
+
+ void do_template_action(quickbook::actions& actions, value template_list,
+ string_iterator first)
+ {
+ // Get the arguments
+ value_consumer values = template_list;
+
+ bool template_escape = values.check(template_tags::escape);
+ if(template_escape) values.consume();
+
+ std::string identifier = values.consume(template_tags::identifier).get_quickbook();
+
+ std::vector<value> args;
+
+ BOOST_FOREACH(value arg, values)
+ {
+ args.push_back(arg);
         }
- else {
- actions.phrase << phrase;
+
+ values.finish();
+
+ template_symbol const* symbol = actions.templates.find(identifier);
+ BOOST_ASSERT(symbol);
+
+ // Deal with escaped templates.
+
+ if (template_escape)
+ {
+ if (!args.empty())
+ {
+ detail::outerr(actions.current_file, first)
+ << "Arguments for escaped template."
+ <<std::endl;
+ ++actions.error_count;
+ }
+
+ if (symbol->content.is_encoded())
+ {
+ actions.phrase << symbol->content.get_encoded();
+ }
+ else
+ {
+ actions.phrase << symbol->content.get_quickbook();
+
+ /*
+
+ This would surround the escaped template in escape
+ comments to indicate to the post-processor that it
+ isn't quickbook generated markup. But I'm not sure if
+ it would work.
+
+ quickbook::detail::markup escape_markup
+ = detail::get_markup(phrase_tags::escape);
+
+ actions.phrase
+ << escape_markup.pre
+ << symbol->content.get_quickbook()
+ << escape_markup.post
+ ;
+ */
+ }
+
+ return;
+ }
+
+ ///////////////////////////////////
+ // Initialise the arguments
+
+ switch(symbol->content.get_tag())
+ {
+ case template_tags::block:
+ case template_tags::phrase:
+ // Break the arguments for a template
+
+ break_arguments(args, symbol->params, actions.current_file->path);
+
+ if (args.size() != symbol->params.size())
+ {
+ detail::outerr(actions.current_file, first)
+ << "Invalid number of arguments passed. Expecting: "
+ << symbol->params.size()
+ << " argument(s), got: "
+ << args.size()
+ << " argument(s) instead."
+ << std::endl;
+
+ ++actions.error_count;
+ return;
+ }
+
+ call_template(actions, symbol, args, first);
+ break;
+
+ case template_tags::snippet:
+
+ if (!args.empty())
+ {
+ detail::outerr(actions.current_file, first)
+ << "Arguments for code snippet."
+ <<std::endl;
+ ++actions.error_count;
+
+ args.clear();
+ }
+
+ call_code_snippet(actions, symbol, first);
+ break;
+
+ default:
+ assert(0);
         }
- --actions.template_depth;
     }
 
     void link_action(quickbook::actions& actions, value link)
     {
- if (actions.suppress) return;
         write_anchors(actions, actions.phrase);
 
         detail::markup markup = detail::get_markup(link.get_tag());
 
         value_consumer values = link;
- value dst = values.consume();
+ value dst_value = values.consume();
         value content = values.consume();
         values.finish();
+
+ // Note: dst is never actually encoded as boostbook, which
+ // is why the result is called with 'print_string' later.
+ std::string dst = dst_value.is_encoded() ?
+ dst_value.get_encoded() : dst_value.get_quickbook();
         
         actions.phrase << markup.pre;
- detail::print_string(dst.get_quickbook(), actions.phrase.get());
+ detail::print_string(dst, actions.phrase.get());
         actions.phrase << "\">";
 
         if (content.empty())
- detail::print_string(dst.get_quickbook(), actions.phrase.get());
+ detail::print_string(dst, actions.phrase.get());
         else
- actions.phrase << content.get_boostbook();
+ actions.phrase << content.get_encoded();
 
         actions.phrase << markup.post;
     }
 
     void variable_list_action(quickbook::actions& actions, value variable_list)
     {
- if(actions.suppress) return;
         write_anchors(actions, actions.out);
 
         value_consumer values = variable_list;
@@ -1438,13 +1426,13 @@
             
             if(entry.check()) {
                 actions.out << "<term>";
- actions.out << entry.consume().get_boostbook();
+ actions.out << entry.consume().get_encoded();
                 actions.out << "</term>";
             }
             
             if(entry.check()) {
                 actions.out << "<listitem>";
- BOOST_FOREACH(value phrase, entry) actions.out << phrase.get_boostbook();
+ BOOST_FOREACH(value phrase, entry) actions.out << phrase.get_encoded();
                 actions.out << "</listitem>";
             }
 
@@ -1458,7 +1446,6 @@
 
     void table_action(quickbook::actions& actions, value table)
     {
- if(actions.suppress) return;
         write_anchors(actions, actions.out);
 
         value_consumer values = table;
@@ -1467,31 +1454,21 @@
         if(values.check(general_tags::element_id))
             element_id = values.consume().get_quickbook();
 
- std::string title = values.consume(table_tags::title).get_quickbook();
+ value title = values.consume(table_tags::title);
         bool has_title = !title.empty();
         
         std::string table_id;
- if(qbk_version_n >= 105) {
- if(!element_id.empty()) {
- table_id = actions.ids.add(
- fully_qualified_id(actions.doc_id,
- actions.qualified_section_id, element_id),
- id_generator::explicit_id);
- }
- else if(has_title) {
- table_id = actions.ids.add(
- fully_qualified_id(actions.doc_id,
- actions.qualified_section_id,
- detail::make_identifier(title)),
- id_generator::generated);
- }
- }
- else if (has_title)
- {
- table_id = actions.ids.add(
- fully_qualified_id(actions.doc_id,
- actions.qualified_section_id, "t"),
- id_generator::numbered);
+
+ if (!element_id.empty()) {
+ table_id = actions.ids.add_id(element_id, id_category::explicit_id);
+ }
+ else if (has_title) {
+ if (actions.ids.compatibility_version() >= 105) {
+ table_id = actions.ids.add_id(detail::make_identifier(title.get_quickbook()), id_category::generated);
+ }
+ else {
+ table_id = actions.ids.add_id("t", id_category::numbered);
+ }
         }
 
         // Emulating the old behaviour which used the width of the final
@@ -1513,7 +1490,12 @@
                 actions.out << " id=\"" << table_id << "\"";
             actions.out << ">\n";
             actions.out << "<title>";
- detail::print_string(title, actions.out.get());
+ if (qbk_version_n < 106u) {
+ detail::print_string(title.get_quickbook(), actions.out.get());
+ }
+ else {
+ actions.out << title.get_encoded();
+ }
             actions.out << "</title>";
         }
         else
@@ -1530,7 +1512,7 @@
         {
             actions.out << "<thead>" << "<row>";
             BOOST_FOREACH(value cell, values.consume()) {
- actions.out << "<entry>" << cell.get_boostbook() << "</entry>";
+ actions.out << "<entry>" << cell.get_encoded() << "</entry>";
             }
             actions.out << "</row>\n" << "</thead>\n";
         }
@@ -1540,7 +1522,7 @@
         BOOST_FOREACH(value row, values) {
             actions.out << "<row>";
             BOOST_FOREACH(value cell, row) {
- actions.out << "<entry>" << cell.get_boostbook() << "</entry>";
+ actions.out << "<entry>" << cell.get_encoded() << "</entry>";
             }
             actions.out << "</row>\n";
         }
@@ -1562,88 +1544,62 @@
 
     void begin_section_action(quickbook::actions& actions, value begin_section_list)
     {
- if(actions.suppress) return;
-
         value_consumer values = begin_section_list;
 
         value element_id = values.optional_consume(general_tags::element_id);
         value content = values.consume();
         values.finish();
 
- actions.section_id = !element_id.empty() ?
- element_id.get_quickbook() :
- detail::make_identifier(content.get_quickbook());
-
- if (actions.section_level != 0)
- actions.qualified_section_id += '.';
- else
- BOOST_ASSERT(actions.qualified_section_id.empty());
-
- actions.qualified_section_id += actions.section_id;
- ++actions.section_level;
-
- // TODO: This could be awkward if there's a clash, possibly
- // needs another category, between explicit and generated.
- std::string full_id = actions.ids.add(
- qbk_version_n < 103 ?
- actions.doc_id + "." + actions.section_id :
- actions.doc_id + "." + actions.qualified_section_id,
+ std::string full_id = actions.ids.begin_section(
             !element_id.empty() ?
- id_generator::explicit_id :
- id_generator::generated_section);
+ element_id.get_quickbook() :
+ detail::make_identifier(content.get_quickbook()),
+ !element_id.empty() ?
+ id_category::explicit_section_id :
+ id_category::generated_section);
 
         actions.out << "\n<section id=\"" << full_id << "\">\n";
         actions.out << "<title>";
+
         write_anchors(actions, actions.out);
 
- if (qbk_version_n < 103) // version 1.2 and below
- {
- actions.out << content.get_boostbook();
- }
- else // version 1.3 and above
+ if (self_linked_headers && actions.ids.compatibility_version() >= 103)
         {
             actions.out << "<link linkend=\"" << full_id << "\">"
- << content.get_boostbook()
+ << content.get_encoded()
                 << "</link>"
                 ;
         }
+ else
+ {
+ actions.out << content.get_encoded();
+ }
         
         actions.out << "</title>\n";
     }
 
- void end_section_action(quickbook::actions& actions, value end_section, file_position pos)
+ void end_section_action(quickbook::actions& actions, value end_section, string_iterator first)
     {
- if (actions.suppress) return;
         write_anchors(actions, actions.out);
 
- if (actions.section_level <= actions.min_section_level)
+ if (actions.ids.section_level() <= actions.min_section_level)
         {
- detail::outerr(actions.filename, pos.line)
+ file_position const pos = actions.current_file->position_of(first);
+
+ detail::outerr(actions.current_file->path, pos.line)
                 << "Mismatched [endsect] near column " << pos.column << ".\n";
             ++actions.error_count;
             
             return;
         }
 
- --actions.section_level;
         actions.out << "</section>";
-
- if (actions.section_level == 0)
- {
- actions.qualified_section_id.clear();
- }
- else
- {
- std::string::size_type const n =
- actions.qualified_section_id.find_last_of('.');
- actions.qualified_section_id.erase(n, std::string::npos);
- }
+ actions.ids.end_section();
     }
     
- void element_id_warning_action::operator()(iterator first, iterator) const
+ void element_id_warning_action::operator()(parse_iterator first, parse_iterator) const
     {
- file_position const pos = first.get_position();
- detail::outwarn(actions.filename, pos.line) << "Empty id.\n";
+ detail::outwarn(actions.current_file, first.base()) << "Empty id.\n";
     }
 
     // Not a general purpose normalization function, just
@@ -1721,54 +1677,55 @@
         return result;
     }
 
- std::string check_path(value const& path, quickbook::actions& actions)
+ fs::path check_path(value const& path, quickbook::actions& actions)
     {
- std::string path_text = path.get_quickbook();
+ std::string path_text = path.is_encoded() ? path.get_encoded() :
+ path.get_quickbook();
 
         if(path_text.find('\\') != std::string::npos)
         {
- detail::outwarn(actions.filename, path.get_position().line)
- << "Path isn't portable: "
+ (qbk_version_n >= 106u ?
+ detail::outerr(path.get_file(), path.get_position()) :
+ detail::outwarn(path.get_file(), path.get_position()))
+ << "Path isn't portable: '"
                 << detail::utf8(path_text)
+ << "'"
                 << std::endl;
+ if (qbk_version_n >= 106u) ++actions.error_count;
         }
         
         boost::replace(path_text, '\\', '/');
         
- return path_text;
+ return detail::generic_to_path(path_text);
     }
 
- fs::path calculate_relative_path(std::string const& name, quickbook::actions& actions)
+ xinclude_path calculate_xinclude_path(value const& p, quickbook::actions& actions)
     {
- // Given a source file and the current filename, calculate the
- // path to the source file relative to the output directory.
+ fs::path path = check_path(p, actions);
 
- fs::path path = detail::generic_to_path(name);
- if (path.has_root_directory())
- {
- return path;
- }
- else
+ // If the path is relative
+ if (!path.has_root_directory())
         {
- return path_difference(
- actions.xinclude_base,
- actions.filename.parent_path() / path);
-
+ // Resolve the path from the current file
+ path = actions.current_file->path.parent_path() / path;
+
+ // Then calculate relative to the current xinclude_base.
+ path = path_difference(actions.xinclude_base, path);
         }
+
+ return xinclude_path(path, detail::escape_uri(detail::path_to_generic(path)));
     }
 
     void xinclude_action(quickbook::actions& actions, value xinclude)
     {
- if (actions.suppress) return;
         write_anchors(actions, actions.out);
 
         value_consumer values = xinclude;
- fs::path path = calculate_relative_path(
- check_path(values.consume(), actions), actions);
+ xinclude_path x = calculate_xinclude_path(values.consume(), actions);
         values.finish();
 
         actions.out << "\n<xi:include href=\"";
- detail::print_string(detail::escape_uri(path.generic_string()), actions.out.get());
+ detail::print_string(x.uri, actions.out.get());
         actions.out << "\" />\n";
     }
 
@@ -1783,11 +1740,10 @@
             fs::path filename_relative;
         };
 
- include_search_return include_search(std::string const & name,
+ include_search_return include_search(fs::path const& path,
                 quickbook::actions const& actions)
         {
- fs::path current = actions.filename.parent_path();
- fs::path path = detail::generic_to_path(name);
+ fs::path current = actions.current_file->path.parent_path();
 
             // If the path is relative, try and resolve it.
             if (!path.has_root_directory() && !path.has_root_name())
@@ -1815,131 +1771,166 @@
                 actions.filename_relative.parent_path() / path);
         }
     }
+
+ void load_quickbook(quickbook::actions& actions,
+ include_search_return const& paths,
+ value::tag_type load_type,
+ value const& include_doc_id = value())
+ {
+ assert(load_type == block_tags::include ||
+ load_type == block_tags::import);
+
+ // Check this before qbk_version_n gets changed by the inner file.
+ bool keep_inner_source_mode = (qbk_version_n < 106);
+
+ {
+ // When importing, state doesn't scope templates and macros so that
+ // they're added to the existing scope. It might be better to add
+ // them to a new scope then explicitly import them into the
+ // existing scope.
+ //
+ // For old versions of quickbook, templates aren't scoped by the
+ // file.
+ file_state state(actions,
+ load_type == block_tags::import ? file_state::scope_output :
+ qbk_version_n >= 106u ? file_state::scope_callables :
+ file_state::scope_macros);
 
- void import_action(quickbook::actions& actions, value import)
- {
- if (actions.suppress) return;
- write_anchors(actions, actions.out);
+ actions.current_file = load(paths.filename); // Throws load_error
+ actions.filename_relative = paths.filename_relative;
+ actions.imported = (load_type == block_tags::import);
 
- value_consumer values = import;
- include_search_return paths = include_search(
- check_path(values.consume(), actions), actions);
- values.finish();
+ // update the __FILENAME__ macro
+ *boost::spirit::classic::find(actions.macro, "__FILENAME__")
+ = detail::path_to_generic(actions.filename_relative);
+
+ // parse the file
+ quickbook::parse_file(actions, include_doc_id, true);
+
+ // Don't restore source_mode on older versions.
+ if (keep_inner_source_mode) state.source_mode = actions.source_mode;
+ }
+
+ // restore the __FILENAME__ macro
+ *boost::spirit::classic::find(actions.macro, "__FILENAME__")
+ = detail::path_to_generic(actions.filename_relative);
+ }
+
+ void load_source_file(quickbook::actions& actions,
+ include_search_return const& paths,
+ value::tag_type load_type,
+ string_iterator first,
+ value const& include_doc_id = value())
+ {
+ assert(load_type == block_tags::include ||
+ load_type == block_tags::import);
 
         std::string ext = paths.filename.extension().generic_string();
         std::vector<template_symbol> storage;
+ // Throws load_error
         actions.error_count +=
- load_snippets(paths.filename, storage, ext, actions.doc_id);
+ load_snippets(paths.filename, storage, ext, load_type);
+
+ if (load_type == block_tags::include)
+ {
+ actions.templates.push();
+ }
 
         BOOST_FOREACH(template_symbol& ts, storage)
         {
             std::string tname = ts.identifier;
- ts.parent = &actions.templates.top_scope();
- if (!actions.templates.add(ts))
+ if (tname != "!")
             {
- detail::outerr(ts.body.filename, ts.body.content.get_position().line)
- << "Template Redefinition: " << detail::utf8(tname) << std::endl;
- ++actions.error_count;
+ ts.lexical_parent = &actions.templates.top_scope();
+ if (!actions.templates.add(ts))
+ {
+ detail::outerr(ts.content.get_file(), ts.content.get_position())
+ << "Template Redefinition: " << detail::utf8(tname) << std::endl;
+ ++actions.error_count;
+ }
             }
         }
+
+ if (load_type == block_tags::include)
+ {
+ BOOST_FOREACH(template_symbol& ts, storage)
+ {
+ std::string tname = ts.identifier;
+
+ if (tname == "!")
+ {
+ ts.lexical_parent = &actions.templates.top_scope();
+ call_code_snippet(actions, &ts, first);
+ }
+ }
+
+ actions.templates.pop();
+ }
     }
 
- void include_action(quickbook::actions& actions, value include)
+ void include_action(quickbook::actions& actions, value include, string_iterator first)
     {
- if (actions.suppress) return;
         write_anchors(actions, actions.out);
 
         value_consumer values = include;
         value include_doc_id = values.optional_consume(general_tags::include_id);
- include_search_return filein = include_search(
+ include_search_return paths = include_search(
             check_path(values.consume(), actions), actions);
         values.finish();
 
- std::string doc_type, doc_id;
+ try {
+ if (qbk_version_n >= 106)
+ {
+ if (actions.imported && include.get_tag() == block_tags::include)
+ return;
 
- // swap the filenames
- std::swap(actions.filename, filein.filename);
- std::swap(actions.filename_relative, filein.filename_relative);
-
- // save the doc info strings and source mode
- if(qbk_version_n >= 106) {
- doc_type = actions.doc_type;
- doc_id = actions.doc_id;
- }
- else {
- actions.doc_type.swap(doc_type);
- actions.doc_id.swap(doc_id);
+ std::string ext = paths.filename.extension().generic_string();
+
+ if (ext == ".qbk" || ext == ".quickbook")
+ {
+ load_quickbook(actions, paths, include.get_tag(), include_doc_id);
+ }
+ else
+ {
+ load_source_file(actions, paths, include.get_tag(), first, include_doc_id);
+ }
+ }
+ else
+ {
+ if (include.get_tag() == block_tags::include)
+ {
+ load_quickbook(actions, paths, include.get_tag(), include_doc_id);
+ }
+ else
+ {
+ load_source_file(actions, paths, include.get_tag(), first, include_doc_id);
+ }
+ }
         }
-
- // save the source mode and version info (only restored for 1.6+)
- std::string source_mode = actions.source_mode;
- unsigned qbk_version_n_store = qbk_version_n;
-
- // scope the macros
- string_symbols macro = actions.macro;
- std::size_t macro_change_depth = actions.macro_change_depth;
- // scope the templates
- //~ template_symbols templates = actions.templates; $$$ fixme $$$
-
- // if an id is specified in this include (as in [include:id foo.qbk])
- // then use it as the doc_id.
- if (!include_doc_id.empty())
- actions.doc_id = include_doc_id.get_quickbook();
-
- // update the __FILENAME__ macro
- *boost::spirit::classic::find(actions.macro, "__FILENAME__")
- = detail::path_to_generic(actions.filename_relative);
-
- // save values
- actions.values.builder.save();
-
- // parse the file
- quickbook::parse_file(actions.filename, actions, true);
-
- // restore the values
- actions.values.builder.restore();
-
- std::swap(actions.filename, filein.filename);
- std::swap(actions.filename_relative, filein.filename_relative);
-
- actions.doc_type.swap(doc_type);
- actions.doc_id.swap(doc_id);
-
- if(qbk_version_n >= 106 || qbk_version_n_store >= 106)
- {
- actions.source_mode = source_mode;
+ catch (load_error& e) {
+ ++actions.error_count;
 
- qbk_version_n = qbk_version_n_store;
+ detail::outerr(actions.current_file, first)
+ << "Loading file:"
+ << paths.filename
+ << ": "
+ << detail::utf8(e.what())
+ << std::endl;
         }
-
- // restore the macros
- actions.macro = macro;
- actions.macro_change_depth = macro_change_depth;
- // restore the templates
- //~ actions.templates = templates; $$$ fixme $$$
     }
 
- void phrase_to_docinfo_action_impl::operator()(iterator first, iterator last,
- value::tag_type tag) const
+ bool to_value_scoped_action::start(value::tag_type t)
     {
- if (actions.suppress) return;
- write_anchors(actions, actions.phrase);
+ actions.out.push();
+ actions.phrase.push();
+ actions.anchors.swap(saved_anchors);
+ tag = t;
 
- std::string encoded;
- actions.phrase.swap(encoded);
- actions.values.builder.insert(
- qbk_bbk_value(first, last, encoded, tag));
+ return true;
     }
 
- void phrase_to_docinfo_action_impl::operator()(iterator first, iterator last) const
+ void to_value_scoped_action::success(parse_iterator first, parse_iterator last)
     {
- return (*this)(first, last, value::default_tag);
- }
-
- void to_value_action::operator()(iterator, iterator) const
- {
- if (actions.suppress) return;
-
         std::string value;
 
         if (!actions.out.str().empty())
@@ -1954,48 +1945,15 @@
             actions.phrase.swap(value);
         }
 
- actions.values.builder.insert(bbk_value(value, value::default_tag));
+ actions.values.builder.insert(encoded_qbk_value(
+ actions.current_file, first.base(), last.base(), value, tag));
     }
     
- bool scoped_output_push::start()
- {
- actions.out.push();
- actions.phrase.push();
- actions.anchors.swap(saved_anchors);
-
- return true;
- }
     
- void scoped_output_push::cleanup()
+ void to_value_scoped_action::cleanup()
     {
         actions.phrase.pop();
         actions.out.pop();
         actions.anchors.swap(saved_anchors);
     }
-
- bool set_no_eols_scoped::start()
- {
- saved_no_eols = actions.no_eols;
- actions.no_eols = false;
-
- return true;
- }
-
- void set_no_eols_scoped::cleanup()
- {
- actions.no_eols = saved_no_eols;
- }
-
- bool scoped_context_impl::start(int new_context)
- {
- saved_context_ = actions_.context;
- actions_.context = new_context;
-
- return true;
- }
-
- void scoped_context_impl::cleanup()
- {
- actions_.context = saved_context_;
- }
 }

Modified: trunk/tools/quickbook/src/actions.hpp
==============================================================================
--- trunk/tools/quickbook/src/actions.hpp (original)
+++ trunk/tools/quickbook/src/actions.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -12,13 +12,13 @@
 
 #include <string>
 #include <vector>
-#include <boost/spirit/include/phoenix1_functions.hpp>
-#include <boost/spirit/include/classic_symbols_fwd.hpp>
 #include "fwd.hpp"
 #include "template_stack.hpp"
 #include "utils.hpp"
 #include "values.hpp"
 #include "scoped.hpp"
+#include "symbols.hpp"
+#include <boost/spirit/include/classic_parser.hpp>
 
 namespace quickbook
 {
@@ -26,18 +26,22 @@
 
     extern unsigned qbk_version_n; // qbk_major_version * 100 + qbk_minor_version
 
- struct quickbook_range {
- template <typename Arg>
- struct result
- {
- typedef bool type;
- };
-
+ struct quickbook_range : cl::parser<quickbook_range> {
         quickbook_range(unsigned min_, unsigned max_)
             : min_(min_), max_(max_) {}
         
- bool operator()() const {
- return qbk_version_n >= min_ && qbk_version_n < max_;
+ template <typename ScannerT>
+ typename cl::parser_result<quickbook_range, ScannerT>::type
+ parse(ScannerT const& scan) const
+ {
+ if (qbk_version_n >= min_ && qbk_version_n < max_)
+ {
+ return scan.empty_match();
+ }
+ else
+ {
+ return scan.no_match();
+ }
         }
 
         unsigned min_, max_;
@@ -51,16 +55,25 @@
         return quickbook_range(0, max_);
     }
 
- typedef cl::symbols<std::string> string_symbols;
-
+ // Throws load_error
     int load_snippets(fs::path const& file, std::vector<template_symbol>& storage,
- std::string const& extension, std::string const& doc_id);
+ std::string const& extension, value::tag_type load_type);
 
     std::string syntax_highlight(
- iterator first, iterator last,
+ parse_iterator first, parse_iterator last,
         actions& escape_actions,
         std::string const& source_mode);
 
+ struct xinclude_path {
+ xinclude_path(fs::path& path, std::string const& uri) :
+ path(path), uri(uri) {}
+
+ fs::path path;
+ std::string uri;
+ };
+
+ xinclude_path calculate_xinclude_path(value const&, quickbook::actions&);
+
     struct error_message_action
     {
         // Prints an error message to std::cerr
@@ -70,7 +83,7 @@
             , message(m)
         {}
 
- void operator()(iterator, iterator) const;
+ void operator()(parse_iterator, parse_iterator) const;
 
         quickbook::actions& actions;
         std::string message;
@@ -83,7 +96,7 @@
         error_action(quickbook::actions& actions)
         : actions(actions) {}
 
- void operator()(iterator first, iterator /*last*/) const;
+ void operator()(parse_iterator first, parse_iterator last) const;
 
         error_message_action operator()(std::string const& message)
         {
@@ -98,7 +111,7 @@
         element_action(quickbook::actions& actions)
             : actions(actions) {}
 
- void operator()(iterator, iterator) const;
+ void operator()(parse_iterator, parse_iterator) const;
 
         quickbook::actions& actions;
     };
@@ -113,7 +126,33 @@
         : actions(actions) {}
 
         void operator()() const;
- void operator()(iterator, iterator) const { (*this)(); }
+ void operator()(parse_iterator, parse_iterator) const { (*this)(); }
+
+ quickbook::actions& actions;
+ };
+
+ struct list_item_action
+ {
+ // implicit paragraphs
+ // doesn't output the paragraph if it's only whitespace.
+
+ list_item_action(
+ quickbook::actions& actions)
+ : actions(actions) {}
+
+ void operator()() const;
+ void operator()(parse_iterator, parse_iterator) const { (*this)(); }
+
+ quickbook::actions& actions;
+ };
+
+ struct phrase_end_action
+ {
+ phrase_end_action(quickbook::actions& actions) :
+ actions(actions) {}
+
+ void operator()() const;
+ void operator()(parse_iterator, parse_iterator) const { (*this)(); }
 
         quickbook::actions& actions;
     };
@@ -143,57 +182,8 @@
         void cleanup();
 
         quickbook::actions& actions;
- bool saved_suppress;
- };
-
- struct span
- {
- // Decorates c++ code fragments
-
- span(char const* name, collector& out)
- : name(name), out(out) {}
-
- void operator()(iterator first, iterator last) const;
-
- char const* name;
- collector& out;
- };
-
- struct span_start
- {
- span_start(char const* name, collector& out)
- : name(name), out(out) {}
-
- void operator()(iterator first, iterator last) const;
-
- char const* name;
- collector& out;
- };
-
- struct span_end
- {
- span_end(collector& out)
- : out(out) {}
-
- void operator()(iterator first, iterator last) const;
-
- collector& out;
- };
-
- struct unexpected_char
- {
- // Handles unexpected chars in c++ syntax
-
- unexpected_char(
- collector& out
- , quickbook::actions& actions)
- : out(out)
- , actions(actions) {}
-
- void operator()(iterator first, iterator last) const;
-
- collector& out;
- quickbook::actions& actions;
+ bool saved_conditional;
+ std::vector<std::string> anchors;
     };
 
     extern char const* quickbook_get_date;
@@ -212,46 +202,19 @@
         quickbook::actions& actions;
     };
 
- struct space
+ struct raw_char_action
     {
         // Prints a space
 
- space(collector& out)
+ raw_char_action(collector& out)
             : out(out) {}
 
- void operator()(iterator first, iterator last) const;
         void operator()(char ch) const;
+ void operator()(parse_iterator first, parse_iterator last) const;
 
         collector& out;
     };
 
- struct pre_escape_back
- {
- // Escapes back from code to quickbook (Pre)
-
- pre_escape_back(actions& escape_actions, std::string& save)
- : escape_actions(escape_actions), save(save) {}
-
- void operator()(iterator first, iterator last) const;
-
- actions& escape_actions;
- std::string& save;
- };
-
- struct post_escape_back
- {
- // Escapes back from code to quickbook (Post)
-
- post_escape_back(collector& out, actions& escape_actions, std::string& save)
- : out(out), escape_actions(escape_actions), save(save) {}
-
- void operator()(iterator first, iterator last) const;
-
- collector& out;
- actions& escape_actions;
- std::string& save;
- };
-
     struct plain_char_action
     {
         // Prints a single plain char.
@@ -262,7 +225,7 @@
         , actions(actions) {}
 
         void operator()(char ch) const;
- void operator()(iterator first, iterator /*last*/) const;
+ void operator()(parse_iterator first, parse_iterator last) const;
 
         collector& phrase;
         quickbook::actions& actions;
@@ -273,7 +236,7 @@
         escape_unicode_action(collector& phrase, quickbook::actions& actions)
         : phrase(phrase)
         , actions(actions) {}
- void operator()(iterator first, iterator last) const;
+ void operator()(parse_iterator first, parse_iterator last) const;
 
         collector& phrase;
         quickbook::actions& actions;
@@ -293,7 +256,7 @@
         {
         }
 
- void operator()(iterator first, iterator last) const;
+ void operator()(parse_iterator first, parse_iterator last) const;
 
         collector& out;
         collector& phrase;
@@ -311,7 +274,7 @@
         , actions(actions)
         {}
 
- void operator()(iterator first, iterator last) const;
+ void operator()(parse_iterator first, parse_iterator last) const;
 
         collector& out;
         quickbook::actions& actions;
@@ -319,12 +282,10 @@
 
     struct break_action
     {
- // Handles line-breaks (DEPRECATED!!!)
-
         break_action(collector& phrase, quickbook::actions& actions)
         : phrase(phrase), actions(actions) {}
 
- void operator()(iterator f, iterator) const;
+ void operator()(parse_iterator f, parse_iterator) const;
 
         collector& phrase;
         quickbook::actions& actions;
@@ -335,75 +296,27 @@
         element_id_warning_action(quickbook::actions& actions_)
             : actions(actions_) {}
 
- void operator()(iterator first, iterator last) const;
+ void operator()(parse_iterator first, parse_iterator last) const;
 
         quickbook::actions& actions;
    };
 
- void pre(collector& out, quickbook::actions& actions, bool ignore_docinfo = false);
- void post(collector& out, quickbook::actions& actions, bool ignore_docinfo = false);
-
- struct phrase_to_docinfo_action_impl
- {
- template <typename Arg1, typename Arg2, typename Arg3 = void>
- struct result { typedef void type; };
-
- phrase_to_docinfo_action_impl(quickbook::actions& actions)
- : actions(actions) {}
-
- void operator()(iterator first, iterator last) const;
- void operator()(iterator first, iterator last, value::tag_type) const;
-
- quickbook::actions& actions;
- };
-
- typedef phoenix::function<phrase_to_docinfo_action_impl> phrase_to_docinfo_action;
+ // Returns the doc_type, or an empty string if there isn't one.
+ std::string pre(quickbook::actions& actions, parse_iterator pos, value include_doc_id, bool nested_file);
+ void post(quickbook::actions& actions, std::string const& doc_type);
 
- struct to_value_action
+ struct to_value_scoped_action : scoped_action_base
     {
- to_value_action(quickbook::actions& actions)
+ to_value_scoped_action(quickbook::actions& actions)
             : actions(actions) {}
 
- void operator()(iterator first, iterator last) const;
-
- quickbook::actions& actions;
- };
-
- struct scoped_output_push : scoped_action_base
- {
- scoped_output_push(quickbook::actions& actions)
- : actions(actions) {}
-
- bool start();
+ bool start(value::tag_type = value::default_tag);
+ void success(parse_iterator, parse_iterator);
         void cleanup();
 
         quickbook::actions& actions;
         std::vector<std::string> saved_anchors;
- };
-
- struct set_no_eols_scoped : scoped_action_base
- {
- set_no_eols_scoped(quickbook::actions& actions)
- : actions(actions) {}
-
- bool start();
- void cleanup();
-
- quickbook::actions& actions;
- bool saved_no_eols;
- };
-
- struct scoped_context_impl : scoped_action_base
- {
- scoped_context_impl(quickbook::actions& actions)
- : actions_(actions) {}
-
- bool start(int);
- void cleanup();
-
- private:
- quickbook::actions& actions_;
- int saved_context_;
+ value::tag_type tag;
     };
 }
 

Modified: trunk/tools/quickbook/src/actions_class.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions_class.cpp (original)
+++ trunk/tools/quickbook/src/actions_class.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -9,6 +9,7 @@
     http://www.boost.org/LICENSE_1_0.txt)
 =============================================================================*/
 #include "actions_class.hpp"
+#include "actions_state.hpp"
 #include "quickbook.hpp"
 #include "grammar.hpp"
 #include "input_path.hpp"
@@ -20,60 +21,43 @@
 namespace quickbook
 {
     actions::actions(fs::path const& filein_, fs::path const& xinclude_base_,
- string_stream& out_, id_generator& ids)
+ string_stream& out_, id_manager& ids)
         : grammar_()
 
- // header info
- , doc_type()
- , doc_title_qbk()
- , doc_id()
-
- // main output stream
- , out(out_)
-
- // auxilliary streams
- , phrase()
-
- // value actions
- , values()
- , to_value(*this)
- , docinfo_value(*this)
- , scoped_cond_phrase(*this)
- , scoped_output(*this)
- , scoped_no_eols(*this)
- , scoped_context(*this)
-
- // state
- , filename(filein_)
- , filename_relative(filein_.filename())
         , xinclude_base(xinclude_base_)
- , macro_change_depth(0)
- , macro()
- , section_level(0)
- , min_section_level(0)
- , section_id()
- , qualified_section_id()
- , source_mode("c++")
 
- // temporary or global state
- , template_depth(0)
         , templates()
         , error_count(0)
         , anchors()
- , no_eols(true)
- , suppress(false)
         , warned_about_breaks(false)
- , context(0)
+ , conditional(true)
         , ids(ids)
 
- // actions
+ , imported(false)
+ , macro()
+ , source_mode("c++")
+ , current_file(0)
+ , filename_relative(filein_.filename())
+
+ , template_depth(0)
+ , min_section_level(1)
+
+ , out(out_)
+ , phrase()
+ , values(&current_file)
+
+ , to_value(*this)
+ , scoped_cond_phrase(*this)
+
         , element(*this)
         , error(*this)
         , code(out, phrase, *this)
         , code_block(phrase, phrase, *this)
         , inline_code(phrase, *this)
         , paragraph(*this)
- , space_char(phrase)
+ , list_item(*this)
+ , phrase_end(*this)
+ , raw_char(phrase)
         , plain_char(phrase, *this)
         , escape_unicode(phrase, *this)
 
@@ -95,69 +79,58 @@
             new quickbook_grammar(*this));
         grammar_.swap(g);
     }
-
- void actions::push()
- {
- state_stack.push(
- boost::make_tuple(
- filename
- , xinclude_base
- , macro_change_depth
- , section_level
- , min_section_level
- , section_id
- , qualified_section_id
- , source_mode
- )
- );
-
- out.push();
- phrase.push();
- templates.push();
- values.builder.save();
+
+ quickbook_grammar& actions::grammar() const {
+ return *grammar_;
     }
-
- // Pushing and popping the macro symbol table is pretty expensive, so
- // instead implement a sort of 'stack on write'. Call this whenever a
- // change is made to the macro table, and it'll stack the current macros
- // if necessary. Would probably be better to implement macros in a less
- // expensive manner.
- void actions::copy_macros_for_write()
+
+ file_state::file_state(actions& a, scope_flags scope)
+ : a(a)
+ , scope(scope)
+ , qbk_version(qbk_version_n)
+ , imported(a.imported)
+ , current_file(a.current_file)
+ , filename_relative(a.filename_relative)
+ , xinclude_base(a.xinclude_base)
+ , source_mode(a.source_mode)
+ , macro()
     {
- if(macro_change_depth != state_stack.size())
- {
- macro_stack.push(macro);
- macro_change_depth = state_stack.size();
+ if (scope & scope_macros) macro = a.macro;
+ if (scope & scope_templates) a.templates.push();
+ if (scope & scope_output) {
+ a.out.push();
+ a.phrase.push();
         }
+ a.values.builder.save();
     }
 
- void actions::pop()
+ file_state::~file_state()
     {
- if(macro_change_depth == state_stack.size())
- {
- macro = macro_stack.top();
- macro_stack.pop();
+ a.values.builder.restore();
+ boost::swap(qbk_version_n, qbk_version);
+ boost::swap(a.imported, imported);
+ boost::swap(a.current_file, current_file);
+ boost::swap(a.filename_relative, filename_relative);
+ boost::swap(a.xinclude_base, xinclude_base);
+ boost::swap(a.source_mode, source_mode);
+ if (scope & scope_output) {
+ a.out.pop();
+ a.phrase.pop();
         }
-
- boost::tie(
- filename
- , xinclude_base
- , macro_change_depth
- , section_level
- , min_section_level
- , section_id
- , qualified_section_id
- , source_mode
- ) = state_stack.top();
- state_stack.pop();
-
- out.pop();
- phrase.pop();
- templates.pop();
- values.builder.restore();
+ if (scope & scope_templates) a.templates.pop();
+ if (scope & scope_macros) a.macro = macro;
     }
     
- quickbook_grammar& actions::grammar() const {
- return *grammar_;
+ template_state::template_state(actions& a)
+ : file_state(a, file_state::scope_all)
+ , template_depth(a.template_depth)
+ , min_section_level(a.min_section_level)
+ {
+ }
+
+ template_state::~template_state()
+ {
+ boost::swap(a.template_depth, template_depth);
+ boost::swap(a.min_section_level, min_section_level);
     }
 }

Modified: trunk/tools/quickbook/src/actions_class.hpp
==============================================================================
--- trunk/tools/quickbook/src/actions_class.hpp (original)
+++ trunk/tools/quickbook/src/actions_class.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -10,7 +10,6 @@
 #if !defined(BOOST_SPIRIT_ACTIONS_CLASS_HPP)
 #define BOOST_SPIRIT_ACTIONS_CLASS_HPP
 
-#include <boost/tuple/tuple.hpp>
 #include <boost/scoped_ptr.hpp>
 #include "actions.hpp"
 #include "parsers.hpp"
@@ -25,7 +24,7 @@
     struct actions
     {
         actions(fs::path const& filein_, fs::path const& xinclude_base, string_stream& out_,
- id_generator&);
+ id_manager&);
 
     private:
         boost::scoped_ptr<quickbook_grammar> grammar_;
@@ -38,82 +37,50 @@
         typedef std::vector<std::string> string_list;
 
         static int const max_template_depth = 100;
-
- // header info
- std::string doc_type;
- std::string doc_title_qbk;
- std::string doc_id;
-
- // main output stream
- collector out;
-
- // auxilliary streams
- collector phrase;
-
- // value actions
- value_parser values;
- to_value_action to_value;
- phrase_to_docinfo_action docinfo_value;
         
- scoped_parser<cond_phrase_push>
- scoped_cond_phrase;
- scoped_parser<scoped_output_push>
- scoped_output;
- scoped_parser<set_no_eols_scoped>
- scoped_no_eols;
- scoped_parser<scoped_context_impl>
- scoped_context;
+ // global state
+ fs::path xinclude_base;
+ template_stack templates;
+ int error_count;
+ string_list anchors;
+ bool warned_about_breaks;
+ bool conditional;
+ id_manager& ids;
 
- // state
- fs::path filename;
+ // state saved for files and templates.
+ bool imported;
+ string_symbols macro;
+ std::string source_mode;
+ file_ptr current_file;
         fs::path filename_relative; // for the __FILENAME__ macro.
                                                     // (relative to the original file
                                                     // or include path).
- fs::path xinclude_base;
- std::size_t macro_change_depth;
- string_symbols macro;
- int section_level;
- int min_section_level;
- std::string section_id;
- std::string qualified_section_id;
- std::string source_mode;
-
- typedef boost::tuple<
- fs::path
- , fs::path
- , std::size_t
- , int
- , int
- , std::string
- , std::string
- , std::string>
- state_tuple;
-
- std::stack<state_tuple> state_stack;
- // Stack macros separately as copying macros is expensive.
- std::stack<string_symbols> macro_stack;
 
- // temporary or global state
+ // state saved for templates.
         int template_depth;
- template_stack templates;
- int error_count;
- string_list anchors;
- bool no_eols;
- bool suppress;
- bool warned_about_breaks;
- int context;
- id_generator& ids;
+ int min_section_level;
+
+ // output state - scoped by templates and grammar
+ collector out; // main output stream
+ collector phrase; // phrase output stream
+ value_parser values; // parsed values
 
- // push/pop the states and the streams
- void copy_macros_for_write();
- void push();
- void pop();
         quickbook_grammar& grammar() const;
 
     ///////////////////////////////////////////////////////////////////////////
     // actions
     ///////////////////////////////////////////////////////////////////////////
 
+ void start_list(char mark);
+ void end_list(char mark);
+ void start_list_item();
+ void end_list_item();
+
+ scoped_parser<to_value_scoped_action>
+ to_value;
+ scoped_parser<cond_phrase_push>
+ scoped_cond_phrase;
+
         element_action element;
         error_action error;
 
@@ -121,7 +88,9 @@
         code_action code_block;
         inline_code_action inline_code;
         paragraph_action paragraph;
- space space_char;
+ list_item_action list_item;
+ phrase_end_action phrase_end;
+ raw_char_action raw_char;
         plain_char_action plain_char;
         escape_unicode_action escape_unicode;
 

Modified: trunk/tools/quickbook/src/block_element_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/block_element_grammar.cpp (original)
+++ trunk/tools/quickbook/src/block_element_grammar.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -28,10 +28,10 @@
     {
         cl::rule<scanner>
                         heading, inner_block, inner_phrase, def_macro,
- table, table_row, variablelist,
+ table, table_title, table_row, variablelist,
                         varlistentry, varlistterm, list, cell,
                         preformatted, begin_section, end_section,
- xinclude, include,
+ xinclude, include, include_filename,
                         template_, template_id, template_formal_arg,
                         template_body, identifier, import,
                         element_id, element_id_1_5, element_id_1_6,
@@ -45,7 +45,7 @@
 
         local.element_id =
             !( ':'
- >> ( !(cl::eps_p(qbk_since(105u)) >> space)
+ >> ( !(qbk_since(105u) >> space)
>> (+(cl::alnum_p | '_')) [actions.values.entry(ph::arg1, ph::arg2, general_tags::element_id)]
                 | cl::eps_p [actions.element_id_warning]
                 )
@@ -53,10 +53,10 @@
             ;
         
         local.element_id_1_5 =
- !(cl::eps_p(qbk_since(105u)) >> local.element_id);
+ !(qbk_since(105u) >> local.element_id);
 
         local.element_id_1_6 =
- !(cl::eps_p(qbk_since(106u)) >> local.element_id);
+ !(qbk_since(106u) >> local.element_id);
 
         elements.add
             ("section", element_info(element_info::block, &local.begin_section, block_tags::begin_section))
@@ -102,14 +102,20 @@
             ;
 
         elements.add
+ ("block", element_info(element_info::nested_block, &local.inner_phrase, block_tags::block, 106u))
+ ;
+
+ elements.add
             ("pre", element_info(element_info::nested_block, &local.preformatted, block_tags::preformatted))
             ;
 
         local.preformatted =
- space
- >> !eol
- >> actions.scoped_no_eols()
- [ local.inner_phrase
+ ( qbk_before(106) >> space
+ | qbk_since(106) >> blank >> !eol
+ )
+ >> actions.to_value()
+ [
+ inside_preformatted
                 ]
             ;
 
@@ -167,8 +173,7 @@
 
         local.variablelist =
                 (cl::eps_p(*cl::blank_p >> cl::eol_p) | space)
- >> (*(cl::anychar_p - eol)) [actions.values.entry(ph::arg1, ph::arg2, table_tags::title)]
- >> (+eol)
+ >> local.table_title
>> *local.varlistentry
             ;
 
@@ -209,8 +214,7 @@
                 local.same_line
>> local.element_id_1_5
>> local.same_line
- >> (*(cl::anychar_p - eol)) [actions.values.entry(ph::arg1, ph::arg2, table_tags::title)]
- >> (+eol)
+ >> local.table_title
>> *local.table_row
             ;
 
@@ -230,6 +234,18 @@
             )
             ;
 
+ local.table_title =
+ qbk_before(106)
+ >> (*(cl::anychar_p - eol)) [actions.values.entry(ph::arg1, ph::arg2, table_tags::title)]
+ >> (+eol)
+ | qbk_since(106)
+ >> actions.to_value(table_tags::title)
+ [
+ table_title_phrase
+ ]
+ >> space
+ ;
+
         elements.add
             ("ordered_list", element_info(element_info::nested_block, &local.list, block_tags::ordered_list, 106))
             ("itemized_list", element_info(element_info::nested_block, &local.list, block_tags::itemized_list, 106))
@@ -255,12 +271,12 @@
 
         local.xinclude =
                space
- >> (*(cl::anychar_p - phrase_end)) [actions.values.entry(ph::arg1, ph::arg2)]
+ >> local.include_filename
             ;
 
         local.import =
                space
- >> (*(cl::anychar_p - phrase_end)) [actions.values.entry(ph::arg1, ph::arg2)]
+ >> local.include_filename
             ;
 
         local.include =
@@ -272,20 +288,32 @@
                                                 [actions.values.entry(ph::arg1, ph::arg2, general_tags::include_id)]
>> space
             )
- >> (*(cl::anychar_p - phrase_end)) [actions.values.entry(ph::arg1, ph::arg2)]
+ >> local.include_filename
+ ;
+
+ local.include_filename =
+ qbk_before(106u)
+ >> (*(cl::anychar_p - phrase_end)) [actions.values.entry(ph::arg1, ph::arg2)]
+ | qbk_since(106u)
+ >> actions.to_value()
+ [ *( raw_escape
+ | (cl::anychar_p - phrase_end)
+ [actions.raw_char]
+ )
+ ]
             ;
 
         local.inner_block =
- actions.scoped_output()
+ actions.to_value()
             [
- inside_paragraph [actions.to_value]
+ inside_paragraph
             ]
             ;
 
         local.inner_phrase =
- actions.scoped_output()
+ actions.to_value()
             [
- phrase [actions.docinfo_value(ph::arg1, ph::arg2)]
+ paragraph_phrase
             ]
             ;
     }

Modified: trunk/tools/quickbook/src/block_tags.hpp
==============================================================================
--- trunk/tools/quickbook/src/block_tags.hpp (original)
+++ trunk/tools/quickbook/src/block_tags.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -18,12 +18,12 @@
         (generic_heading)
         (heading1)(heading2)(heading3)(heading4)(heading5)(heading6)
         (blurb)(blockquote)(preformatted)
- (warning)(caution)(important)(note)(tip)
+ (warning)(caution)(important)(note)(tip)(block)
         (macro_definition)(template_definition)
         (variable_list)(table)
         (xinclude)(import)(include)
         (paragraph)
- (list)(ordered_list)(itemized_list)
+ (ordered_list)(itemized_list)
         (hr)
     )
 

Modified: trunk/tools/quickbook/src/code_snippet.cpp
==============================================================================
--- trunk/tools/quickbook/src/code_snippet.cpp (original)
+++ trunk/tools/quickbook/src/code_snippet.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -13,9 +13,12 @@
 #include <boost/shared_ptr.hpp>
 #include <boost/bind.hpp>
 #include <boost/lexical_cast.hpp>
+#include "block_tags.hpp"
 #include "template_stack.hpp"
 #include "actions.hpp"
 #include "values.hpp"
+#include "files.hpp"
+#include "input_path.hpp"
 
 namespace quickbook
 {
@@ -24,24 +27,31 @@
     struct code_snippet_actions
     {
         code_snippet_actions(std::vector<template_symbol>& storage,
- fs::path const& filename,
- std::string const& doc_id,
- char const* source_type)
- : callout_id(0)
+ file_ptr source_file,
+ char const* source_type)
+ : last_code_pos(source_file->source.begin())
+ , in_code(false)
+ , callout_id(0)
+ , snippet_stack()
             , storage(storage)
- , filename(filename)
- , doc_id(doc_id)
+ , source_file(source_file)
             , source_type(source_type)
- {}
+ , error_count(0)
+ {
+ content.start(source_file);
+ }
 
- void pass_thru_char(char);
- void pass_thru(iterator first, iterator last);
- void escaped_comment(iterator first, iterator last);
- void start_snippet(iterator first, iterator last);
- void end_snippet(iterator first, iterator last);
- void callout(iterator first, iterator last);
+ void mark(string_iterator first, string_iterator last);
+ void pass_thru(string_iterator first, string_iterator last);
+ void escaped_comment(string_iterator first, string_iterator last);
+ void start_snippet(string_iterator first, string_iterator last);
+ void start_snippet_impl(std::string const&, string_iterator);
+ void end_snippet(string_iterator first, string_iterator last);
+ void end_snippet_impl(string_iterator);
+ void callout(string_iterator first, string_iterator last);
+ void end_file(string_iterator, string_iterator);
         
- void append_code();
+ void append_code(string_iterator first, string_iterator last);
         void close_code();
 
         struct snippet_data
@@ -49,26 +59,28 @@
             snippet_data(std::string const& id, int callout_base_id)
                 : id(id)
                 , callout_base_id(callout_base_id)
- , content()
                 , start_code(false)
- , end_code(false)
             {}
             
             std::string id;
             int callout_base_id;
- std::string content;
             bool start_code;
- bool end_code;
+ std::string::const_iterator source_pos;
+ mapped_file_builder::pos start_pos;
             value_builder callouts;
             boost::shared_ptr<snippet_data> next;
         };
         
- void push_snippet_data(std::string const& id, int callout_base_id)
+ void push_snippet_data(std::string const& id, int callout_base_id,
+ std::string::const_iterator pos)
         {
             boost::shared_ptr<snippet_data> new_snippet(
                 new snippet_data(id, callout_base_id));
             new_snippet->next = snippet_stack;
             snippet_stack = new_snippet;
+ snippet_stack->start_code = in_code;
+ snippet_stack->source_pos = pos;
+ snippet_stack->start_pos = content.get_pos();
         }
 
         boost::shared_ptr<snippet_data> pop_snippet_data()
@@ -78,15 +90,17 @@
             snippet->next.reset();
             return snippet;
         }
-
+
+ mapped_file_builder content;
+ std::string::const_iterator mark_begin, mark_end;
+ std::string::const_iterator last_code_pos;
+ bool in_code;
         int callout_id;
         boost::shared_ptr<snippet_data> snippet_stack;
- std::string code;
- std::string id;
         std::vector<template_symbol>& storage;
- fs::path filename;
- std::string const doc_id;
+ file_ptr source_file;
         char const* const source_type;
+ int error_count;
     };
 
     struct python_code_snippet_grammar
@@ -108,7 +122,8 @@
 
                 actions_type& actions = self.actions;
             
- start_ = *code_elements;
+ start_ = (*code_elements) [boost::bind(&actions_type::end_file, &actions, _1, _2)]
+ ;
 
                 identifier =
                     (cl::alpha_p | '_') >> *(cl::alnum_p | '_')
@@ -117,26 +132,33 @@
                 code_elements =
                         start_snippet [boost::bind(&actions_type::start_snippet, &actions, _1, _2)]
                     | end_snippet [boost::bind(&actions_type::end_snippet, &actions, _1, _2)]
- | escaped_comment
- | pass_thru_comment
- | ignore
- | cl::anychar_p [boost::bind(&actions_type::pass_thru_char, &actions, _1)]
+ | escaped_comment [boost::bind(&actions_type::escaped_comment, &actions, _1, _2)]
+ | pass_thru_comment [boost::bind(&actions_type::pass_thru, &actions, _1, _2)]
+ | ignore [boost::bind(&actions_type::append_code, &actions, _1, _2)]
+ | cl::anychar_p
                     ;
 
                 start_snippet =
- "#[" >> *cl::space_p
- >> identifier [cl::assign_a(actions.id)]
+ *cl::blank_p
+ >> !(cl::eol_p >> *cl::blank_p)
+ >> "#["
+ >> *cl::blank_p
+ >> identifier [boost::bind(&actions_type::mark, &actions, _1, _2)]
+ >> *(cl::anychar_p - cl::eol_p)
                     ;
 
                 end_snippet =
- cl::str_p("#]")
+ *cl::blank_p
+ >> !(cl::eol_p >> *cl::blank_p)
+ >> "#]"
+ >> *(cl::anychar_p - cl::eol_p)
                     ;
 
                 ignore
                     = cl::confix_p(
                             *cl::blank_p >> "#<-",
                             *cl::anychar_p,
- "#->" >> *cl::blank_p >> cl::eol_p
+ "#->" >> *cl::blank_p >> (cl::eol_p | cl::end_p)
                         )
                     | cl::confix_p(
                             "\"\"\"<-\"\"\"",
@@ -153,12 +175,12 @@
                 escaped_comment =
                         cl::confix_p(
                             *cl::space_p >> "#`",
- (*cl::anychar_p) [boost::bind(&actions_type::escaped_comment, &actions, _1, _2)],
- cl::eol_p
+ (*cl::anychar_p) [boost::bind(&actions_type::mark, &actions, _1, _2)],
+ (cl::eol_p | cl::end_p)
                         )
                     | cl::confix_p(
                             *cl::space_p >> "\"\"\"`",
- (*cl::anychar_p) [boost::bind(&actions_type::escaped_comment, &actions, _1, _2)],
+ (*cl::anychar_p) [boost::bind(&actions_type::mark, &actions, _1, _2)],
                             "\"\"\""
                         )
                     ;
@@ -169,10 +191,10 @@
                     = "#=" >> (cl::eps_p - '=')
>> ( *(cl::anychar_p - cl::eol_p)
>> (cl::eol_p | cl::end_p)
- ) [boost::bind(&actions_type::pass_thru, &actions, _1, _2)]
+ ) [boost::bind(&actions_type::mark, &actions, _1, _2)]
                     | cl::confix_p(
                             "\"\"\"=" >> (cl::eps_p - '='),
- (*cl::anychar_p) [boost::bind(&actions_type::pass_thru, &actions, _1, _2)],
+ (*cl::anychar_p) [boost::bind(&actions_type::mark, &actions, _1, _2)],
                             "\"\"\""
                         )
                     ;
@@ -205,7 +227,8 @@
             {
                 actions_type& actions = self.actions;
             
- start_ = *code_elements;
+ start_ = (*code_elements) [boost::bind(&actions_type::end_file, &actions, _1, _2)]
+ ;
 
                 identifier =
                     (cl::alpha_p | '_') >> *(cl::alnum_p | '_')
@@ -214,31 +237,60 @@
                 code_elements =
                         start_snippet [boost::bind(&actions_type::start_snippet, &actions, _1, _2)]
                     | end_snippet [boost::bind(&actions_type::end_snippet, &actions, _1, _2)]
- | escaped_comment
- | ignore
- | pass_thru_comment
- | line_callout
- | inline_callout
- | cl::anychar_p [boost::bind(&actions_type::pass_thru_char, &actions, _1)]
+ | escaped_comment [boost::bind(&actions_type::escaped_comment, &actions, _1, _2)]
+ | ignore [boost::bind(&actions_type::append_code, &actions, _1, _2)]
+ | pass_thru_comment [boost::bind(&actions_type::pass_thru, &actions, _1, _2)]
+ | line_callout [boost::bind(&actions_type::callout, &actions, _1, _2)]
+ | inline_callout [boost::bind(&actions_type::callout, &actions, _1, _2)]
+ | cl::anychar_p
                     ;
 
                 start_snippet =
- "//[" >> *cl::space_p
- >> identifier [cl::assign_a(actions.id)]
+ *cl::blank_p
+ >> !(cl::eol_p >> *cl::blank_p)
+ >> "//["
+ >> *cl::blank_p
+ >> identifier [boost::bind(&actions_type::mark, &actions, _1, _2)]
+ >> *(cl::anychar_p - cl::eol_p)
                     |
- "/*[" >> *cl::space_p
- >> identifier [cl::assign_a(actions.id)]
- >> *cl::space_p >> "*/"
+ *cl::blank_p
+ >> cl::eol_p
+ >> *cl::blank_p
+ >> "/*["
+ >> *cl::space_p
+ >> identifier [boost::bind(&actions_type::mark, &actions, _1, _2)]
+ >> *cl::space_p
+ >> "*/"
+ >> *cl::blank_p
+ >> cl::eps_p(cl::eol_p)
+ |
+ "/*["
+ >> *cl::space_p
+ >> identifier [boost::bind(&actions_type::mark, &actions, _1, _2)]
+ >> *cl::space_p
+ >> "*/"
                     ;
 
                 end_snippet =
- cl::str_p("//]") | "/*]*/"
+ *cl::blank_p
+ >> !(cl::eol_p >> *cl::blank_p)
+ >> "//]"
+ >> *(cl::anychar_p - cl::eol_p)
+ |
+ *cl::blank_p
+ >> cl::eol_p
+ >> *cl::blank_p
+ >> "/*]*/"
+ >> *cl::blank_p
+ >> cl::eps_p(cl::eol_p)
+ |
+ "/*[*/"
                     ;
 
                 inline_callout
                     = cl::confix_p(
                             "/*<" >> *cl::space_p,
- (*cl::anychar_p) [boost::bind(&actions_type::callout, &actions, _1, _2)],
+ (*cl::anychar_p) [boost::bind(&actions_type::mark, &actions, _1, _2)],
                             ">*/"
                         )
                         ;
@@ -246,7 +298,7 @@
                 line_callout
                     = cl::confix_p(
                             "/*<<" >> *cl::space_p,
- (*cl::anychar_p) [boost::bind(&actions_type::callout, &actions, _1, _2)],
+ (*cl::anychar_p) [boost::bind(&actions_type::mark, &actions, _1, _2)],
                             ">>*/"
                         )
>> *cl::space_p
@@ -275,12 +327,12 @@
                 escaped_comment
                     = cl::confix_p(
                             *cl::space_p >> "//`",
- (*cl::anychar_p) [boost::bind(&actions_type::escaped_comment, &actions, _1, _2)],
- cl::eol_p
+ (*cl::anychar_p) [boost::bind(&actions_type::mark, &actions, _1, _2)],
+ (cl::eol_p | cl::end_p)
                         )
                     | cl::confix_p(
                             *cl::space_p >> "/*`",
- (*cl::anychar_p) [boost::bind(&actions_type::escaped_comment, &actions, _1, _2)],
+ (*cl::anychar_p) [boost::bind(&actions_type::mark, &actions, _1, _2)],
                             "*/"
                         )
                     ;
@@ -291,10 +343,10 @@
                     = "//=" >> (cl::eps_p - '=')
>> ( *(cl::anychar_p - cl::eol_p)
>> (cl::eol_p | cl::end_p)
- ) [boost::bind(&actions_type::pass_thru, &actions, _1, _2)]
+ ) [boost::bind(&actions_type::mark, &actions, _1, _2)]
                     | cl::confix_p(
                             "/*=" >> (cl::eps_p - '='),
- (*cl::anychar_p) [boost::bind(&actions_type::pass_thru, &actions, _1, _2)],
+ (*cl::anychar_p) [boost::bind(&actions_type::mark, &actions, _1, _2)],
                             "*/"
                         )
                     ;
@@ -312,134 +364,207 @@
     };
 
     int load_snippets(
- fs::path const& file
+ fs::path const& filename
       , std::vector<template_symbol>& storage // snippets are stored in a
                                                 // vector of template_symbols
       , std::string const& extension
- , std::string const& doc_id)
+ , value::tag_type load_type)
     {
- std::string code;
- int err = detail::load(file, code);
- if (err != 0)
- return err; // return early on error
-
- iterator first(code.begin());
- iterator last(code.end());
+ assert(load_type == block_tags::include ||
+ load_type == block_tags::import);
 
         bool is_python = extension == ".py";
- code_snippet_actions a(storage, file, doc_id, is_python ? "[python]" : "[c++]");
- // TODO: Should I check that parse succeeded?
+ code_snippet_actions a(storage, load(filename, qbk_version_n), is_python ? "[python]" : "[c++]");
+
+ string_iterator first(a.source_file->source.begin());
+ string_iterator last(a.source_file->source.end());
+
+ cl::parse_info<string_iterator> info;
+
         if(is_python) {
- boost::spirit::classic::parse(first, last, python_code_snippet_grammar(a));
+ info = boost::spirit::classic::parse(first, last, python_code_snippet_grammar(a));
         }
         else {
- boost::spirit::classic::parse(first, last, cpp_code_snippet_grammar(a));
+ info = boost::spirit::classic::parse(first, last, cpp_code_snippet_grammar(a));
         }
 
- return 0;
+ assert(info.full);
+ return a.error_count;
     }
 
- void code_snippet_actions::append_code()
+ void code_snippet_actions::append_code(string_iterator first, string_iterator last)
     {
- if(!snippet_stack) return;
- snippet_data& snippet = *snippet_stack;
-
- if (!code.empty())
- {
- detail::unindent(code); // remove all indents
+ assert(last_code_pos <= first);
 
- if(snippet.content.empty())
- {
- snippet.start_code = true;
- }
- else if(!snippet.end_code)
- {
- snippet.content += "\n\n";
- snippet.content += source_type;
- snippet.content += "```\n";
- }
-
- snippet.content += code;
- snippet.end_code = true;
+ if(snippet_stack) {
+ if (last_code_pos != first) {
+ if (!in_code)
+ {
+ content.add("\n\n", last_code_pos);
+ content.add(source_type, last_code_pos);
+ content.add("```\n", last_code_pos);
+
+ in_code = true;
+ }
 
- code.clear();
+ content.add(last_code_pos, first);
+ }
         }
+
+ last_code_pos = last;
     }
-
+
     void code_snippet_actions::close_code()
     {
- if(!snippet_stack) return;
- snippet_data& snippet = *snippet_stack;
+ if (!snippet_stack) return;
     
- if(snippet.end_code)
+ if (in_code)
         {
- snippet.content += "```\n\n";
- snippet.end_code = false;
+ content.add("\n```\n\n", last_code_pos);
+ in_code = false;
         }
     }
 
- void code_snippet_actions::pass_thru(iterator first, iterator last)
+ void code_snippet_actions::mark(string_iterator first, string_iterator last)
     {
- if(!snippet_stack) return;
- code.append(first, last);
+ mark_begin = first;
+ mark_end = last;
     }
 
- void code_snippet_actions::pass_thru_char(char c)
+ void code_snippet_actions::pass_thru(string_iterator first, string_iterator last)
     {
         if(!snippet_stack) return;
- code += c;
+ append_code(first, last);
+
+ if (!in_code)
+ {
+ content.add("\n\n", first);
+ content.add(source_type, first);
+ content.add("```\n", first);
+ in_code = true;
+ }
+
+ content.add(mark_begin, mark_end);
     }
 
- void code_snippet_actions::callout(iterator first, iterator last)
+ void code_snippet_actions::callout(string_iterator first, string_iterator last)
     {
         if(!snippet_stack) return;
- code += "``[[callout" + boost::lexical_cast<std::string>(callout_id) + "]]``";
+ append_code(first, last);
+
+ if (!in_code)
+ {
+ content.add("\n\n", first);
+ content.add(source_type, first);
+ content.add("```\n", first);
+ in_code = true;
+ }
+
+ content.add(
+ "``[[callout" + boost::lexical_cast<std::string>(callout_id) + "]]``",
+ first);
     
- snippet_stack->callouts.insert(qbk_value(first, last, template_tags::block));
+ snippet_stack->callouts.insert(qbk_value(source_file, mark_begin, mark_end, template_tags::block));
         ++callout_id;
     }
 
- void code_snippet_actions::escaped_comment(iterator first, iterator last)
+ void code_snippet_actions::escaped_comment(string_iterator first, string_iterator last)
     {
- if(!snippet_stack) return;
- snippet_data& snippet = *snippet_stack;
- append_code();
+ append_code(first, last);
         close_code();
 
- std::string temp(first, last);
- detail::unindent(temp); // remove all indents
- if (temp.size() != 0)
+ if (mark_begin != mark_end)
         {
- snippet.content += "\n" + temp; // add a linebreak to allow block markups
+ if (!snippet_stack)
+ {
+ start_snippet_impl("!", first);
+ }
+
+ snippet_data& snippet = *snippet_stack;
+
+ content.add("\n", mark_begin);
+ content.unindent_and_add(mark_begin, mark_end);
+
+ if (snippet.id == "!")
+ {
+ end_snippet_impl(last);
+ }
         }
     }
 
- void code_snippet_actions::start_snippet(iterator, iterator)
+ void code_snippet_actions::start_snippet(string_iterator first, string_iterator last)
     {
- append_code();
- push_snippet_data(id, callout_id);
- id.clear();
+ append_code(first, last);
+ start_snippet_impl(std::string(mark_begin, mark_end), first);
     }
 
- void code_snippet_actions::end_snippet(iterator first, iterator)
+ void code_snippet_actions::end_snippet(string_iterator first, string_iterator last)
     {
- // TODO: Error?
- if(!snippet_stack) return;
+ append_code(first, last);
 
- append_code();
+ if(!snippet_stack) {
+ if (qbk_version_n >= 106u) {
+ detail::outerr(source_file, first)
+ << "Mismatched end snippet."
+ << std::endl;
+ ++error_count;
+ }
+ else {
+ detail::outwarn(source_file, first)
+ << "Mismatched end snippet."
+ << std::endl;
+ }
+ return;
+ }
+
+ end_snippet_impl(first);
+ }
+
+ void code_snippet_actions::end_file(string_iterator, string_iterator pos)
+ {
+ append_code(pos, pos);
+ close_code();
+
+ while (snippet_stack) {
+ if (qbk_version_n >= 106u) {
+ detail::outerr(source_file->path)
+ << "Unclosed snippet '" << snippet_stack->id << "'"
+ << std::endl;
+ ++error_count;
+ }
+ else {
+ detail::outwarn(source_file->path)
+ << "Unclosed snippet '" << snippet_stack->id << "'"
+ << std::endl;
+ }
+
+ end_snippet_impl(pos);
+ }
+ }
+
+ void code_snippet_actions::start_snippet_impl(std::string const& id,
+ string_iterator position)
+ {
+ push_snippet_data(id, callout_id, position);
+ }
+
+ void code_snippet_actions::end_snippet_impl(string_iterator position)
+ {
+ assert(snippet_stack);
 
         boost::shared_ptr<snippet_data> snippet = pop_snippet_data();
         value callouts = snippet->callouts.release();
 
- std::string body;
- if(snippet->start_code) {
- body += "\n\n";
- body += source_type;
- body += "```\n";
- }
- body += snippet->content;
- if(snippet->end_code) {
- body += "```\n\n";
+ mapped_file_builder f;
+ f.start(source_file);
+ if (snippet->start_code) {
+ f.add("\n\n", snippet->source_pos);
+ f.add(source_type, snippet->source_pos);
+ f.add("```\n", snippet->source_pos);
+ }
+ f.add(content, snippet->start_pos, content.get_pos());
+ if (in_code) {
+ f.add("\n```\n\n", position);
         }
 
         std::vector<std::string> params;
@@ -449,34 +574,23 @@
             params.push_back("[callout" + boost::lexical_cast<std::string>(snippet->callout_base_id + i) + "]");
             ++i;
         }
-
- // TODO: Save position in start_snippet
- template_symbol symbol(snippet->id, params,
- qbk_value(body, first.get_position(), template_tags::block),
- filename);
- symbol.callouts = callouts;
+
+ file_ptr body = f.release();
+
+ value_builder builder;
+ builder.set_tag(template_tags::snippet);
+ builder.insert(qbk_value(body, body->source.begin(), body->source.end(),
+ template_tags::block));
+ builder.insert(callouts);
+
+ template_symbol symbol(snippet->id, params, builder.release());
         storage.push_back(symbol);
 
- // Merge the snippet into its parent
+ // Copy the snippet's callouts to its parent
 
         if(snippet_stack)
         {
- snippet_data& next = *snippet_stack;
- if(!snippet->content.empty()) {
- if(!snippet->start_code) {
- close_code();
- }
- else if(!next.end_code) {
- next.content += "\n\n";
- next.content += source_type;
- next.content += "```\n";
- }
-
- next.content += snippet->content;
- next.end_code = snippet->end_code;
- }
-
- next.callouts.extend(callouts);
+ snippet_stack->callouts.extend(callouts);
         }
     }
 }

Modified: trunk/tools/quickbook/src/doc_info_actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/doc_info_actions.cpp (original)
+++ trunk/tools/quickbook/src/doc_info_actions.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -14,10 +14,11 @@
 #include <boost/foreach.hpp>
 #include "quickbook.hpp"
 #include "utils.hpp"
+#include "files.hpp"
 #include "input_path.hpp"
 #include "actions_class.hpp"
 #include "doc_info_tags.hpp"
-#include "id_generator.hpp"
+#include "id_manager.hpp"
 
 namespace quickbook
 {
@@ -25,10 +26,22 @@
     
     static std::string doc_info_output(value const& p, unsigned version)
     {
- return (qbk_version_n < version) ? p.get_quickbook() : p.get_boostbook();
+ if (qbk_version_n < version) {
+ std::string value = p.get_quickbook();
+ value.erase(value.find_last_not_of(" \t") + 1);
+ return value;
+ }
+ else {
+ return p.get_encoded();
+ }
     }
 
- value consume_last(value_consumer& c, value::tag_type tag,
+ // Each docinfo attribute is stored in a value list, these are then stored
+ // in a sorted value list. The following convenience methods extract all the
+ // values for an attribute tag.
+
+ // Expecting at most one attribute, with several values in the list.
+ value consume_list(value_consumer& c, value::tag_type tag,
             std::vector<std::string>* duplicates)
     {
         value p;
@@ -44,10 +57,12 @@
         return p;
     }
 
- value consume_last_single(value_consumer& c, value::tag_type tag,
+ // Expecting at most one attribute, with a single value, so extract that
+ // immediately.
+ value consume_value_in_list(value_consumer& c, value::tag_type tag,
             std::vector<std::string>* duplicates)
     {
- value l = consume_last(c, tag, duplicates);
+ value l = consume_list(c, tag, duplicates);
         if(l.empty()) return l;
 
         assert(l.is_list());
@@ -58,7 +73,8 @@
         return p;
     }
 
- std::vector<value> consume_multiple(value_consumer& c, value::tag_type tag)
+ // Any number of attributes, so stuff them into a vector.
+ std::vector<value> consume_multiple_lists(value_consumer& c, value::tag_type tag)
     {
         std::vector<value> values;
         
@@ -69,50 +85,107 @@
         return values;
     }
 
- void pre(collector& out, quickbook::actions& actions, bool ignore_docinfo)
+ unsigned get_version(quickbook::actions& actions, bool using_docinfo,
+ value version)
+ {
+ unsigned result = 0;
+
+ if (!version.empty()) {
+ value_consumer version_values(version);
+ bool before_docinfo = version_values.optional_consume(
+ doc_info_tags::before_docinfo).check();
+ int major_verison = version_values.consume().get_int();
+ int minor_verison = version_values.consume().get_int();
+ version_values.finish();
+
+ if (before_docinfo || using_docinfo) {
+ result = ((unsigned) major_verison * 100) +
+ (unsigned) minor_verison;
+
+ if(result < 100 || result > 106)
+ {
+ detail::outerr(actions.current_file->path)
+ << "Unknown version: "
+ << major_verison
+ << "."
+ << minor_verison
+ << std::endl;
+ ++actions.error_count;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ std::string pre(quickbook::actions& actions, parse_iterator pos,
+ value include_doc_id, bool nested_file)
     {
         // The doc_info in the file has been parsed. Here's what we'll do
         // *before* anything else.
+ //
+ // If there isn't a doc info block, then values will be empty, so most
+ // of the following code won't actually do anything.
 
         value_consumer values = actions.values.release();
 
         // Skip over invalid attributes
 
         while (values.check(value::default_tag)) values.consume();
-
- value qbk_version = values.optional_consume(doc_info_tags::qbk_version);
-
+
+ bool use_doc_info = false;
+ std::string doc_type;
         value doc_title;
- if (values.check())
+
+ if (values.check(doc_info_tags::type))
         {
- actions.doc_type = values.consume(doc_info_tags::type).get_quickbook();
+ doc_type = values.consume(doc_info_tags::type).get_quickbook();
             doc_title = values.consume(doc_info_tags::title);
- actions.doc_title_qbk = doc_title.get_quickbook();
+ use_doc_info = !nested_file || qbk_version_n >= 106u;
+ }
+ else
+ {
+ if (!nested_file)
+ {
+ detail::outerr(actions.current_file, pos.base())
+ << "No doc_info block."
+ << std::endl;
+
+ ++actions.error_count;
+
+ // Create a fake document info block in order to continue.
+ doc_type = "article";
+ doc_title = qbk_value(actions.current_file,
+ pos.base(), pos.base(),
+ doc_info_tags::type);
+ use_doc_info = true;
+ }
         }
 
         std::vector<std::string> duplicates;
 
- value id = consume_last_single(values, doc_info_attributes::id, &duplicates);
- value dirname = consume_last_single(values, doc_info_attributes::dirname, &duplicates);
- value last_revision = consume_last_single(values, doc_info_attributes::last_revision, &duplicates);
- value purpose = consume_last_single(values, doc_info_attributes::purpose, &duplicates);
- std::vector<value> categories = consume_multiple(values, doc_info_attributes::category);
- value lang = consume_last_single(values, doc_info_attributes::lang, &duplicates);
- value version = consume_last_single(values, doc_info_attributes::version, &duplicates);
- std::vector<value> authors = consume_multiple(values, doc_info_attributes::authors);
- std::vector<value> copyrights = consume_multiple(values, doc_info_attributes::copyright);
- value license = consume_last_single(values, doc_info_attributes::license, &duplicates);
- std::vector<value> biblioids = consume_multiple(values, doc_info_attributes::biblioid);
-
- // Skip over source-mode tags (already dealt with)
-
- while (values.check(doc_info_attributes::source_mode)) values.consume();
+ value qbk_version = consume_list(values, doc_attributes::qbk_version, &duplicates);
+ value compatibility_mode = consume_list(values, doc_attributes::compatibility_mode, &duplicates);
+ consume_multiple_lists(values, doc_attributes::source_mode);
+
+ value id = consume_value_in_list(values, doc_info_attributes::id, &duplicates);
+ value dirname = consume_value_in_list(values, doc_info_attributes::dirname, &duplicates);
+ value last_revision = consume_value_in_list(values, doc_info_attributes::last_revision, &duplicates);
+ value purpose = consume_value_in_list(values, doc_info_attributes::purpose, &duplicates);
+ std::vector<value> categories = consume_multiple_lists(values, doc_info_attributes::category);
+ value lang = consume_value_in_list(values, doc_info_attributes::lang, &duplicates);
+ value version = consume_value_in_list(values, doc_info_attributes::version, &duplicates);
+ std::vector<value> authors = consume_multiple_lists(values, doc_info_attributes::authors);
+ std::vector<value> copyrights = consume_multiple_lists(values, doc_info_attributes::copyright);
+ value license = consume_value_in_list(values, doc_info_attributes::license, &duplicates);
+ std::vector<value> biblioids = consume_multiple_lists(values, doc_info_attributes::biblioid);
+ value xmlbase = consume_value_in_list(values, doc_info_attributes::xmlbase, &duplicates);
 
         values.finish();
 
         if(!duplicates.empty())
         {
- detail::outwarn(actions.filename,1)
+ detail::outwarn(actions.current_file->path)
                 << (duplicates.size() > 1 ?
                     "Duplicate attributes" : "Duplicate attribute")
                 << ":" << detail::utf8(boost::algorithm::join(duplicates, ", "))
@@ -120,91 +193,79 @@
                 ;
         }
 
- bool generated_id = false;
+ std::string include_doc_id_, id_;
 
+ if (!include_doc_id.empty())
+ include_doc_id_ = include_doc_id.get_quickbook();
         if (!id.empty())
- actions.doc_id = id.get_quickbook();
+ id_ = id.get_quickbook();
 
- if (actions.doc_id.empty())
- {
- actions.doc_id = detail::make_identifier(actions.doc_title_qbk);
- generated_id = true;
- }
+ // Quickbook version
 
- if (dirname.empty() && actions.doc_type == "library") {
- if (!id.empty()) {
- dirname = id;
- }
- else {
- dirname = qbk_bbk_value(actions.doc_id, doc_info_attributes::dirname);
- }
- }
+ unsigned new_version = get_version(actions, use_doc_info, qbk_version);
 
- if (last_revision.empty())
+ if (new_version != qbk_version_n && new_version == 106)
         {
- // default value for last-revision is now
-
- char strdate[64];
- strftime(
- strdate, sizeof(strdate),
- (debug_mode ?
- "DEBUG MODE Date: %Y/%m/%d %H:%M:%S $" :
- "$" /* prevent CVS substitution */ "Date: %Y/%m/%d %H:%M:%S $"),
- current_gm_time
- );
- last_revision = qbk_bbk_value(strdate, doc_info_attributes::last_revision);
+ detail::outwarn(actions.current_file->path)
+ << "Quickbook 1.6 is still under development and is "
+ "likely to change in the future." << std::endl;
         }
 
- // if we're ignoring the document info, we're done.
- if (ignore_docinfo)
- {
- return;
+ if (new_version) {
+ qbk_version_n = new_version;
         }
-
- // Quickbook version
-
- int qbk_major_version, qbk_minor_version;
-
- if (qbk_version.empty())
- {
+ else if (use_doc_info) {
             // hard code quickbook version to v1.1
- qbk_major_version = 1;
- qbk_minor_version = 1;
- detail::outwarn(actions.filename,1)
+ qbk_version_n = 101;
+ detail::outwarn(actions.current_file, pos.base())
                 << "Quickbook version undefined. "
                 "Version 1.1 is assumed" << std::endl;
         }
- else
- {
- value_consumer qbk_version_values(qbk_version);
- qbk_major_version = qbk_version_values.consume().get_int();
- qbk_minor_version = qbk_version_values.consume().get_int();
- qbk_version_values.finish();
+
+ actions.current_file->version(qbk_version_n);
+
+ // Compatibility Version
+
+ unsigned compatibility_version =
+ get_version(actions, use_doc_info, compatibility_mode);
+
+ if (!compatibility_version) {
+ compatibility_version = use_doc_info ?
+ qbk_version_n : actions.ids.compatibility_version();
         }
-
- qbk_version_n = ((unsigned) qbk_major_version * 100) +
- (unsigned) qbk_minor_version;
 
- if (qbk_version_n == 106)
+ // Start file, finish here if not generating document info.
+
+ if (!use_doc_info)
         {
- detail::outwarn(actions.filename,1)
- << "Quickbook 1.6 is still under development and is "
- "likely to change in the future." << std::endl;
+ actions.ids.start_file(compatibility_version, include_doc_id_, id_,
+ doc_title);
+ return "";
         }
- else if(qbk_version_n < 100 || qbk_version_n > 106)
+
+ std::string id_placeholder =
+ actions.ids.start_file_with_docinfo(
+ compatibility_version, include_doc_id_, id_, doc_title);
+
+ // Make sure we really did have a document info block.
+
+ assert(doc_title.check() && !doc_type.empty());
+
+ // Set xmlbase
+
+ std::string xmlbase_value;
+
+ if (!xmlbase.empty())
         {
- detail::outerr(actions.filename,1)
- << "Unknown version of quickbook: quickbook "
- << qbk_major_version
- << "."
- << qbk_minor_version
- << std::endl;
- ++actions.error_count;
+ xinclude_path x = calculate_xinclude_path(xmlbase, actions);
+
+ xmlbase_value = x.uri;
+ actions.xinclude_base = x.path;
         }
 
         // Warn about invalid fields
 
- if (actions.doc_type != "library")
+ if (doc_type != "library")
         {
             std::vector<std::string> invalid_attributes;
 
@@ -219,10 +280,10 @@
 
             if(!invalid_attributes.empty())
             {
- detail::outwarn(actions.filename,1)
+ detail::outwarn(actions.current_file->path)
                     << (invalid_attributes.size() > 1 ?
                         "Invalid attributes" : "Invalid attribute")
- << " for '" << detail::utf8(actions.doc_type) << " document info': "
+ << " for '" << detail::utf8(doc_type) << " document info': "
                     << detail::utf8(boost::algorithm::join(invalid_attributes, ", "))
                     << "\n"
                     ;
@@ -231,40 +292,88 @@
 
         // Write out header
 
- out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- << "<!DOCTYPE "
- << actions.doc_type
- << " PUBLIC \"-//Boost//DTD BoostBook XML V1.0//EN\"\n"
- << " \"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd\">\n"
- << '<' << actions.doc_type << "\n"
+ if (!nested_file)
+ {
+ actions.out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ << "<!DOCTYPE "
+ << doc_type
+ << " PUBLIC \"-//Boost//DTD BoostBook XML V1.0//EN\"\n"
+ << " \"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd\">\n"
+ ;
+ }
+
+ actions.out << '<' << doc_type << "\n"
             << " id=\""
- << actions.ids.add(actions.doc_id, generated_id ?
- id_generator::generated_doc : id_generator::explicit_id)
+ << id_placeholder
             << "\"\n";
-
+
         if(!lang.empty())
         {
- out << " lang=\""
+ actions.out << " lang=\""
                 << doc_info_output(lang, 106)
                 << "\"\n";
         }
 
- if(actions.doc_type == "library")
+ if(doc_type == "library" && !doc_title.empty())
+ {
+ actions.out << " name=\"" << doc_info_output(doc_title, 106) << "\"\n";
+ }
+
+ // Set defaults for dirname + last_revision
+
+ if (!dirname.empty() || doc_type == "library")
+ {
+ actions.out << " dirname=\"";
+ if (!dirname.empty()) {
+ actions.out << doc_info_output(dirname, 106);
+ }
+ else if (!id_.empty()) {
+ actions.out << id_;
+ }
+ else if (!include_doc_id_.empty()) {
+ actions.out << include_doc_id_;
+ }
+ else if (!doc_title.empty()) {
+ actions.out << detail::make_identifier(doc_title.get_quickbook());
+ }
+ else {
+ actions.out << "library";
+ }
+
+ actions.out << "\"\n";
+ }
+
+ actions.out << " last-revision=\"";
+ if (!last_revision.empty())
+ {
+ actions.out << doc_info_output(last_revision, 106);
+ }
+ else
         {
- out << " name=\"" << doc_info_output(doc_title, 106) << "\"\n";
+ // default value for last-revision is now
+
+ char strdate[64];
+ strftime(
+ strdate, sizeof(strdate),
+ (debug_mode ?
+ "DEBUG MODE Date: %Y/%m/%d %H:%M:%S $" :
+ "$" /* prevent CVS substitution */ "Date: %Y/%m/%d %H:%M:%S $"),
+ current_gm_time
+ );
+
+ actions.out << strdate;
         }
 
- if(!dirname.empty())
+ actions.out << "\" \n";
+
+ if (!xmlbase.empty())
         {
- out << " dirname=\""
- << doc_info_output(dirname, 106)
+ actions.out << " xml:base=\""
+ << xmlbase_value
                 << "\"\n";
         }
 
- out << " last-revision=\""
- << doc_info_output(last_revision, 106)
- << "\" \n"
- << " xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n";
+ actions.out << " xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n";
 
         std::ostringstream tmp;
 
@@ -298,7 +407,8 @@
     
                 while(copyright.check(doc_info_tags::copyright_year))
                 {
- int year_start = copyright.consume().get_int();
+ value year_start_value = copyright.consume();
+ int year_start = year_start_value.get_int();
                     int year_end =
                         copyright.check(doc_info_tags::copyright_year_end) ?
                         copyright.consume().get_int() :
@@ -307,8 +417,7 @@
                     if (year_end < year_start) {
                         ++actions.error_count;
     
- detail::outerr(actions.filename,
- copyright.begin()->get_position().line)
+ detail::outerr(actions.current_file, copyright.begin()->get_position())
                             << "Invalid year range: "
                             << year_start
                             << "-"
@@ -333,8 +442,7 @@
         if (!license.empty())
         {
             tmp << " <legalnotice id=\""
- << actions.ids.add(actions.doc_id + ".legal",
- id_generator::generated)
+ << actions.ids.add_id("legal", id_category::generated)
                 << "\">\n"
                 << " <para>\n"
                 << " " << doc_info_output(license, 103) << "\n"
@@ -346,9 +454,9 @@
 
         if (!purpose.empty())
         {
- tmp << " <" << actions.doc_type << "purpose>\n"
+ tmp << " <" << doc_type << "purpose>\n"
                 << " " << doc_info_output(purpose, 103)
- << " </" << actions.doc_type << "purpose>\n"
+ << " </" << doc_type << "purpose>\n"
                 << "\n"
                 ;
         }
@@ -356,9 +464,9 @@
         BOOST_FOREACH(value_consumer values, categories) {
             value category = values.optional_consume();
             if(!category.empty()) {
- tmp << " <" << actions.doc_type << "category name=\"category:"
+ tmp << " <" << doc_type << "category name=\"category:"
                     << doc_info_output(category, 106)
- << "\"></" << actions.doc_type << "category>\n"
+ << "\"></" << doc_type << "category>\n"
                     << "\n"
                 ;
             }
@@ -380,50 +488,46 @@
             biblioid.finish();
         }
 
- if(actions.doc_type != "library") {
- write_document_title(out, doc_title, version);
+ if(doc_type != "library") {
+ write_document_title(actions.out, doc_title, version);
         }
 
         std::string docinfo = tmp.str();
         if(!docinfo.empty())
         {
- out << " <" << actions.doc_type << "info>\n"
+ actions.out << " <" << doc_type << "info>\n"
                 << docinfo
- << " </" << actions.doc_type << "info>\n"
+ << " </" << doc_type << "info>\n"
                 << "\n"
             ;
         }
 
- if(actions.doc_type == "library") {
- write_document_title(out, doc_title, version);
+ if(doc_type == "library") {
+ write_document_title(actions.out, doc_title, version);
         }
+
+ return doc_type;
     }
-
- void post(collector& out, quickbook::actions& actions, bool ignore_docinfo)
+
+ void post(quickbook::actions& actions, std::string const& doc_type)
     {
- // if we're ignoring the document info, do nothing.
- if (ignore_docinfo)
- {
- return;
- }
+ // We've finished generating our output. Here's what we'll do
+ // *after* everything else.
 
         // Close any open sections.
- if (actions.section_level != 0) {
- detail::outwarn(actions.filename)
+ if (!doc_type.empty() && actions.ids.section_level() > 1) {
+ detail::outwarn(actions.current_file->path)
                 << "Missing [endsect] detected at end of file."
                 << std::endl;
 
- while(actions.section_level > 0) {
- out << "</section>";
- --actions.section_level;
+ while(actions.ids.section_level() > 1) {
+ actions.out << "</section>";
+ actions.ids.end_section();
             }
-
- actions.qualified_section_id.clear();
         }
 
- // We've finished generating our output. Here's what we'll do
- // *after* everything else.
- out << "\n</" << actions.doc_type << ">\n\n";
+ actions.ids.end_file();
+ if (!doc_type.empty()) actions.out << "\n</" << doc_type << ">\n\n";
     }
 
     static void write_document_title(collector& out, value const& title, value const& version)

Modified: trunk/tools/quickbook/src/doc_info_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/doc_info_grammar.cpp (original)
+++ trunk/tools/quickbook/src/doc_info_grammar.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -17,6 +17,7 @@
 #include <boost/spirit/include/classic_chset.hpp>
 #include <boost/spirit/include/classic_numerics.hpp>
 #include <boost/spirit/include/phoenix1_primitives.hpp>
+#include <boost/spirit/include/phoenix1_operators.hpp>
 #include "grammar_impl.hpp"
 #include "actions_class.hpp"
 #include "doc_info_tags.hpp"
@@ -58,7 +59,7 @@
                 : l(l)
             {}
 
- void operator()(iterator, iterator) const {
+ void operator()(parse_iterator, parse_iterator) const {
                 l.attribute_rule = l.doc_fallback;
                 l.attribute_tag = value::default_tag;
             }
@@ -67,24 +68,28 @@
         };
 
         cl::rule<scanner>
+ doc_info_block, doc_attribute, doc_info_attribute,
                         doc_title, doc_simple, doc_phrase, doc_fallback,
                         doc_authors, doc_author,
                         doc_copyright, doc_copyright_holder,
- doc_source_mode, doc_biblioid,
+ doc_source_mode, doc_biblioid, doc_compatibility_mode,
                         quickbook_version, char_;
         cl::uint_parser<int, 10, 4, 4> doc_copyright_year;
         cl::symbols<> doc_types;
+ cl::symbols<value::tag_type> doc_info_attributes;
         cl::symbols<value::tag_type> doc_attributes;
         std::map<value::tag_type, cl::rule<scanner>* > attribute_rules;
         value::tag_type attribute_tag;
         cl::rule<scanner> attribute_rule;
         assign_attribute_type assign_attribute;
         fallback_attribute_type fallback_attribute;
-
+
         doc_info_grammar_local()
             : assign_attribute(*this)
             , fallback_attribute(*this)
         {}
+
+ bool source_mode_unset;
     };
 
     void quickbook_grammar::impl::init_doc_info()
@@ -100,70 +105,122 @@
           , "reference", "set"
         ;
 
+ BOOST_FOREACH(value::tag_type t, doc_attributes::tags()) {
+ local.doc_attributes.add(doc_attributes::name(t), t);
+ local.doc_info_attributes.add(doc_attributes::name(t), t);
+ }
+
         BOOST_FOREACH(value::tag_type t, doc_info_attributes::tags()) {
- local.doc_attributes.add(doc_info_attributes::name(t), t);
+ local.doc_info_attributes.add(doc_info_attributes::name(t), t);
         }
         
         doc_info_details =
- space
- >> '[' >> space
- >> (local.doc_types >> cl::eps_p)
- [actions.values.reset()]
+ space [ph::var(local.source_mode_unset) = true]
+ >> *( local.doc_attribute
+ >> space
+ )
+ >> !local.doc_info_block
+ ;
+
+ local.doc_info_block =
+ '['
+ >> space
+ >> (local.doc_types >> cl::eps_p)
                                             [actions.values.entry(ph::arg1, ph::arg2, doc_info_tags::type)]
- >> hard_space
- >> ( *(~cl::eps_p(cl::ch_p('[') | ']' | cl::eol_p) >> local.char_)
- ) [actions.docinfo_value(ph::arg1, ph::arg2, doc_info_tags::title)]
- >> !(
- space >> '[' >>
- local.quickbook_version
- >> space >> ']'
+ >> hard_space
+ >> actions.to_value(doc_info_tags::title)
+ [ *( ~cl::eps_p(blank >> (cl::ch_p('[') | ']' | cl::eol_p))
+ >> local.char_
+ )
+ // Include 'blank' here so that it will be included in
+ // id generation.
+ >> blank
+ ]
+ >> space
+ >> !(qbk_since(106u) >> cl::eps_p(ph::var(local.source_mode_unset))
+ [cl::assign_a(actions.source_mode, "c++")]
                 )
- >> *(
- space
- >> '['
+ >> (*( local.doc_info_attribute
>> space
- >> ( local.doc_attributes
+ )) [actions.values.sort()]
+ >> ( ']'
+ >> (+eol | cl::end_p)
+ | cl::eps_p [actions.error]
+ )
+ ;
+
+ local.doc_attribute =
+ '['
+ >> space
+ >> local.doc_attributes [local.assign_attribute]
+ >> hard_space
+ >> actions.values.list(ph::var(local.attribute_tag))
+ [ cl::eps_p [actions.values.entry(ph::arg1, ph::arg2, doc_info_tags::before_docinfo)]
+ >> local.attribute_rule
+ ]
+ >> space
+ >> ']'
+ ;
+
+ local.doc_info_attribute =
+ '['
+ >> space
+ >> ( local.doc_info_attributes
                                             [local.assign_attribute]
- | (+(cl::alnum_p | '_' | '-'))
+ | (+(cl::alnum_p | '_' | '-'))
                                             [local.fallback_attribute]
                                             [actions.error("Unrecognized document attribute: '%s'.")]
- )
- >> hard_space
- >> actions.values.list(ph::var(local.attribute_tag))
- [local.attribute_rule]
- >> space
- >> ']'
- >> +cl::eol_p
                 )
- >> space [actions.values.sort()]
+ >> hard_space
+ >> actions.values.list(ph::var(local.attribute_tag))
+ [local.attribute_rule]
+ >> space
>> ']'
- >> +cl::eol_p
             ;
 
+ local.doc_fallback = actions.to_value() [
+ *(~cl::eps_p(']') >> local.char_)
+ ];
+
+ // Document Attributes
+
         local.quickbook_version =
- actions.values.list(doc_info_tags::qbk_version)
- [ "quickbook"
- >> hard_space
- >> ( cl::uint_p [actions.values.entry(ph::arg1)]
- >> '.'
- >> uint2_t() [actions.values.entry(ph::arg1)]
- )
- ]
+ cl::uint_p [actions.values.entry(ph::arg1)]
+ >> '.'
+ >> uint2_t() [actions.values.entry(ph::arg1)]
+ ;
+
+ local.attribute_rules[doc_attributes::qbk_version] = &local.quickbook_version;
+
+ local.doc_compatibility_mode =
+ cl::uint_p [actions.values.entry(ph::arg1)]
+ >> '.'
+ >> uint2_t() [actions.values.entry(ph::arg1)]
             ;
 
- // TODO: Clear phrase afterwards?
+ local.attribute_rules[doc_attributes::compatibility_mode] = &local.doc_compatibility_mode;
+
+ local.doc_source_mode =
+ (
+ cl::str_p("c++")
+ | "python"
+ | "teletype"
+ ) [cl::assign_a(actions.source_mode)]
+ [ph::var(local.source_mode_unset) = false]
+ ;
 
- local.doc_fallback = (*(~cl::eps_p(']') >> local.char_));
+ local.attribute_rules[doc_attributes::source_mode] = &local.doc_source_mode;
 
- // TODO: Restrictions on doc_id and doc_dirname?
+ // Document Info Attributes
 
- local.doc_simple = (*(~cl::eps_p(']') >> local.char_)) [actions.docinfo_value(ph::arg1, ph::arg2)];
+ local.doc_simple = actions.to_value() [*(~cl::eps_p(']') >> local.char_)];
         local.attribute_rules[doc_info_attributes::version] = &local.doc_simple;
         local.attribute_rules[doc_info_attributes::id] = &local.doc_simple;
         local.attribute_rules[doc_info_attributes::dirname] = &local.doc_simple;
         local.attribute_rules[doc_info_attributes::category] = &local.doc_simple;
         local.attribute_rules[doc_info_attributes::last_revision] = &local.doc_simple;
         local.attribute_rules[doc_info_attributes::lang] = &local.doc_simple;
+ local.attribute_rules[doc_info_attributes::xmlbase] = &local.doc_simple;
 
         local.doc_copyright_holder
             = *( ~cl::eps_p
@@ -186,7 +243,7 @@
>> !cl::ch_p(',')
>> space
                 )
- >> local.doc_copyright_holder [actions.docinfo_value(ph::arg1, ph::arg2, doc_info_tags::copyright_name)]
+ >> actions.to_value(doc_info_tags::copyright_name) [ local.doc_copyright_holder ]
>> !cl::ch_p(',')
>> space
             )
@@ -194,18 +251,18 @@
 
         local.attribute_rules[doc_info_attributes::copyright] = &local.doc_copyright;
 
- local.doc_phrase = simple_phrase [actions.docinfo_value(ph::arg1, ph::arg2)];
+ local.doc_phrase = actions.to_value() [ nested_phrase ];
         local.attribute_rules[doc_info_attributes::purpose] = &local.doc_phrase;
         local.attribute_rules[doc_info_attributes::license] = &local.doc_phrase;
 
         local.doc_author =
                 '['
>> space
- >> (*(~cl::eps_p(',') >> local.char_))
- [actions.docinfo_value(ph::arg1, ph::arg2, doc_info_tags::author_surname)]
+ >> actions.to_value(doc_info_tags::author_surname)
+ [*(~cl::eps_p(',') >> local.char_)]
>> ',' >> space
- >> (*(~cl::eps_p(']') >> local.char_))
- [actions.docinfo_value(ph::arg1, ph::arg2, doc_info_tags::author_first)]
+ >> actions.to_value(doc_info_tags::author_first)
+ [*(~cl::eps_p(']') >> local.char_)]
>> ']'
             ;
 
@@ -218,42 +275,15 @@
 
         local.attribute_rules[doc_info_attributes::authors] = &local.doc_authors;
 
- local.doc_source_mode =
- (
- cl::str_p("c++")
- | "python"
- | "teletype"
- ) [cl::assign_a(actions.source_mode)]
- ;
-
- local.attribute_rules[doc_info_attributes::source_mode] = &local.doc_source_mode;
-
         local.doc_biblioid =
                 (+cl::alnum_p) [actions.values.entry(ph::arg1, ph::arg2, doc_info_tags::biblioid_class)]
>> hard_space
- >> (+(~cl::eps_p(']') >> local.char_))
- [actions.docinfo_value(ph::arg1, ph::arg2, doc_info_tags::biblioid_value)]
+ >> actions.to_value(doc_info_tags::biblioid_value)
+ [+(~cl::eps_p(']') >> local.char_)]
             ;
 
         local.attribute_rules[doc_info_attributes::biblioid] = &local.doc_biblioid;
 
- local.char_ =
- cl::str_p("\\n") [actions.break_]
- | "\\ " // ignore an escaped space
- | '\\' >> cl::punct_p [actions.plain_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.values.save()
- [ (*(cl::anychar_p - "'''"))
- [actions.values.entry(ph::arg1, ph::arg2, phrase_tags::escape)]
- >> cl::str_p("'''") [actions.element]
- ]
- | cl::anychar_p [actions.plain_char]
- ;
+ local.char_ = escape | cl::anychar_p[actions.plain_char];
     }
 }

Modified: trunk/tools/quickbook/src/doc_info_tags.hpp
==============================================================================
--- trunk/tools/quickbook/src/doc_info_tags.hpp (original)
+++ trunk/tools/quickbook/src/doc_info_tags.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -14,7 +14,7 @@
 namespace quickbook
 {
     QUICKBOOK_VALUE_TAGS(doc_info_tags, 0x400,
- (qbk_version)
+ (before_docinfo)
         (type)
         (title)
         (author_surname)(author_first)
@@ -23,6 +23,12 @@
         (biblioid_class)(biblioid_value)
     )
 
+ QUICKBOOK_VALUE_NAMED_TAGS(doc_attributes, 0x440,
+ ((qbk_version)("quickbook"))
+ ((compatibility_mode)("compatibility-mode"))
+ ((source_mode)("source-mode"))
+ )
+
     QUICKBOOK_VALUE_NAMED_TAGS(doc_info_attributes, 0x450,
         ((id)("id"))
         ((dirname)("dirname"))
@@ -35,7 +41,7 @@
         ((copyright)("copyright"))
         ((license)("license"))
         ((biblioid)("biblioid"))
- ((source_mode)("source-mode"))
+ ((xmlbase)("xmlbase"))
     )
 }
 

Modified: trunk/tools/quickbook/src/fwd.hpp
==============================================================================
--- trunk/tools/quickbook/src/fwd.hpp (original)
+++ trunk/tools/quickbook/src/fwd.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -12,15 +12,20 @@
 #define BOOST_SPIRIT_FWD_HPP
 
 #include "iterator.hpp"
+#include <boost/intrusive_ptr.hpp>
 
 namespace quickbook
 {
     struct actions;
     struct quickbook_grammar;
     struct collector;
- struct id_generator;
+ struct id_manager;
+ struct section_info;
+ struct file;
+ typedef boost::intrusive_ptr<file> file_ptr;
 
- typedef position_iterator<std::string::const_iterator> iterator;
+ typedef std::string::const_iterator string_iterator;
+ typedef lookback_iterator<string_iterator> parse_iterator;
 
     inline void ignore_variable(void const*) {}
 }

Modified: trunk/tools/quickbook/src/grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/grammar.cpp (original)
+++ trunk/tools/quickbook/src/grammar.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -16,10 +16,9 @@
    quickbook_grammar::quickbook_grammar(quickbook::actions& a)
         : impl_(new impl(a))
         , command_line_macro(impl_->command_line, "command_line_macro")
- , common(impl_->common, "phrase")
- , simple_phrase(impl_->simple_phrase, "simple_phrase")
+ , inline_phrase(impl_->inline_phrase, "inline_phrase")
+ , phrase(impl_->phrase_start, "phrase")
         , block(impl_->block_start, "block")
- , block_skip_initial_spaces(impl_->block_skip_initial_spaces, "block")
         , doc_info(impl_->doc_info_details, "doc_info")
     {
     }

Modified: trunk/tools/quickbook/src/grammar.hpp
==============================================================================
--- trunk/tools/quickbook/src/grammar.hpp (original)
+++ trunk/tools/quickbook/src/grammar.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -21,9 +21,14 @@
     // spirit implementation detail, but since classic is no longer under
     // development, it won't change. And spirit 2 won't require such a hack.
 
- typedef cl::scanner<iterator, cl::scanner_policies <
+ typedef cl::scanner<parse_iterator, cl::scanner_policies <
         cl::iteration_policy, cl::match_policy, cl::action_policy> > scanner;
 
+ template <typename Scanner>
+ struct Scanner_must_be_the_quickbook_scanner_typedef;
+ template <>
+ struct Scanner_must_be_the_quickbook_scanner_typedef<scanner> {};
+
     struct grammar
         : public cl::grammar<grammar>
     {
@@ -31,14 +36,12 @@
             : start_rule(start_rule) {}
 
         template <typename Scanner>
- struct definition {
- // TODO: Statically assert that Scanner == scanner.
-
+ struct definition :
+ Scanner_must_be_the_quickbook_scanner_typedef<Scanner>
+ {
             definition(grammar const& self) : start_rule(self.start_rule) {}
-
- cl::rule<Scanner> const& start() const { return start_rule; }
-
- cl::rule<Scanner> const& start_rule;
+ cl::rule<scanner> const& start() const { return start_rule; }
+ cl::rule<scanner> const& start_rule;
         };
 
         cl::rule<scanner> const& start_rule;
@@ -54,10 +57,9 @@
 
     public:
         grammar command_line_macro;
- grammar common;
- grammar simple_phrase;
+ grammar inline_phrase;
+ grammar phrase;
         grammar block;
- grammar block_skip_initial_spaces;
         grammar doc_info;
 
         quickbook_grammar(quickbook::actions&);

Modified: trunk/tools/quickbook/src/grammar_impl.hpp
==============================================================================
--- trunk/tools/quickbook/src/grammar_impl.hpp (original)
+++ trunk/tools/quickbook/src/grammar_impl.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -22,19 +22,23 @@
 
     struct element_info
     {
- enum context {
- in_block = 1,
- in_phrase = 2,
- in_conditional = 4,
- in_nested_block = 8
- };
-
         enum type_enum {
             nothing = 0,
- block = in_block,
- conditional_or_block = block | in_conditional,
- nested_block = conditional_or_block | in_nested_block,
- phrase = nested_block | in_phrase
+ block = 1,
+ conditional_or_block = 2,
+ nested_block = 4,
+ phrase = 8,
+ maybe_block = 16
+ };
+
+ enum context {
+ in_phrase = phrase | maybe_block,
+ in_nested_block = phrase | maybe_block | nested_block,
+ in_conditional = phrase | maybe_block | nested_block | conditional_or_block,
+ in_block = phrase | maybe_block | nested_block | conditional_or_block | block,
+ only_nested_block = nested_block,
+ only_block = nested_block | conditional_or_block | block,
+ only_contextual_block = maybe_block | nested_block | conditional_or_block | block
         };
 
         element_info()
@@ -60,13 +64,17 @@
 
         // Main Grammar
         cl::rule<scanner> block_start;
- cl::rule<scanner> block_skip_initial_spaces;
- cl::rule<scanner> common;
- cl::rule<scanner> simple_phrase;
- cl::rule<scanner> phrase;
+ cl::rule<scanner> phrase_start;
+ cl::rule<scanner> nested_phrase;
+ cl::rule<scanner> inline_phrase;
+ cl::rule<scanner> paragraph_phrase;
         cl::rule<scanner> extended_phrase;
+ cl::rule<scanner> table_title_phrase;
+ cl::rule<scanner> inside_preformatted;
         cl::rule<scanner> inside_paragraph;
         cl::rule<scanner> command_line;
+ cl::rule<scanner> escape;
+ cl::rule<scanner> raw_escape;
 
         // Miscellaneous stuff
         cl::rule<scanner> hard_space;
@@ -75,6 +83,7 @@
         cl::rule<scanner> eol;
         cl::rule<scanner> phrase_end;
         cl::rule<scanner> comment;
+ cl::rule<scanner> line_comment;
         cl::rule<scanner> macro_identifier;
 
         // Element Symbols

Deleted: trunk/tools/quickbook/src/id_generator.hpp
==============================================================================
--- trunk/tools/quickbook/src/id_generator.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,113 +0,0 @@
-/*=============================================================================
- Copyright (c) 2011 Daniel James
-
- 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_QUICKBOOK_ID_GENERATOR_HPP)
-#define BOOST_QUICKBOOK_ID_GENERATOR_HPP
-
-#include "fwd.hpp"
-#include <boost/unordered/unordered_map.hpp>
-#include <boost/shared_ptr.hpp>
-#include <deque>
-#include <string>
-
-namespace quickbook
-{
- struct string_ref;
-
- struct id_generator
- {
- public:
-
- enum categories
- {
- explicit_id = 0, // Explicitly given by user
- generated_doc, // Generated ids for document.
- generated_section, // Generated ids for sections.
- generated_heading, // Generated ids for headings.
- generated, // Generated ids for other elements.
- numbered, // Just used to avoid random docbook ids
- default_category
- };
-
- private:
-
- struct placeholder_id;
- struct id_data;
- struct id_generation_data;
-
- struct placeholder_id
- {
- placeholder_id(id_generator::categories category, id_data* data)
- : category(category),
- data(data),
- final_id() {}
-
- id_generator::categories category;
- id_data* data;
- std::string final_id;
-
- };
-
- struct id_data
- {
- id_data(std::string const& name,
- id_generator::categories category,
- bool used = false)
- : name(name),
- category(category),
- used(used),
- generation_data() {}
-
- std::string name;
- id_generator::categories category;
- bool used;
- boost::shared_ptr<id_generation_data> generation_data;
- };
-
- struct id_generation_data
- {
- id_generation_data(std::string const& parent, std::string const& base)
- : parent(parent),
- base(base),
- needs_underscore(false),
- count(0)
- {
- new_base_value();
- }
-
- void new_base_value();
-
- std::string parent;
- std::string base;
- bool needs_underscore;
- int count;
- };
-
- boost::unordered_map<std::string, id_data> ids;
- std::deque<placeholder_id> placeholders;
-
- public:
- id_generator();
- ~id_generator();
-
- std::string add(std::string const& id, categories priority);
-
- std::string replace_placeholders(std::string const&);
- string_ref get(string_ref placeholder);
-
- private:
- id_generator(id_generator const&);
- id_generator& operator=(id_generator const&);
-
- void generate_id(placeholder_id*);
- bool try_potential_id(placeholder_id*);
- bool try_counted_id(placeholder_id*);
- };
-}
-
-#endif
\ No newline at end of file

Modified: trunk/tools/quickbook/src/input_path.cpp
==============================================================================
--- trunk/tools/quickbook/src/input_path.cpp (original)
+++ trunk/tools/quickbook/src/input_path.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -10,6 +10,7 @@
 #include <iostream>
 #include "input_path.hpp"
 #include "utils.hpp"
+#include "files.hpp"
 
 #if QUICKBOOK_WIDE_PATHS || QUICKBOOK_WIDE_STREAMS
 #include <boost/scoped_ptr.hpp>
@@ -112,13 +113,13 @@
         if (size < 0)
             throw conversion_error("Error converting cygwin path to windows.");
 
- // TODO: size is in bytes.
- boost::scoped_array<wchar_t> result(new wchar_t[size]);
+ boost::scoped_array<char> result(new char[size]);
+ void* ptr = result.get();
 
- if(cygwin_conv_path(flags, path.c_str(), result.get(), size))
+ if(cygwin_conv_path(flags, path.c_str(), ptr, size))
             throw conversion_error("Error converting cygwin path to windows.");
 
- return fs::path(result.get());
+ return fs::path(static_cast<wchar_t*>(ptr));
     }
     
     stream_string path_to_stream(fs::path const& path)
@@ -229,6 +230,11 @@
         }
     }
 
+ ostream& outerr(file_ptr const& f, string_iterator pos)
+ {
+ return outerr(f->path, f->position_of(pos).line);
+ }
+
     ostream& outwarn(fs::path const& file, int line)
     {
         if (line >= 0)
@@ -243,4 +249,9 @@
             return error_stream() << path_to_stream(file) << ": warning: ";
         }
     }
+
+ ostream& outwarn(file_ptr const& f, string_iterator pos)
+ {
+ return outwarn(f->path, f->position_of(pos).line);
+ }
 }}

Modified: trunk/tools/quickbook/src/input_path.hpp
==============================================================================
--- trunk/tools/quickbook/src/input_path.hpp (original)
+++ trunk/tools/quickbook/src/input_path.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -14,6 +14,7 @@
 #include <string>
 #include <stdexcept>
 #include <iostream>
+#include "fwd.hpp"
 
 #if defined(__cygwin__) || defined(__CYGWIN__)
 # define QUICKBOOK_CYGWIN_PATHS 1
@@ -91,6 +92,8 @@
         ostream& outerr();
         ostream& outerr(fs::path const& file, int line = -1);
         ostream& outwarn(fs::path const& file, int line = -1);
+ ostream& outerr(file_ptr const&, string_iterator);
+ ostream& outwarn(file_ptr const&, string_iterator);
         
         struct utf8_proxy
         {

Modified: trunk/tools/quickbook/src/iterator.hpp
==============================================================================
--- trunk/tools/quickbook/src/iterator.hpp (original)
+++ trunk/tools/quickbook/src/iterator.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -16,59 +16,30 @@
 
 namespace quickbook
 {
- struct file_position
- {
- file_position() : line(1), column(1) {}
- file_position(int l, int c) : line(l), column(c) {}
-
- int line;
- int column;
- };
-
     template <typename Iterator>
- struct position_iterator
+ struct lookback_iterator
         : boost::forward_iterator_helper<
- position_iterator<Iterator>,
+ lookback_iterator<Iterator>,
             typename boost::iterator_value<Iterator>::type,
             typename boost::iterator_difference<Iterator>::type,
             typename boost::iterator_pointer<Iterator>::type,
             typename boost::iterator_reference<Iterator>::type
>
     {
- position_iterator() {}
- explicit position_iterator(Iterator base)
- : original_(base), base_(base), previous_('\0'), position_() {}
- explicit position_iterator(Iterator base, file_position const& position)
- : original_(base), base_(base), previous_('\0'), position_(position) {}
+ lookback_iterator() {}
+ explicit lookback_iterator(Iterator base)
+ : original_(base), base_(base) {}
     
         friend bool operator==(
- position_iterator const& x,
- position_iterator const& y)
+ lookback_iterator const& x,
+ lookback_iterator const& y)
         {
             return x.base_ == y.base_;
         }
         
- position_iterator& operator++()
+ lookback_iterator& operator++()
         {
- char val = *base_;
-
- if (val == '\r') {
- ++position_.line;
- position_.column = 1;
- }
- else if (val == '\n') {
- if (previous_ != '\r') {
- ++position_.line;
- position_.column = 1;
- }
- }
- else {
- ++position_.column;
- }
-
- previous_ = val;
             ++base_;
-
             return *this;
         }
     
@@ -77,10 +48,6 @@
             return *base_;
         }
         
- file_position const& get_position() const {
- return position_;
- }
-
         Iterator base() const {
             return base_;
         }
@@ -96,8 +63,6 @@
     private:
         Iterator original_;
         Iterator base_;
- char previous_;
- file_position position_;
     };
 }
 

Modified: trunk/tools/quickbook/src/main_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/main_grammar.cpp (original)
+++ trunk/tools/quickbook/src/main_grammar.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -16,6 +16,7 @@
 #include "phrase_tags.hpp"
 #include "parsers.hpp"
 #include "scoped.hpp"
+#include "input_path.hpp"
 #include <boost/spirit/include/classic_core.hpp>
 #include <boost/spirit/include/classic_chset.hpp>
 #include <boost/spirit/include/classic_if.hpp>
@@ -23,26 +24,79 @@
 #include <boost/spirit/include/classic_attribute.hpp>
 #include <boost/spirit/include/classic_lazy.hpp>
 #include <boost/spirit/include/phoenix1_primitives.hpp>
+#include <boost/range/algorithm/find_first_of.hpp>
+#include <boost/range/as_literal.hpp>
+
+#include <iostream>
 
 namespace quickbook
 {
     namespace cl = boost::spirit::classic;
 
+ struct list_stack_item {
+ bool root;
+ unsigned int indent;
+ unsigned int indent2;
+ char mark;
+
+ list_stack_item() :
+ root(true), indent(0), indent2(0), mark('\0') {}
+
+ list_stack_item(char mark, unsigned int indent, unsigned int indent2) :
+ root(false), indent(indent), indent2(indent2), mark(mark)
+ {}
+
+ };
+
+ struct block_types {
+ enum values {
+ none, code, list, paragraph
+ };
+ };
+
+ template <typename T>
+ struct member_action
+ {
+ typedef void(T::*member_function)(parse_iterator, parse_iterator);
+
+ T& l;
+ member_function mf;
+
+ member_action(T& l, member_function mf) : l(l), mf(mf) {}
+
+ void operator()(parse_iterator first, parse_iterator last) const {
+ (l.*mf)(first, last);
+ }
+ };
+
     struct main_grammar_local
     {
+ ////////////////////////////////////////////////////////////////////////
+ // Local actions
+
+ void start_blocks_impl(parse_iterator first, parse_iterator last);
+ void end_blocks_impl(parse_iterator first, parse_iterator last);
+ void check_indentation_impl(parse_iterator first, parse_iterator last);
+ void check_code_block_impl(parse_iterator first, parse_iterator last);
+ void plain_block(string_iterator first, string_iterator last);
+ void list_block(string_iterator first, string_iterator mark_pos,
+ string_iterator last);
+ void clear_stack();
+
         struct process_element_impl : scoped_action_base {
             process_element_impl(main_grammar_local& l)
                 : l(l) {}
 
             bool start()
             {
- if (!(l.info.type & l.actions_.context) ||
+ if (!(l.info.type & l.element.context()) ||
                         qbk_version_n < l.info.qbk_version)
                     return false;
 
                 info_ = l.info;
 
- if (!(info_.type & element_info::in_phrase))
+ if (info_.type != element_info::phrase &&
+ info_.type != element_info::maybe_block)
                     l.actions_.paragraph();
 
                 l.actions_.values.builder.reset();
@@ -60,36 +114,51 @@
                 return true;
             }
 
- void success() { l.element_type = info_.type; }
+ void success(parse_iterator, parse_iterator) { l.element_type = info_.type; }
             void failure() { l.element_type = element_info::nothing; }
 
             main_grammar_local& l;
             element_info info_;
         };
-
- struct is_block_type
+
+ struct in_list_impl {
+ main_grammar_local& l;
+
+ in_list_impl(main_grammar_local& l) :
+ l(l) {}
+
+ bool operator()() const {
+ return !l.list_stack.top().root;
+ }
+ };
+
+ struct set_no_eols_scoped : scoped_action_base
         {
- typedef bool result_type;
- template <typename Arg1 = void>
- struct result { typedef bool type; };
-
- is_block_type(main_grammar_local& l)
- : l_(l)
- {}
+ set_no_eols_scoped(main_grammar_local& l)
+ : l(l) {}
 
- bool operator()() const
- {
- return l_.element_type && !(l_.element_type & element_info::in_phrase);
+ bool start() {
+ saved_no_eols = l.no_eols;
+ l.no_eols = false;
+
+ return true;
             }
-
- main_grammar_local& l_;
+
+ void cleanup() {
+ l.no_eols = saved_no_eols;
+ }
+
+ main_grammar_local& l;
+ bool saved_no_eols;
         };
 
+ ////////////////////////////////////////////////////////////////////////
+ // Local members
+
         cl::rule<scanner>
- top_level, blocks, paragraph_separator,
+ top_level, indent_check,
+ paragraph_separator,
                         code, code_line, blank_line, hr,
- list, list_item,
- escape,
                         inline_code,
                         template_,
                         code_block, macro,
@@ -99,80 +168,234 @@
                         template_args_1_5, template_arg_1_5, template_arg_1_5_content,
                         template_inner_arg_1_5, brackets_1_5,
                         break_,
- command_line_macro_identifier, command_line_phrase,
- dummy_block
+ command_line_macro_identifier,
+ dummy_block, line_dummy_block, square_brackets
                         ;
 
- cl::rule<scanner> element;
-
         struct simple_markup_closure
             : cl::closure<simple_markup_closure, char>
         {
             member1 mark;
         };
 
+ struct block_item_closure : cl::closure<block_item_closure, bool>
+ {
+ member1 still_in_block;
+ };
+
+ struct context_closure : cl::closure<context_closure, element_info::context>
+ {
+ member1 context;
+ };
+
         cl::rule<scanner, simple_markup_closure::context_t> simple_markup;
         cl::rule<scanner> simple_markup_end;
 
+ cl::rule<scanner, block_item_closure::context_t> paragraph;
+ cl::rule<scanner, context_closure::context_t> paragraph_item;
+ cl::rule<scanner, block_item_closure::context_t> list;
+ cl::rule<scanner, context_closure::context_t> list_item;
+ cl::rule<scanner, context_closure::context_t> common;
+ cl::rule<scanner, context_closure::context_t> element;
+
+ // state
+ std::stack<list_stack_item> list_stack;
+ unsigned int list_indent;
+ bool no_eols;
+
+ // transitory state
+ block_types::values block_type;
         element_info info;
         element_info::type_enum element_type;
 
+ // actions
         quickbook::actions& actions_;
+ member_action<main_grammar_local> check_indentation;
+ member_action<main_grammar_local> check_code_block;
+ member_action<main_grammar_local> start_blocks;
+ member_action<main_grammar_local> end_blocks;
+ in_list_impl in_list;
         scoped_parser<process_element_impl> process_element;
- is_block_type is_block;
+ scoped_parser<set_no_eols_scoped> scoped_no_eols;
+
+ ////////////////////////////////////////////////////////////////////////
+ // Local constructor
 
         main_grammar_local(quickbook::actions& actions)
- : actions_(actions)
+ : list_stack()
+ , list_indent(0)
+ , no_eols(true)
+ , actions_(actions)
+ , check_indentation(*this, &main_grammar_local::check_indentation_impl)
+ , check_code_block(*this, &main_grammar_local::check_indentation_impl)
+ , start_blocks(*this, &main_grammar_local::start_blocks_impl)
+ , end_blocks(*this, &main_grammar_local::end_blocks_impl)
+ , in_list(*this)
             , process_element(*this)
- , is_block(*this)
+ , scoped_no_eols(*this)
             {}
     };
 
+ ////////////////////////////////////////////////////////////////////////////
+ // Local grammar
+
     void quickbook_grammar::impl::init_main()
     {
         main_grammar_local& local = cleanup_.add(
             new main_grammar_local(actions));
 
- block_skip_initial_spaces =
- *(cl::blank_p | comment) >> block_start
+ // phrase/phrase_start is used for an entirely self-contained
+ // phrase. For example, any remaining anchors are written out
+ // at the end instead of being saved for any following content.
+ phrase_start =
+ inline_phrase [actions.phrase_end]
+ ;
+
+ // nested_phrase is used for a phrase nested inside square
+ // brackets.
+ nested_phrase =
+ actions.values.save()
+ [ *( ~cl::eps_p(']')
+ >> local.common(element_info::in_phrase)
+ )
+ ]
             ;
 
+ // paragraph_phrase is like a nested_phrase but is also terminated
+ // by a paragraph end.
+ paragraph_phrase =
+ actions.values.save()
+ [ *( ~cl::eps_p(phrase_end)
+ >> local.common(element_info::in_phrase)
+ )
+ ]
+ ;
+
+ // extended_phrase is like a paragraph_phrase but allows some block
+ // elements.
+ extended_phrase =
+ actions.values.save()
+ [ *( ~cl::eps_p(phrase_end)
+ >> local.common(element_info::in_conditional)
+ )
+ ]
+ ;
+
+ // inline_phrase is used a phrase that isn't nested inside
+ // brackets, but is not self contained. An example of this
+ // is expanding a template, which is parsed separately but
+ // is part of the paragraph that contains it.
+ inline_phrase =
+ actions.values.save()
+ [ *local.common(element_info::in_phrase)
+ ]
+ ;
+
+ table_title_phrase =
+ actions.values.save()
+ [ *( ~cl::eps_p(space >> (']' | '[' >> space >> '['))
+ >> local.common(element_info::in_phrase)
+ )
+ ]
+ ;
+
+ inside_preformatted =
+ local.scoped_no_eols()
+ [ paragraph_phrase
+ ]
+ ;
+
+ // Top level blocks
         block_start =
- local.top_level >> blank
+ (*eol) [local.start_blocks]
+ >> (*local.top_level) [local.end_blocks]
             ;
 
         local.top_level =
- actions.scoped_context(element_info::in_block)
- [ local.blocks
- >> *( local.element
- >> !(cl::eps_p(local.is_block) >> +eol >> local.blocks)
- | local.paragraph_separator >> local.blocks
- | common
- | cl::space_p [actions.space_char]
- | cl::anychar_p [actions.plain_char]
+ cl::eps_p(local.indent_check)
+ >> ( cl::eps_p(ph::var(local.block_type) == block_types::code)
+ >> local.code
+ | cl::eps_p(ph::var(local.block_type) == block_types::list)
+ >> local.list
+ | cl::eps_p(ph::var(local.block_type) == block_types::paragraph)
+ >> ( local.hr
+ | local.paragraph
+ )
                 )
- ]
+ >> *eol
             ;
 
- local.blocks =
- *( local.code
- | local.list
- | local.hr
- | +eol
- )
+ local.indent_check =
+ ( *cl::blank_p
+ >> !( (cl::ch_p('*') | '#')
+ >> *cl::blank_p)
+ ) [local.check_indentation]
+ ;
+
+ local.paragraph =
+ cl::eps_p [local.paragraph.still_in_block = true]
+ >> local.paragraph_item(element_info::only_contextual_block)
+ >> *( cl::eps_p(local.paragraph.still_in_block)
+ >> local.paragraph_item(element_info::only_block)
+ )
+ >> cl::eps_p [actions.paragraph]
             ;
 
- local.paragraph_separator
- = cl::eol_p
- >> *cl::blank_p
- >> cl::eol_p [actions.paragraph]
+ local.paragraph_item =
+ local.element(local.paragraph_item.context)
+ >> !eol [local.paragraph.still_in_block = false]
+ | local.paragraph_separator [local.paragraph.still_in_block = false]
+ | local.common(element_info::in_phrase)
+ ;
+
+ local.list =
+ *cl::blank_p
+ >> (cl::ch_p('*') | '#')
+ >> *cl::blank_p [local.list.still_in_block = true]
+ >> *( cl::eps_p(local.list.still_in_block)
+ >> local.list_item(element_info::only_block)
+ )
+ >> cl::eps_p [actions.list_item]
+ ;
+
+ local.list_item =
+ local.element(local.list_item.context)
+ >> !eol [local.list.still_in_block = false]
+ | local.paragraph_separator [local.list.still_in_block = false]
+ | local.common(element_info::in_phrase)
+ ;
+
+ local.paragraph_separator =
+ cl::eol_p
+ >> cl::eps_p
+ ( *cl::blank_p
+ >> ( cl::eol_p
+ | cl::eps_p(local.in_list) >> (cl::ch_p('*') | '#')
+ )
+ )
+ >> *eol
+ ;
+
+ // Blocks contains within an element, e.g. a table cell or a footnote.
+ inside_paragraph =
+ actions.values.save()
+ [ *( local.paragraph_separator [actions.paragraph]
+ >> *eol
+ | ~cl::eps_p(']')
+ >> local.common(element_info::in_nested_block)
+ )
+ ] [actions.paragraph]
             ;
 
         local.hr =
                 cl::str_p("----")
>> actions.values.list(block_tags::hr)
- [ *(cl::anychar_p - eol)
- >> +eol
+ [ ( qbk_since(106u)
+ >> *(line_comment | (cl::anychar_p - (cl::eol_p | '[' | ']')))
+ | qbk_before(106u)
+ >> *(line_comment | (cl::anychar_p - (cl::eol_p | "[/")))
+ )
+ >> *eol
                 ] [actions.element]
             ;
 
@@ -201,64 +424,53 @@
             ;
 
         local.code_line =
- cl::blank_p >> *(cl::anychar_p - cl::eol_p) >> cl::eol_p
+ ( *cl::blank_p
+ >> ~cl::eps_p(cl::eol_p)
+ ) [local.check_code_block]
+ >> cl::eps_p(ph::var(local.block_type) == block_types::code)
+ >> *(cl::anychar_p - cl::eol_p)
+ >> (cl::eol_p | cl::end_p)
             ;
 
         local.blank_line =
             *cl::blank_p >> cl::eol_p
             ;
 
- local.list =
- cl::eps_p(cl::ch_p('*') | '#')
- [actions.values.reset()]
- >> actions.scoped_output()
- [
- actions.values.list(block_tags::list)
- [ +actions.values.list()
- [ (*cl::blank_p) [actions.values.entry(ph::arg1, ph::arg2, general_tags::list_indent)]
- >> (cl::ch_p('*') | '#')
- [actions.values.entry(ph::arg1, ph::arg2, general_tags::list_mark)]
- >> *cl::blank_p
- >> local.list_item [actions.to_value]
- ]
- ]
- ] [actions.element]
- ;
-
- local.list_item =
- actions.scoped_context(element_info::in_phrase)
- [
- actions.values.save()
- [
- *( common
- | (cl::anychar_p -
- ( cl::eol_p >> *cl::blank_p
- >> (cl::ch_p('*') | '#' | cl::eol_p)
- )
- ) [actions.plain_char]
- )
- ]
- ]
- >> +eol
- ;
-
- common =
+ local.common =
                 local.macro
- | local.element
+ | local.element(local.common.context)
             | local.template_
             | local.break_
             | local.code_block
             | local.inline_code
             | local.simple_markup
- | local.escape
+ | escape
             | comment
+ | qbk_since(106u) >> local.square_brackets
+ | cl::space_p [actions.raw_char]
+ | cl::anychar_p [actions.plain_char]
+ ;
+
+ local.square_brackets =
+ ( cl::ch_p('[') [actions.plain_char]
+ >> paragraph_phrase
+ >> ( cl::ch_p(']') [actions.plain_char]
+ | cl::eps_p [actions.error("Missing close bracket")]
+ )
+ | cl::ch_p(']') [actions.plain_char]
+ >> cl::eps_p [actions.error("Mismatched close bracket")]
+ )
             ;
 
         local.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]
+ cl::eps_p
+ ( ( actions.macro
+ >> ~cl::eps_p(cl::alpha_p | '_')
+ // must not be followed by alpha or underscore
+ )
+ & macro_identifier // must be a valid macro for the current version
+ )
+ >> actions.macro [actions.do_macro]
             ;
 
         local.template_ =
@@ -279,10 +491,8 @@
             ;
 
         local.template_args =
- cl::eps_p(qbk_since(105u))
- >> local.template_args_1_5
- | cl::eps_p(qbk_before(105u))
- >> local.template_args_1_4
+ qbk_since(105u) >> local.template_args_1_5
+ | qbk_before(105u) >> local.template_args_1_4
             ;
 
         local.template_args_1_4 = local.template_arg_1_4 >> *(".." >> local.template_arg_1_4);
@@ -347,20 +557,20 @@
 
         local.code_block =
                 (
- "```" >>
+ "```" >> *(*cl::blank_p >> cl::eol_p) >>
                     (
- *(cl::anychar_p - "```")
- >> cl::eps_p("```")
+ *(cl::anychar_p - (*cl::space_p >> "```"))
+ >> cl::eps_p(*cl::space_p >> "```")
                     ) [actions.code_block]
- >> "```"
+ >> *cl::space_p >> "```"
                 )
             | (
- "``" >>
+ "``" >> *(*cl::blank_p >> cl::eol_p) >>
                     (
- *(cl::anychar_p - "``")
- >> cl::eps_p("``")
+ *(cl::anychar_p - (*cl::space_p >> "``"))
+ >> cl::eps_p(*cl::space_p >> "``")
                     ) [actions.code_block]
- >> "``"
+ >> *cl::space_p >> "``"
                 )
             ;
 
@@ -379,18 +589,17 @@
                 ]
>> actions.values.save()
                 [
- actions.scoped_output()
+ actions.to_value()
                     [
- ( cl::eps_p(actions.macro >> local.simple_markup_end)
- >> actions.macro [actions.do_macro]
- | ~cl::eps_p(cl::f_ch_p(local.simple_markup.mark))
- >> +( ~cl::eps_p
- ( lookback [~cl::f_ch_p(local.simple_markup.mark)]
- >> local.simple_markup_end
- )
- >> cl::anychar_p [actions.plain_char]
+ cl::eps_p((actions.macro & macro_identifier) >> local.simple_markup_end)
+ >> actions.macro [actions.do_macro]
+ | ~cl::eps_p(cl::f_ch_p(local.simple_markup.mark))
+ >> +( ~cl::eps_p
+ ( lookback [~cl::f_ch_p(local.simple_markup.mark)]
+ >> local.simple_markup_end
                             )
- ) [actions.to_value]
+ >> cl::anychar_p [actions.plain_char]
+ )
                     ]
>> cl::f_ch_p(local.simple_markup.mark)
                                                 [actions.simple_markup]
@@ -414,44 +623,7 @@
             | phrase_end
                 ;
 
- phrase =
- actions.scoped_context(element_info::in_phrase)
- [
- actions.values.save()
- [ *( common
- | (cl::anychar_p - phrase_end)
- [actions.plain_char]
- )
- ]
- ]
- ;
-
- extended_phrase =
- actions.scoped_context(element_info::in_conditional)
- [
- actions.values.save()
- [ *( common
- | (cl::anychar_p - phrase_end)
- [actions.plain_char]
- )
- ]
- ]
- ;
-
- inside_paragraph =
- actions.scoped_context(element_info::in_nested_block)
- [
- actions.values.save()
- [ *( local.paragraph_separator [actions.paragraph]
- | common
- | (cl::anychar_p - phrase_end)
- [actions.plain_char]
- )
- ] [actions.paragraph]
- ]
- ;
-
- local.escape =
+ escape =
                 cl::str_p("\\n") [actions.break_]
             | cl::str_p("\\ ") // ignore an escaped space
             | '\\' >> cl::punct_p [actions.plain_char]
@@ -468,20 +640,19 @@
                 ]
             ;
 
- //
- // Simple phrase grammar
- //
-
- simple_phrase =
- actions.scoped_context(element_info::in_phrase)
- [
- actions.values.save()
- [
- *( common
- | (cl::anychar_p - ']') [actions.plain_char]
- )
- ]
- ]
+ raw_escape =
+ cl::str_p("\\n") [actions.error("Newlines invalid here.")]
+ | 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.error("Boostbook escape invalid here.")]
+ >> (*(cl::anychar_p - "'''"))
+ >> ( cl::str_p("'''")
+ | cl::eps_p [actions.error("Unclosed boostbook escape.")]
+ ) [actions.element]
             ;
 
         //
@@ -494,29 +665,19 @@
>> local.command_line_macro_identifier
                                                 [actions.values.entry(ph::arg1, ph::arg2)]
>> *cl::space_p
- >> ( '='
+ >> !( '='
>> *cl::space_p
- >> local.command_line_phrase
+ >> actions.to_value() [ inline_phrase ]
>> *cl::space_p
- | cl::eps_p
- ) [actions.to_value]
+ )
+ >> cl::end_p
             ] [actions.element]
             ;
 
         local.command_line_macro_identifier =
- +(cl::anychar_p - (cl::space_p | ']' | '='))
- ;
-
-
- local.command_line_phrase =
- actions.scoped_context(element_info::in_phrase)
- [
- actions.values.save()
- [ *( common
- | (cl::anychar_p - ']') [actions.plain_char]
- )
- ]
- ]
+ qbk_since(106u)
+ >> +(cl::anychar_p - (cl::space_p | '[' | '\\' | ']' | '='))
+ | +(cl::anychar_p - (cl::space_p | ']' | '='))
             ;
 
         // Miscellaneous stuff
@@ -540,7 +701,7 @@
 
         phrase_end =
                 ']'
- | cl::eps_p(ph::var(actions.no_eols))
+ | cl::eps_p(ph::var(local.no_eols))
>> cl::eol_p >> *cl::blank_p >> cl::eol_p
             ; // Make sure that we don't go
                                                 // past a single block, except
@@ -554,9 +715,175 @@
             '[' >> *(local.dummy_block | (cl::anychar_p - ']')) >> ']'
             ;
 
+ line_comment =
+ "[/" >> *(local.line_dummy_block | (cl::anychar_p - (cl::eol_p | ']'))) >> ']'
+ ;
+
+ local.line_dummy_block =
+ '[' >> *(local.line_dummy_block | (cl::anychar_p - (cl::eol_p | ']'))) >> ']'
+ ;
+
         macro_identifier =
- +(cl::anychar_p - (cl::space_p | ']'))
+ qbk_since(106u)
+ >> +(cl::anychar_p - (cl::space_p | '[' | '\\' | ']'))
+ | qbk_before(106u)
+ >> +(cl::anychar_p - (cl::space_p | ']'))
             ;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Indentation Handling
+
+ template <typename Iterator>
+ int indent_length(Iterator first, Iterator end)
+ {
+ int length = 0;
+ for(; first != end; ++first)
+ {
+ if (*first == '\t') {
+ // hardcoded tab to 4 for now
+ length = length + 4 - (length % 4);
+ }
+ else {
+ ++length;
+ }
+ }
+
+ return length;
+ }
+
+ void main_grammar_local::start_blocks_impl(parse_iterator, parse_iterator)
+ {
+ list_stack.push(list_stack_item());
+ }
+
+ void main_grammar_local::end_blocks_impl(parse_iterator, parse_iterator)
+ {
+ clear_stack();
+ list_stack.pop();
+ }
 
+ void main_grammar_local::check_indentation_impl(parse_iterator first_, parse_iterator last_)
+ {
+ string_iterator first = first_.base();
+ string_iterator last = last_.base();
+ string_iterator mark_pos = boost::find_first_of(
+ boost::make_iterator_range(first, last),
+ boost::as_literal("#*"));
+
+ if (mark_pos == last) {
+ plain_block(first, last);
+ }
+ else {
+ list_block(first, mark_pos, last);
+ }
+ }
+
+ void main_grammar_local::check_code_block_impl(parse_iterator first, parse_iterator last)
+ {
+ unsigned int new_indent = indent_length(first.base(), last.base());
+
+ block_type = (new_indent > list_stack.top().indent2) ?
+ block_types::code : block_types::none;
+ }
+
+ void main_grammar_local::plain_block(string_iterator first, string_iterator last)
+ {
+ if (qbk_version_n >= 106u) {
+ unsigned int new_indent = indent_length(first, last);
+
+ if (new_indent > list_stack.top().indent2) {
+ block_type = block_types::code;
+ }
+ else {
+ while (!list_stack.top().root && new_indent < list_stack.top().indent)
+ {
+ actions_.end_list_item();
+ actions_.end_list(list_stack.top().mark);
+ list_stack.pop();
+ list_indent = list_stack.top().indent;
+ }
+
+ if (!list_stack.top().root && new_indent == list_stack.top().indent)
+ {
+ list_stack_item save = list_stack.top();
+ list_stack.pop();
+ if (new_indent == list_stack.top().indent) {
+ actions_.end_list_item();
+ actions_.end_list(save.mark);
+ list_indent = list_stack.top().indent;
+ }
+ else {
+ list_stack.push(save);
+ }
+ }
+
+ block_type = block_types::paragraph;
+ }
+ }
+ else {
+ clear_stack();
+
+ if (last == first)
+ block_type = block_types::paragraph;
+ else
+ block_type = block_types::code;
+ }
+ }
+
+ void main_grammar_local::list_block(string_iterator first, string_iterator mark_pos,
+ string_iterator last)
+ {
+ unsigned int new_indent = indent_length(first, mark_pos);
+ unsigned int new_indent2 = indent_length(first, last);
+ char mark = *mark_pos;
+
+ if (list_stack.top().root && new_indent > 0) {
+ block_type = block_types::code;
+ return;
+ }
+
+ if (list_stack.top().root || new_indent > list_indent) {
+ list_stack.push(list_stack_item(mark, new_indent, new_indent2));
+ actions_.start_list(mark);
+ }
+ else if (new_indent == list_indent) {
+ actions_.end_list_item();
+ }
+ else {
+ // This should never reach root, since the first list
+ // has indentation 0.
+ while(!list_stack.top().root && new_indent < list_stack.top().indent)
+ {
+ actions_.end_list_item();
+ actions_.end_list(list_stack.top().mark);
+ list_stack.pop();
+ }
+
+ actions_.end_list_item();
+ }
+
+ list_indent = new_indent;
+
+ if (mark != list_stack.top().mark)
+ {
+ detail::outerr(actions_.current_file, first)
+ << "Illegal change of list style.\n";
+ detail::outwarn(actions_.current_file, first)
+ << "Ignoring change of list style." << std::endl;
+ ++actions_.error_count;
+ }
+
+ actions_.start_list_item();
+ block_type = block_types::list;
+ }
+
+ void main_grammar_local::clear_stack()
+ {
+ while (!list_stack.top().root) {
+ actions_.end_list_item();
+ actions_.end_list(list_stack.top().mark);
+ list_stack.pop();
+ }
     }
 }

Modified: trunk/tools/quickbook/src/markups.cpp
==============================================================================
--- trunk/tools/quickbook/src/markups.cpp (original)
+++ trunk/tools/quickbook/src/markups.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -34,6 +34,7 @@
                 { block_tags::important, "<important>", "</important>" },
                 { block_tags::note, "<note>", "</note>" },
                 { block_tags::tip, "<tip>", "</tip>" },
+ { block_tags::block, "", "" },
                 { block_tags::ordered_list, "<orderedlist>", "</orderedlist>" },
                 { block_tags::itemized_list, "<itemizedlist>", "</itemizedlist>" },
                 { block_tags::hr, "<para/>", 0 },

Modified: trunk/tools/quickbook/src/parsers.hpp
==============================================================================
--- trunk/tools/quickbook/src/parsers.hpp (original)
+++ trunk/tools/quickbook/src/parsers.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -28,7 +28,7 @@
     // Impl is a struct with the methods:
     //
     // void start();
- // void success();
+ // void success(parse_iterator, parse_iterator);
     // void failure();
     // void cleanup();
     //
@@ -83,10 +83,10 @@
                 return in_progress_;
             }
             
- void success()
+ void success(parse_iterator f, parse_iterator l)
             {
                 in_progress_ = false;
- impl_.success();
+ impl_.success(f, l);
             }
 
             void failure()
@@ -121,7 +121,8 @@
             bool success = scope.impl_.result(result, scan);
 
             if (success) {
- scope.success();
+ scope.success(save, scan.first);
+
                 if (result) {
                     return scan.create_match(result.length(), cl::nil_t(), save, scan.first);
                 }

Modified: trunk/tools/quickbook/src/phrase_element_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/phrase_element_grammar.cpp (original)
+++ trunk/tools/quickbook/src/phrase_element_grammar.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -26,7 +26,8 @@
     struct phrase_element_grammar_local
     {
         cl::rule<scanner>
- image, anchor, link, empty, cond_phrase, inner_phrase
+ image, anchor, link, empty, cond_phrase, inner_phrase,
+ role
                         ;
     };
 
@@ -50,26 +51,48 @@
             ("$", element_info(element_info::phrase, &local.image, phrase_tags::image))
             ;
 
+ // Note that the attribute values here are encoded in plain text not
+ // boostbook.
         local.image =
- cl::eps_p(qbk_since(105u))
+ qbk_since(105u)
>> blank
- >> (+(
- *cl::space_p
- >> +(cl::anychar_p - (cl::space_p | phrase_end | '['))
- )) [actions.values.entry(ph::arg1, ph::arg2)]
+ >> ( qbk_before(106u)
+ >> (+(
+ *cl::space_p
+ >> +(cl::anychar_p - (cl::space_p | phrase_end | '['))
+ )) [actions.values.entry(ph::arg1, ph::arg2)]
+ | qbk_since(106u)
+ >> actions.to_value()
+ [ +( raw_escape
+ | (+cl::space_p >> ~cl::eps_p(phrase_end | '['))
+ [actions.raw_char]
+ | (cl::anychar_p - (cl::space_p | phrase_end | '['))
+ [actions.raw_char]
+ )
+ ]
+ )
>> hard_space
>> *actions.values.list()
                 [ '['
>> (*(cl::alnum_p | '_'))
                                         [actions.values.entry(ph::arg1, ph::arg2)]
>> space
- >> (*(cl::anychar_p - (phrase_end | '[')))
+ >> ( qbk_before(106u)
+ >> (*(cl::anychar_p - (phrase_end | '[')))
                                         [actions.values.entry(ph::arg1, ph::arg2)]
+ | qbk_since(106u)
+ >> actions.to_value()
+ [ *( raw_escape
+ | (cl::anychar_p - (phrase_end | '['))
+ [actions.raw_char]
+ )
+ ]
+ )
>> ']'
>> space
                 ]
>> cl::eps_p(']')
- | cl::eps_p(qbk_before(105u))
+ | qbk_before(105u)
>> blank
>> (*(cl::anychar_p - phrase_end)) [actions.values.entry(ph::arg1, ph::arg2)]
>> cl::eps_p(']')
@@ -90,19 +113,37 @@
 
         local.link =
                 space
- >> (*(cl::anychar_p - (']' | hard_space)))
+ >> ( qbk_before(106u)
+ >> (*(cl::anychar_p - (']' | space)))
                                                 [actions.values.entry(ph::arg1, ph::arg2)]
+ | qbk_since(106u)
+ >> actions.to_value()
+ [ *( raw_escape
+ | (cl::anychar_p - (']' | space))
+ [actions.raw_char]
+ )
+ ]
+ )
>> hard_space
>> local.inner_phrase
             ;
 
         elements.add
- ("#", element_info(element_info::phrase, &local.anchor, phrase_tags::anchor))
+ ("#", element_info(element_info::maybe_block, &local.anchor, phrase_tags::anchor))
             ;
 
         local.anchor =
                 blank
- >> (*(cl::anychar_p - phrase_end)) [actions.values.entry(ph::arg1, ph::arg2)]
+ >> ( qbk_before(106u)
+ >> (*(cl::anychar_p - phrase_end)) [actions.values.entry(ph::arg1, ph::arg2)]
+ | qbk_since(106u)
+ >> actions.to_value()
+ [ *( raw_escape
+ | (cl::anychar_p - phrase_end)
+ [actions.raw_char]
+ )
+ ]
+ )
             ;
 
         elements.add
@@ -121,14 +162,23 @@
             ("python", element_info(element_info::phrase, &local.empty, source_mode_tags::python))
             ("teletype", element_info(element_info::phrase, &local.empty, source_mode_tags::teletype))
             ;
-
+
+ elements.add
+ ("role", element_info(element_info::phrase, &local.role, phrase_tags::role, 106u))
+ ;
+
+ local.role
+ = space
+ >> (+(cl::alnum_p | '_')) [actions.values.entry(ph::arg1, ph::arg2)]
+ >> hard_space
+ >> local.inner_phrase
+ ;
+
         local.empty = cl::eps_p;
 
         local.inner_phrase =
                 blank
- >> actions.scoped_output()
- [ phrase [actions.to_value]
- ]
+ >> actions.to_value() [ paragraph_phrase ]
             ;
     }
 }

Modified: trunk/tools/quickbook/src/phrase_tags.hpp
==============================================================================
--- trunk/tools/quickbook/src/phrase_tags.hpp (original)
+++ trunk/tools/quickbook/src/phrase_tags.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -22,6 +22,7 @@
         (footnote)
         (escape)
         (break_mark)
+ (role)
     )
     
     QUICKBOOK_VALUE_NAMED_TAGS(source_mode_tags, 0x550,

Modified: trunk/tools/quickbook/src/quickbook.cpp
==============================================================================
--- trunk/tools/quickbook/src/quickbook.cpp (original)
+++ trunk/tools/quickbook/src/quickbook.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -12,8 +12,9 @@
 #include "actions_class.hpp"
 #include "post_process.hpp"
 #include "utils.hpp"
+#include "files.hpp"
 #include "input_path.hpp"
-#include "id_generator.hpp"
+#include "id_manager.hpp"
 #include <boost/program_options.hpp>
 #include <boost/filesystem/v3/path.hpp>
 #include <boost/filesystem/v3/operations.hpp>
@@ -35,7 +36,7 @@
 #pragma warning(disable:4355)
 #endif
 
-#define QUICKBOOK_VERSION "Quickbook Version 1.5.6"
+#define QUICKBOOK_VERSION "Quickbook Version 1.5.7 (dev)"
 
 namespace quickbook
 {
@@ -45,9 +46,11 @@
     tm* current_time; // the current time
     tm* current_gm_time; // the current UTC time
     bool debug_mode; // for quickbook developers only
+ bool self_linked_headers;
     bool ms_errors = false; // output errors/warnings as if for VS
     std::vector<fs::path> include_path;
     std::vector<std::string> preset_defines;
+ fs::path image_location;
 
     static void set_macros(actions& actor)
     {
@@ -56,12 +59,20 @@
                 end = preset_defines.end();
                 it != end; ++it)
         {
- // TODO: Set filename in actor???
- iterator first(it->begin());
- iterator last(it->end());
+ parse_iterator first(it->begin());
+ parse_iterator last(it->end());
 
- cl::parse(first, last, actor.grammar().command_line_macro);
- // TODO: Check result?
+ cl::parse_info<parse_iterator> info =
+ cl::parse(first, last, actor.grammar().command_line_macro);
+
+ if (!info.full) {
+ detail::outerr()
+ << "Error parsing command line definition: '"
+ << *it
+ << "'"
+ << std::endl;
+ ++actor.error_count;
+ }
         }
     }
 
@@ -70,60 +81,31 @@
     // Parse a file
     //
     ///////////////////////////////////////////////////////////////////////////
- int
- parse_file(fs::path const& filein_, actions& actor, bool ignore_docinfo)
+ void parse_file(actions& actor, value include_doc_id, bool nested_file)
     {
- using std::vector;
- using std::string;
-
- std::string storage;
- int err = detail::load(filein_, storage);
- if (err != 0) {
- ++actor.error_count;
- return err;
- }
-
- iterator first(storage.begin());
- iterator last(storage.end());
+ parse_iterator first(actor.current_file->source.begin());
+ parse_iterator last(actor.current_file->source.end());
 
- cl::parse_info<iterator> info = cl::parse(first, last, actor.grammar().doc_info);
+ cl::parse_info<parse_iterator> info = cl::parse(first, last, actor.grammar().doc_info);
+ assert(info.hit);
 
- if (info.hit || ignore_docinfo)
+ if (!actor.error_count)
         {
- pre(actor.out, actor, ignore_docinfo);
+ parse_iterator pos = info.stop;
+ std::string doc_type = pre(actor, pos, include_doc_id, nested_file);
 
             info = cl::parse(info.hit ? info.stop : first, last, actor.grammar().block);
- if (info.full)
- {
- post(actor.out, actor, ignore_docinfo);
- }
- }
-
- if (!info.full)
- {
- file_position const& pos = info.stop.get_position();
- detail::outerr(actor.filename, pos.line)
- << "Syntax Error near column " << pos.column << ".\n";
- ++actor.error_count;
- }
 
- return actor.error_count ? 1 : 0;
- }
+ post(actor, doc_type);
 
- static int
- parse_document(
- fs::path const& filein_,
- actions& actor)
- {
- bool r = parse_file(filein_, actor);
-
- if(actor.error_count)
- {
- detail::outerr()
- << "Error count: " << actor.error_count << ".\n";
+ if (!info.full)
+ {
+ file_position const& pos = actor.current_file->position_of(info.stop.base());
+ detail::outerr(actor.current_file->path, pos.line)
+ << "Syntax Error near column " << pos.column << ".\n";
+ ++actor.error_count;
+ }
         }
-
- return r;
     }
 
     static int
@@ -136,16 +118,36 @@
       , bool pretty_print)
     {
         string_stream buffer;
- id_generator ids;
- actions actor(filein_, xinclude_base_, buffer, ids);
- set_macros(actor);
+ id_manager ids;
+
+ int result = 0;
+
+ try {
+ actions actor(filein_, xinclude_base_, buffer, ids);
+ set_macros(actor);
 
- int result = parse_document(filein_, actor);
+ if (actor.error_count == 0) {
+ actor.current_file = load(filein_); // Throws load_error
 
- std::string stage2 = ids.replace_placeholders(buffer.str());
+ parse_file(actor);
+
+ if(actor.error_count) {
+ detail::outerr()
+ << "Error count: " << actor.error_count << ".\n";
+ }
+ }
+
+ result = actor.error_count ? 1 : 0;
+ }
+ catch (load_error& e) {
+ detail::outerr(filein_) << detail::utf8(e.what()) << std::endl;
+ result = 1;
+ }
 
         if (result == 0)
         {
+ std::string stage2 = ids.replace_placeholders(buffer.str());
+
             fs::ofstream fileout(fileout_);
 
             if (pretty_print)
@@ -169,6 +171,7 @@
                 fileout << stage2;
             }
         }
+
         return result;
     }
 }
@@ -218,6 +221,7 @@
             ("help", "produce help message")
             ("version", "print version string")
             ("no-pretty-print", "disable XML pretty printing")
+ ("no-self-linked-headers", "stop headers linking to themselves")
             ("indent", PO_VALUE<int>(), "indent spaces")
             ("linewidth", PO_VALUE<int>(), "line width")
             ("input-file", PO_VALUE<input_string>(), "input file")
@@ -226,6 +230,7 @@
             ("ms-errors", "use Microsoft Visual Studio style error & warn message format")
             ("include-path,I", PO_VALUE< std::vector<input_string> >(), "include path")
             ("define,D", PO_VALUE< std::vector<input_string> >(), "define macro")
+ ("image-location", PO_VALUE<input_string>(), "image location")
         ;
 
         hidden.add_options()
@@ -308,6 +313,8 @@
         if (vm.count("no-pretty-print"))
             pretty_print = false;
 
+ quickbook::self_linked_headers = !vm.count("no-self-link-headers");
+
         if (vm.count("indent"))
             indent = vm["indent"].as<int>();
 
@@ -387,6 +394,16 @@
                     xinclude_base = ".";
             }
 
+ if (vm.count("image-location"))
+ {
+ quickbook::image_location = quickbook::detail::input_to_path(
+ vm["image-location"].as<input_string>());
+ }
+ else
+ {
+ quickbook::image_location = filein.parent_path() / "html";
+ }
+
             quickbook::detail::out() << "Generating Output File: "
                 << quickbook::detail::path_to_stream(fileout)
                 << std::endl;

Modified: trunk/tools/quickbook/src/quickbook.hpp
==============================================================================
--- trunk/tools/quickbook/src/quickbook.hpp (original)
+++ trunk/tools/quickbook/src/quickbook.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -17,6 +17,7 @@
 #include <string>
 #include <boost/filesystem/v3/path.hpp>
 #include "fwd.hpp"
+#include "values.hpp"
 
 namespace quickbook
 {
@@ -25,11 +26,14 @@
     extern tm* current_time; // the current time
     extern tm* current_gm_time; // the current UTC time
     extern bool debug_mode;
+ extern bool self_linked_headers;
     extern std::vector<fs::path> include_path;
     extern std::vector<std::string> preset_defines;
+ extern fs::path image_location;
 
- int parse_file(fs::path const& filein_, actions& actor, bool ignore_docinfo = false);
-
+ void parse_file(actions& actor,
+ value include_doc_id = value(),
+ bool nested_file = false);
     // Some initialisation methods
     //
     // Declared here to avoid including other headers

Modified: trunk/tools/quickbook/src/scoped.hpp
==============================================================================
--- trunk/tools/quickbook/src/scoped.hpp (original)
+++ trunk/tools/quickbook/src/scoped.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -16,7 +16,8 @@
     struct scoped_action_base
     {
         bool start() { return true; }
- void success() {}
+ template <typename Iterator>
+ void success(Iterator, Iterator) {}
         void failure() {}
         void cleanup() {}
         

Modified: trunk/tools/quickbook/src/syntax_highlight.cpp
==============================================================================
--- trunk/tools/quickbook/src/syntax_highlight.cpp (original)
+++ trunk/tools/quickbook/src/syntax_highlight.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -15,11 +15,215 @@
 #include "grammar.hpp"
 #include "grammar_impl.hpp" // Just for context stuff. Should move?
 #include "actions_class.hpp"
+#include "files.hpp"
+#include "input_path.hpp"
 
 namespace quickbook
 {
     namespace cl = boost::spirit::classic;
 
+ // quickbook::actions is used in a few places here, as 'escape_actions'.
+ // It's named differently to distinguish it from the syntax highlighting
+ // actions, declared below.
+
+ // Syntax Highlight Actions
+
+ struct span
+ {
+ // Decorates c++ code fragments
+
+ span(char const* name, collector& out)
+ : name(name), out(out) {}
+
+ void operator()(parse_iterator first, parse_iterator last) const;
+
+ char const* name;
+ collector& out;
+ };
+
+ struct span_start
+ {
+ span_start(char const* name, collector& out)
+ : name(name), out(out) {}
+
+ void operator()(parse_iterator first, parse_iterator last) const;
+
+ char const* name;
+ collector& out;
+ };
+
+ struct span_end
+ {
+ span_end(collector& out)
+ : out(out) {}
+
+ void operator()(parse_iterator first, parse_iterator last) const;
+
+ collector& out;
+ };
+
+ struct unexpected_char
+ {
+ // Handles unexpected chars in c++ syntax
+
+ unexpected_char(
+ collector& out
+ , quickbook::actions& escape_actions)
+ : out(out)
+ , escape_actions(escape_actions) {}
+
+ void operator()(parse_iterator first, parse_iterator last) const;
+
+ collector& out;
+ quickbook::actions& escape_actions;
+ };
+
+ struct plain_char
+ {
+ // Prints a single plain char.
+ // Converts '<' to "&lt;"... etc See utils.hpp
+
+ plain_char(collector& out)
+ : out(out) {}
+
+ void operator()(char ch) const;
+ void operator()(parse_iterator first, parse_iterator last) const;
+
+ collector& out;
+ };
+
+ struct pre_escape_back
+ {
+ // Escapes back from code to quickbook (Pre)
+
+ pre_escape_back(actions& escape_actions)
+ : escape_actions(escape_actions) {}
+
+ void operator()(parse_iterator first, parse_iterator last) const;
+
+ actions& escape_actions;
+ };
+
+ struct post_escape_back
+ {
+ // Escapes back from code to quickbook (Post)
+
+ post_escape_back(collector& out, actions& escape_actions)
+ : out(out), escape_actions(escape_actions) {}
+
+ void operator()(parse_iterator first, parse_iterator last) const;
+
+ collector& out;
+ actions& escape_actions;
+ };
+
+ void span::operator()(parse_iterator first, parse_iterator last) const
+ {
+ out << "<phrase role=\"" << name << "\">";
+ while (first != last)
+ detail::print_char(*first++, out.get());
+ out << "</phrase>";
+ }
+
+ void span_start::operator()(parse_iterator first, parse_iterator last) const
+ {
+ out << "<phrase role=\"" << name << "\">";
+ while (first != last)
+ detail::print_char(*first++, out.get());
+ }
+
+ void span_end::operator()(parse_iterator first, parse_iterator last) const
+ {
+ while (first != last)
+ detail::print_char(*first++, out.get());
+ out << "</phrase>";
+ }
+
+ void unexpected_char::operator()(parse_iterator first, parse_iterator last) const
+ {
+ file_position const pos = escape_actions.current_file->position_of(first.base());
+
+ detail::outwarn(escape_actions.current_file->path, pos.line)
+ << "in column:" << pos.column
+ << ", unexpected character: " << detail::utf8(first, last)
+ << "\n";
+
+ // print out an unexpected character
+ out << "<phrase role=\"error\">";
+ while (first != last)
+ detail::print_char(*first++, out.get());
+ out << "</phrase>";
+ }
+
+ void plain_char::operator()(char ch) const
+ {
+ detail::print_char(ch, out.get());
+ }
+
+ void plain_char::operator()(parse_iterator first, parse_iterator last) const
+ {
+ while (first != last)
+ detail::print_char(*first++, out.get());
+ }
+
+ void pre_escape_back::operator()(parse_iterator, parse_iterator) const
+ {
+ escape_actions.phrase.push(); // save the stream
+ }
+
+ void post_escape_back::operator()(parse_iterator, parse_iterator) const
+ {
+ out << escape_actions.phrase.str();
+ escape_actions.phrase.pop(); // restore the stream
+ }
+
+ // Syntax
+
+ struct keywords_holder
+ {
+ cl::symbols<> cpp, python;
+
+ keywords_holder()
+ {
+ cpp
+ = "and_eq", "and", "asm", "auto", "bitand", "bitor",
+ "bool", "break", "case", "catch", "char", "class",
+ "compl", "const_cast", "const", "continue", "default",
+ "delete", "do", "double", "dynamic_cast", "else",
+ "enum", "explicit", "export", "extern", "false",
+ "float", "for", "friend", "goto", "if", "inline",
+ "int", "long", "mutable", "namespace", "new", "not_eq",
+ "not", "operator", "or_eq", "or", "private",
+ "protected", "public", "register", "reinterpret_cast",
+ "return", "short", "signed", "sizeof", "static",
+ "static_cast", "struct", "switch", "template", "this",
+ "throw", "true", "try", "typedef", "typeid",
+ "typename", "union", "unsigned", "using", "virtual",
+ "void", "volatile", "wchar_t", "while", "xor_eq", "xor"
+ ;
+
+ python
+ =
+ "and", "del", "for", "is", "raise",
+ "assert", "elif", "from", "lambda", "return",
+ "break", "else", "global", "not", "try",
+ "class", "except", "if", "or", "while",
+ "continue", "exec", "import", "pass", "yield",
+ "def", "finally", "in", "print",
+
+ // Technically "as" and "None" are not yet keywords (at Python
+ // 2.4). They are destined to become keywords, and we treat them
+ // as such for syntax highlighting purposes.
+
+ "as", "None"
+ ;
+ }
+ };
+
+ namespace {
+ keywords_holder keywords;
+ }
+
     // Grammar for C++ highlighting
     struct cpp_highlight
     : public cl::grammar<cpp_highlight>
@@ -35,7 +239,7 @@
             {
                 program
                     =
- *( (+cl::space_p) [space(self.out)]
+ *( (+cl::space_p) [plain_char(self.out)]
                     | macro
                     | escape
                     | preprocessor [span("preprocessor", self.out)]
@@ -58,23 +262,14 @@
>> self.escape_actions.macro [do_macro_action(self.out, self.escape_actions)]
                     ;
 
- qbk_phrase =
- self.escape_actions.scoped_context(element_info::in_phrase)
- [ *( g.common
- | (cl::anychar_p - cl::str_p("``"))
- [self.escape_actions.plain_char]
- )
- ]
- ;
-
                 escape =
- cl::str_p("``") [pre_escape_back(self.escape_actions, save)]
+ cl::str_p("``") [pre_escape_back(self.escape_actions)]
>>
                     (
                         (
                             (
                                 (+(cl::anychar_p - "``") >> cl::eps_p("``"))
- & qbk_phrase
+ & g.phrase
                             )
>> cl::str_p("``")
                         )
@@ -83,7 +278,7 @@
                             cl::eps_p [self.escape_actions.error]
>> *cl::anychar_p
                         )
- ) [post_escape_back(self.out, self.escape_actions, save)]
+ ) [post_escape_back(self.out, self.escape_actions)]
                     ;
 
                 preprocessor
@@ -94,38 +289,21 @@
                     = cl::str_p("//") [span_start("comment", self.out)]
>> *( escape
                         | (+(cl::anychar_p - (cl::eol_p | "``")))
- [span(0, self.out)]
+ [plain_char(self.out)]
                         )
>> cl::eps_p [span_end(self.out)]
                     | cl::str_p("/*") [span_start("comment", self.out)]
>> *( escape
                         | (+(cl::anychar_p - (cl::str_p("*/") | "``")))
- [span(0, self.out)]
+ [plain_char(self.out)]
                         )
>> (!cl::str_p("*/")) [span_end(self.out)]
                     ;
 
                 keyword
- = keyword_ >> (cl::eps_p - (cl::alnum_p | '_'))
+ = keywords.cpp >> (cl::eps_p - (cl::alnum_p | '_'))
                     ; // make sure we recognize whole words only
 
- keyword_
- = "and_eq", "and", "asm", "auto", "bitand", "bitor",
- "bool", "break", "case", "catch", "char", "class",
- "compl", "const_cast", "const", "continue", "default",
- "delete", "do", "double", "dynamic_cast", "else",
- "enum", "explicit", "export", "extern", "false",
- "float", "for", "friend", "goto", "if", "inline",
- "int", "long", "mutable", "namespace", "new", "not_eq",
- "not", "operator", "or_eq", "or", "private",
- "protected", "public", "register", "reinterpret_cast",
- "return", "short", "signed", "sizeof", "static",
- "static_cast", "struct", "switch", "template", "this",
- "throw", "true", "try", "typedef", "typeid",
- "typename", "union", "unsigned", "using", "virtual",
- "void", "volatile", "wchar_t", "while", "xor_eq", "xor"
- ;
-
                 special
                     = +cl::chset_p("~!%^&*()+={[}]:;,<.>?/|\\-")
                     ;
@@ -156,12 +334,10 @@
 
             cl::rule<Scanner>
                             program, macro, preprocessor, comment, special, string_,
- char_, number, identifier, keyword, qbk_phrase, escape,
+ char_, number, identifier, keyword, escape,
                             string_char;
 
- cl::symbols<> keyword_;
             quickbook_grammar& g;
- std::string save;
 
             cl::rule<Scanner> const&
             start() const { return program; }
@@ -188,7 +364,7 @@
             {
                 program
                     =
- *( (+cl::space_p) [space(self.out)]
+ *( (+cl::space_p) [plain_char(self.out)]
                     | macro
                     | escape
                     | comment
@@ -209,24 +385,14 @@
>> self.escape_actions.macro [do_macro_action(self.out, self.escape_actions)]
                     ;
 
- qbk_phrase =
- self.escape_actions.scoped_context(element_info::in_phrase)
- [
- *( g.common
- | (cl::anychar_p - cl::str_p("``"))
- [self.escape_actions.plain_char]
- )
- ]
- ;
-
                 escape =
- cl::str_p("``") [pre_escape_back(self.escape_actions, save)]
+ cl::str_p("``") [pre_escape_back(self.escape_actions)]
>>
                     (
                         (
                             (
                                 (+(cl::anychar_p - "``") >> cl::eps_p("``"))
- & qbk_phrase
+ & g.phrase
                             )
>> cl::str_p("``")
                         )
@@ -235,38 +401,22 @@
                             cl::eps_p [self.escape_actions.error]
>> *cl::anychar_p
                         )
- ) [post_escape_back(self.out, self.escape_actions, save)]
+ ) [post_escape_back(self.out, self.escape_actions)]
                     ;
 
                 comment
                     = cl::str_p("#") [span_start("comment", self.out)]
>> *( escape
                         | (+(cl::anychar_p - (cl::eol_p | "``")))
- [span(0, self.out)]
+ [plain_char(self.out)]
                         )
>> cl::eps_p [span_end(self.out)]
                     ;
 
                 keyword
- = keyword_ >> (cl::eps_p - (cl::alnum_p | '_'))
+ = keywords.python >> (cl::eps_p - (cl::alnum_p | '_'))
                     ; // make sure we recognize whole words only
 
- keyword_
- =
- "and", "del", "for", "is", "raise",
- "assert", "elif", "from", "lambda", "return",
- "break", "else", "global", "not", "try",
- "class", "except", "if", "or", "while",
- "continue", "exec", "import", "pass", "yield",
- "def", "finally", "in", "print",
-
- // Technically "as" and "None" are not yet keywords (at Python
- // 2.4). They are destined to become keywords, and we treat them
- // as such for syntax highlighting purposes.
-
- "as", "None"
- ;
-
                 special
                     = +cl::chset_p("~!%^&*()+={[}]:;,<.>/|\\-")
                     ;
@@ -310,11 +460,9 @@
             cl::rule<Scanner>
                             program, macro, comment, special, string_, string_prefix,
                             short_string, long_string, number, identifier, keyword,
- qbk_phrase, escape, string_char;
+ escape, string_char;
 
- cl::symbols<> keyword_;
             quickbook_grammar& g;
- std::string save;
 
             cl::rule<Scanner> const&
             start() const { return program; }
@@ -341,7 +489,7 @@
                     =
                     *( macro
                     | escape
- | cl::repeat_p(1)[cl::anychar_p] [plain_char_action(self.out, self.escape_actions)]
+ | cl::repeat_p(1)[cl::anychar_p] [plain_char(self.out)]
                     )
                     ;
 
@@ -352,24 +500,14 @@
>> self.escape_actions.macro [do_macro_action(self.out, self.escape_actions)]
                     ;
 
- qbk_phrase =
- self.escape_actions.scoped_context(element_info::in_phrase)
- [
- *( g.common
- | (cl::anychar_p - cl::str_p("``"))
- [self.escape_actions.plain_char]
- )
- ]
- ;
-
                 escape =
- cl::str_p("``") [pre_escape_back(self.escape_actions, save)]
+ cl::str_p("``") [pre_escape_back(self.escape_actions)]
>>
                     (
                         (
                             (
                                 (+(cl::anychar_p - "``") >> cl::eps_p("``"))
- & qbk_phrase
+ & g.phrase
                             )
>> cl::str_p("``")
                         )
@@ -378,14 +516,13 @@
                             cl::eps_p [self.escape_actions.error]
>> *cl::anychar_p
                         )
- ) [post_escape_back(self.out, self.escape_actions, save)]
+ ) [post_escape_back(self.out, self.escape_actions)]
                     ;
             }
 
- cl::rule<Scanner> program, macro, qbk_phrase, escape;
+ cl::rule<Scanner> program, macro, escape;
 
             quickbook_grammar& g;
- std::string save;
 
             cl::rule<Scanner> const&
             start() const { return program; }
@@ -396,7 +533,8 @@
     };
 
     std::string syntax_highlight(
- iterator first, iterator last,
+ parse_iterator first,
+ parse_iterator last,
         actions& escape_actions,
         std::string const& source_mode)
     {

Modified: trunk/tools/quickbook/src/template_stack.cpp
==============================================================================
--- trunk/tools/quickbook/src/template_stack.cpp (original)
+++ trunk/tools/quickbook/src/template_stack.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -9,6 +9,7 @@
 
 #include <cassert>
 #include "template_stack.hpp"
+#include "files.hpp"
 
 #ifdef BOOST_MSVC
 #pragma warning(disable : 4355)
@@ -16,29 +17,28 @@
 
 namespace quickbook
 {
- template_body::template_body(
+ template_symbol::template_symbol(
+ std::string const& identifier,
+ std::vector<std::string> const& params,
             value const& content,
- fs::path const& filename,
- content_type type
- )
- : content(content)
- , filename(filename)
- , type(type)
+ template_scope const* lexical_parent)
+ : identifier(identifier)
+ , params(params)
+ , content(content)
+ , lexical_parent(lexical_parent)
     {
         assert(content.get_tag() == template_tags::block ||
- content.get_tag() == template_tags::phrase);
- }
-
- bool template_body::is_block() const
- {
- return content.get_tag() == template_tags::block;
+ content.get_tag() == template_tags::phrase ||
+ content.get_tag() == template_tags::snippet);
     }
 
     template_stack::template_stack()
         : scope(template_stack::parser(*this))
         , scopes()
+ , parent_1_4(0)
     {
         scopes.push_front(template_scope());
+ parent_1_4 = &scopes.front();
     }
     
     template_symbol* template_stack::find(std::string const& symbol) const
@@ -68,11 +68,10 @@
         return scopes.front();
     }
     
- // TODO: Should symbols defined by '[import]' use the current scope?
     bool template_stack::add(template_symbol const& ts)
     {
         BOOST_ASSERT(!scopes.empty());
- BOOST_ASSERT(ts.parent);
+ BOOST_ASSERT(ts.lexical_parent);
         
         if (this->find_top_scope(ts.identifier)) {
             return false;
@@ -88,17 +87,32 @@
     {
         template_scope const& old_front = scopes.front();
         scopes.push_front(template_scope());
- set_parent_scope(old_front);
+ scopes.front().parent_1_4 = parent_1_4;
+ scopes.front().parent_scope = &old_front;
+ parent_1_4 = &scopes.front();
     }
 
     void template_stack::pop()
     {
+ parent_1_4 = scopes.front().parent_1_4;
         scopes.pop_front();
     }
 
- void template_stack::set_parent_scope(template_scope const& parent)
+ void template_stack::start_template(template_symbol const* symbol)
     {
- scopes.front().parent_scope = &parent;
+ // Quickbook 1.4-: When expanding the template continue to use the
+ // current scope (the dynamic scope).
+ // Quickbook 1.5+: Use the scope the template was defined in
+ // (the static scope).
+ if (symbol->content.get_file()->version() >= 105u)
+ {
+ parent_1_4 = scopes.front().parent_1_4;
+ scopes.front().parent_scope = symbol->lexical_parent;
+ }
+ else
+ {
+ scopes.front().parent_scope = scopes.front().parent_1_4;
+ }
     }
 }
 

Modified: trunk/tools/quickbook/src/template_stack.hpp
==============================================================================
--- trunk/tools/quickbook/src/template_stack.hpp (original)
+++ trunk/tools/quickbook/src/template_stack.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -12,6 +12,7 @@
 #include <string>
 #include <deque>
 #include <vector>
+#include <cassert>
 #include <boost/tuple/tuple.hpp>
 #include <boost/assert.hpp>
 #include <boost/spirit/include/classic_functor_parser.hpp>
@@ -26,22 +27,6 @@
 {
     namespace fs = boost::filesystem;
 
- struct template_body
- {
- enum content_type
- {
- quickbook,
- raw_output
- };
-
- template_body(value const&, fs::path const&, content_type = quickbook);
- bool is_block() const;
-
- stored_value content;
- fs::path filename;
- content_type type;
- };
-
     struct template_scope;
 
     struct template_symbol
@@ -49,44 +34,23 @@
         template_symbol(
                 std::string const& identifier,
                 std::vector<std::string> const& params,
- template_body const& body,
- template_scope const* parent = 0)
- : identifier(identifier)
- , params(params)
- , body(body)
- , parent(parent)
- , callouts() {}
-
- template_symbol(
- std::string const& identifier,
- std::vector<std::string> const& params,
                 value const& content,
- fs::path const& filename,
- template_scope const* parent = 0)
- : identifier(identifier)
- , params(params)
- , body(content, filename)
- , parent(parent)
- , callouts() {}
+ template_scope const* parent = 0);
 
         std::string identifier;
         std::vector<std::string> params;
- template_body body;
-
- // This is only used for quickbook 1.5+, 1.4 uses the dynamic scope.
- // TODO: I should probably call this something like lexical_parent
- // or static_parent for clarity.
- template_scope const* parent;
+ value content;
 
- stored_value callouts;
+ template_scope const* lexical_parent;
     };
 
     typedef boost::spirit::classic::symbols<template_symbol> template_symbols;
     
     // template scope
     //
- // 1.4-: parent_scope is the previous scope on the stack
- // (the template's dynamic parent).
+ // 1.4-: parent_scope is the previous scope on the dynamic
+ // lookup chain. This moves up the stack skipping
+ // 1.5 templates (but not 1.5 included files).
     // 1.5+: parent_scope is the template's lexical parent.
     //
     // This means that a search along the parent_scope chain will follow the
@@ -96,8 +60,9 @@
     
     struct template_scope
     {
- template_scope() : parent_scope() {}
+ template_scope() : parent_scope(), parent_1_4() {}
         template_scope const* parent_scope;
+ template_scope const* parent_1_4;
         template_symbols symbols;
     };
 
@@ -145,8 +110,7 @@
         void push();
         void pop();
 
- // Set the current scope's parent.
- void set_parent_scope(template_scope const&);
+ void start_template(template_symbol const*);
 
         boost::spirit::classic::functor_parser<parser> scope;
 
@@ -154,6 +118,7 @@
 
         friend struct parser;
         deque scopes;
+ template_scope const* parent_1_4;
     };
 }
 

Modified: trunk/tools/quickbook/src/template_tags.hpp
==============================================================================
--- trunk/tools/quickbook/src/template_tags.hpp (original)
+++ trunk/tools/quickbook/src/template_tags.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -19,6 +19,7 @@
         (identifier)
         (block)
         (phrase)
+ (snippet)
     )
 }
 

Modified: trunk/tools/quickbook/src/utils.cpp
==============================================================================
--- trunk/tools/quickbook/src/utils.cpp (original)
+++ trunk/tools/quickbook/src/utils.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -8,15 +8,9 @@
     http://www.boost.org/LICENSE_1_0.txt)
 =============================================================================*/
 #include "utils.hpp"
-#include "input_path.hpp"
-#include <boost/spirit/include/classic_core.hpp>
-#include <boost/filesystem/v3/fstream.hpp>
 
 #include <cctype>
 #include <cstring>
-#include <stdexcept>
-#include <fstream>
-#include <ostream>
 #include <map>
 
 namespace quickbook { namespace detail
@@ -44,11 +38,6 @@
         }
     }
 
- void print_space(char ch, std::ostream& out)
- {
- out << ch;
- }
-
     char filter_identifier_char(char ch)
     {
         if (!std::isalnum(static_cast<unsigned char>(ch)))
@@ -56,66 +45,6 @@
         return static_cast<char>(std::tolower(static_cast<unsigned char>(ch)));
     }
 
- // un-indent a code segment
- void unindent(std::string& program)
- {
- // Erase leading blank lines and newlines:
- std::string::size_type start = program.find_first_not_of(" \t");
- if (start != std::string::npos &&
- (program[start] == '\r' || program[start] == '\n'))
- {
- program.erase(0, start);
- }
- start = program.find_first_not_of("\r\n");
- program.erase(0, start);
-
- if (program.size() == 0)
- return; // nothing left to do
-
- // Get the first line indent
- std::string::size_type indent = program.find_first_not_of(" \t");
- std::string::size_type pos = 0;
- if (std::string::npos == indent)
- {
- // Nothing left to do here. The code is empty (just spaces).
- // We clear the program to signal the caller that it is empty
- // and return early.
- program.clear();
- return;
- }
-
- // Calculate the minimum indent from the rest of the lines
- do
- {
- pos = program.find_first_not_of("\r\n", pos);
- if (std::string::npos == pos)
- break;
-
- std::string::size_type n = program.find_first_not_of(" \t", pos);
- if (n != std::string::npos)
- {
- char ch = program[n];
- if (ch != '\r' && ch != '\n') // ignore empty lines
- indent = (std::min)(indent, n-pos);
- }
- }
- while (std::string::npos != (pos = program.find_first_of("\r\n", pos)));
-
- // Trim white spaces from column 0..indent
- pos = 0;
- program.erase(0, indent);
- while (std::string::npos != (pos = program.find_first_of("\r\n", pos)))
- {
- if (std::string::npos == (pos = program.find_first_not_of("\r\n", pos)))
- {
- break;
- }
-
- std::string::size_type next = program.find_first_of("\r\n", pos);
- program.erase(pos, (std::min)(indent, next-pos));
- }
- }
-
     std::string escape_uri(std::string uri)
     {
         for (std::string::size_type n = 0; n < uri.size(); ++n)
@@ -133,124 +62,7 @@
         }
         return uri;
     }
-
- // Read the first few bytes in a file to see it starts with a byte order
- // mark. If it doesn't, then write the characters we've already read in.
- // Although, given how UTF-8 works, if we've read anything in, the files
- // probably broken.
-
- template <typename InputIterator, typename OutputIterator>
- bool check_bom(InputIterator& begin, InputIterator end,
- OutputIterator out, char const* chars, int length)
- {
- char const* ptr = chars;
-
- while(begin != end && *begin == *ptr) {
- ++begin;
- ++ptr;
- --length;
- if(length == 0) return true;
- }
-
- // Failed to match, so write the skipped characters to storage:
- while(chars != ptr) *out++ = *chars++;
-
- return false;
- }
     
- template <typename InputIterator, typename OutputIterator>
- std::string read_bom(InputIterator& begin, InputIterator end,
- OutputIterator out)
- {
- if(begin == end) return "";
-
- const char* utf8 = "\xef\xbb\xbf" ;
- const char* utf32be = "\0\0\xfe\xff";
- const char* utf32le = "\xff\xfe\0\0";
-
- unsigned char c = *begin;
- switch(c)
- {
- case 0xEF: { // UTF-8
- return check_bom(begin, end, out, utf8, 3) ? "UTF-8" : "";
- }
- case 0xFF: // UTF-16/UTF-32 little endian
- return !check_bom(begin, end, out, utf32le, 2) ? "" :
- check_bom(begin, end, out, utf32le + 2, 2) ? "UTF-32" : "UTF-16";
- case 0: // UTF-32 big endian
- return check_bom(begin, end, out, utf32be, 4) ? "UTF-32" : "";
- case 0xFE: // UTF-16 big endian
- return check_bom(begin, end, out, utf32be + 2, 2) ? "UTF-16" : "";
- default:
- return "";
- }
- }
-
- // Copy a string, converting mac and windows style newlines to unix
- // newlines.
-
- template <typename InputIterator, typename OutputIterator>
- bool normalize(InputIterator begin, InputIterator end,
- OutputIterator out, fs::path const& filename)
- {
- std::string encoding = read_bom(begin, end, out);
-
- if(encoding != "UTF-8" && encoding != "") {
- outerr(filename) << encoding.c_str()
- << " is not supported. Please use UTF-8."
- << std::endl;
-
- return false;
- }
-
- while(begin != end) {
- if(*begin == '\r') {
- *out++ = '\n';
- ++begin;
- if(begin != end && *begin == '\n') ++begin;
- }
- else {
- *out++ = *begin++;
- }
- }
-
- return true;
- }
-
- int load(fs::path const& filename, std::string& storage)
- {
- using std::endl;
- using std::ios;
- using std::ifstream;
- using std::istream_iterator;
-
- fs::ifstream in(filename, std::ios_base::in);
-
- if (!in)
- {
- outerr(filename) << "Could not open input file." << endl;
- return 1;
- }
-
- // Turn off white space skipping on the stream
- in.unsetf(ios::skipws);
-
- if(!normalize(
- istream_iterator<char>(in),
- istream_iterator<char>(),
- std::back_inserter(storage),
- filename))
- {
- return 1;
- }
-
- // ensure that we have enough trailing newlines to eliminate
- // the need to check for end of file in the grammar.
- storage.push_back('\n');
- storage.push_back('\n');
- return 0;
- }
-
     file_type get_file_type(std::string const& extension)
     {
         static std::map<std::string, file_type> ftypes;
@@ -270,5 +82,3 @@
     }
 
 }}
-
-

Modified: trunk/tools/quickbook/src/utils.hpp
==============================================================================
--- trunk/tools/quickbook/src/utils.hpp (original)
+++ trunk/tools/quickbook/src/utils.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -11,22 +11,13 @@
 #define BOOST_SPIRIT_QUICKBOOK_UTILS_HPP
 
 #include <string>
-#include <cctype>
-#include <boost/assert.hpp>
-#include <boost/filesystem/v3/path.hpp>
+#include <ostream>
 #include <boost/range/algorithm_ext/push_back.hpp>
 #include <boost/range/adaptor/transformed.hpp>
 
-
-namespace quickbook {
-
- namespace fs = boost::filesystem;
-
-namespace detail
-{
+namespace quickbook { namespace detail {
     void print_char(char ch, std::ostream& out);
     void print_string(std::basic_string<char> const& str, std::ostream& out);
- void print_space(char ch, std::ostream& out);
     char filter_identifier_char(char ch);
 
     template <typename Range>
@@ -41,15 +32,8 @@
         return out_name;
     }
 
- // un-indent a code segment
- void unindent(std::string& program);
-
     std::string escape_uri(std::string uri);
 
- // load file into memory with extra trailing newlines to eliminate
- // the need to check for end of file in the grammar.
- int load(fs::path const& filename, std::string& storage);
-
     // given a file extension, return the type of the source file
     // we'll have an internal database for known file types.
 

Modified: trunk/tools/quickbook/src/values.cpp
==============================================================================
--- trunk/tools/quickbook/src/values.cpp (original)
+++ trunk/tools/quickbook/src/values.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -7,7 +7,7 @@
 =============================================================================*/
 
 #include "values.hpp"
-#include <boost/intrusive_ptr.hpp>
+#include "files.hpp"
 #include <boost/current_function.hpp>
 #include <boost/lexical_cast.hpp>
 
@@ -47,19 +47,17 @@
         value_node::~value_node() {
         }
         
- value_node* value_node::store() { return this; }
-
- file_position value_node::get_position() const { UNDEFINED_ERROR(); }
+ file_ptr value_node::get_file() const { UNDEFINED_ERROR(); }
+ string_iterator value_node::get_position() const { UNDEFINED_ERROR(); }
         int value_node::get_int() const { UNDEFINED_ERROR(); }
- std::string value_node::get_quickbook() const { UNDEFINED_ERROR(); }
- value_node::qbk_range value_node::get_quickbook_range() const { UNDEFINED_ERROR(); }
- std::string value_node::get_boostbook() const { UNDEFINED_ERROR(); }
+ string_ref value_node::get_quickbook() const { UNDEFINED_ERROR(); }
+ std::string value_node::get_encoded() const { UNDEFINED_ERROR(); }
         value_node* value_node::get_list() const { UNDEFINED_ERROR(); }
 
         bool value_node::empty() const { return false; }
         bool value_node::check() const { return true; }
         bool value_node::is_list() const { return false; }
- bool value_node::is_string() const { return false; }
+ bool value_node::is_encoded() const { return false; }
         bool value_node::equals(value_node*) const { UNDEFINED_ERROR(); }
     }
 
@@ -90,7 +88,7 @@
             bool empty() const { UNDEFINED_ERROR(); }
             bool check() const { UNDEFINED_ERROR(); }
             bool is_list() const { UNDEFINED_ERROR(); }
- bool is_string() const { UNDEFINED_ERROR(); }
+ bool is_encoded() const { UNDEFINED_ERROR(); }
         };
 
         value_list_end_impl value_list_end_impl::instance;
@@ -104,19 +102,19 @@
 
     namespace detail
     {
- struct value_empty_impl : public value_node
+ struct empty_value_impl : public value_node
         {
             static value_node* new_(value::tag_type t);
 
         protected:
- explicit value_empty_impl(value::tag_type t)
+ explicit empty_value_impl(value::tag_type t)
                 : value_node(t) {}
 
         private:
             char const* type_name() const { return "empty"; }
         
             virtual value_node* clone() const
- { return new value_empty_impl(tag_); }
+ { return new empty_value_impl(tag_); }
 
             virtual bool empty() const
                 { return true; }
@@ -130,12 +128,12 @@
             friend value quickbook::empty_value(value::tag_type);
         };
     
- struct value_nil_impl : public value_empty_impl
+ struct value_nil_impl : public empty_value_impl
         {
             static value_nil_impl instance;
         private:
             value_nil_impl()
- : value_empty_impl(value::default_tag)
+ : empty_value_impl(value::default_tag)
             {
                 intrusive_ptr_add_ref(&instance);
                 next_ = &value_list_end_impl::instance;
@@ -144,7 +142,7 @@
 
         value_nil_impl value_nil_impl::instance;
 
- value_node* value_empty_impl::new_(value::tag_type t) {
+ value_node* empty_value_impl::new_(value::tag_type t) {
             // The return value from this function is always placed in an
             // intrusive_ptr which will manage the memory correctly.
             // Note that value_nil_impl increments its reference count
@@ -154,13 +152,13 @@
             if (t == value::default_tag)
                 return &value_nil_impl::instance;
             else
- return new value_empty_impl(t);
+ return new empty_value_impl(t);
         }
     }
 
     value empty_value(value::tag_type t)
     {
- return value(detail::value_empty_impl::new_(t));
+ return value(detail::empty_value_impl::new_(t));
     }
 
     ////////////////////////////////////////////////////////////////////////////
@@ -232,81 +230,57 @@
     }
 
     ////////////////////////////////////////////////////////////////////////////
- // stored_value
-
- stored_value::stored_value()
- : detail::value_counted()
- {
- }
-
- stored_value::stored_value(stored_value const& x)
- : detail::value_counted(x)
- {
- }
-
- stored_value::stored_value(detail::value_base const& x)
- : detail::value_counted(x.value_->store())
- {
- }
-
- stored_value& stored_value::operator=(stored_value x)
- {
- swap(x);
- return *this;
- }
-
- ////////////////////////////////////////////////////////////////////////////
     // Integers
 
     namespace detail
     {
- struct value_int_impl : public value_node
+ struct int_value_impl : public value_node
         {
         public:
- explicit value_int_impl(int, value::tag_type);
+ explicit int_value_impl(int, value::tag_type);
         private:
             char const* type_name() const { return "integer"; }
             virtual value_node* clone() const;
             virtual int get_int() const;
- virtual std::string get_quickbook() const;
- virtual std::string get_boostbook() const;
+ virtual std::string get_encoded() const;
             virtual bool empty() const;
+ virtual bool is_encoded() const;
             virtual bool equals(value_node*) const;
 
             int value_;
         };
 
- value_int_impl::value_int_impl(int v, value::tag_type t)
+ int_value_impl::int_value_impl(int v, value::tag_type t)
             : value_node(t)
             , value_(v)
         {}
 
- value_node* value_int_impl::clone() const
+ value_node* int_value_impl::clone() const
         {
- return new value_int_impl(value_, tag_);
+ return new int_value_impl(value_, tag_);
         }
 
- int value_int_impl::get_int() const
+ int int_value_impl::get_int() const
         {
             return value_;
         }
 
- std::string value_int_impl::get_quickbook() const
+ std::string int_value_impl::get_encoded() const
         {
             return boost::lexical_cast<std::string>(value_);
         }
 
- std::string value_int_impl::get_boostbook() const
+ bool int_value_impl::empty() const
         {
- return boost::lexical_cast<std::string>(value_);
+ return false;
         }
 
- bool value_int_impl::empty() const
+ bool int_value_impl::is_encoded() const
         {
- return false;
+ return true;
         }
 
- bool value_int_impl::equals(value_node* other) const {
+ bool int_value_impl::equals(value_node* other) const {
             try {
                 return value_ == other->get_int();
             }
@@ -318,7 +292,7 @@
 
     value int_value(int v, value::tag_type t)
     {
- return value(new detail::value_int_impl(v, t));
+ return value(new detail::int_value_impl(v, t));
     }
 
     ////////////////////////////////////////////////////////////////////////////
@@ -326,105 +300,79 @@
 
     namespace detail
     {
- struct value_string_impl : public value_node
+ struct encoded_value_impl : public value_node
         {
         public:
- explicit value_string_impl(std::string const&, value::tag_type);
+ explicit encoded_value_impl(std::string const&, value::tag_type);
         private:
- char const* type_name() const { return "boostbook"; }
+ char const* type_name() const { return "encoded text"; }
 
- virtual ~value_string_impl();
+ virtual ~encoded_value_impl();
             virtual value_node* clone() const;
- virtual std::string get_boostbook() const;
- virtual bool is_string() const;
+ virtual std::string get_encoded() const;
             virtual bool empty() const;
+ virtual bool is_encoded() const;
             virtual bool equals(value_node*) const;
 
             std::string value_;
         };
     
- struct value_qbk_string_impl : public value_node
+ struct qbk_value_impl : public value_node
         {
         public:
- explicit value_qbk_string_impl(
- std::string const&, file_position, value::tag_type);
- explicit value_qbk_string_impl(
- quickbook::iterator begin, quickbook::iterator end,
+ explicit qbk_value_impl(
+ file_ptr const&,
+ string_iterator begin,
+ string_iterator end,
                     value::tag_type);
         private:
             char const* type_name() const { return "quickbook"; }
 
- virtual ~value_qbk_string_impl();
- virtual value_node* clone() const;
- virtual file_position get_position() const;
- virtual std::string get_quickbook() const;
- qbk_range get_quickbook_range() const;
- virtual bool is_string() const;
- virtual bool empty() const;
- virtual bool equals(value_node*) const;
-
- std::string value_;
- file_position position_;
- };
-
- struct value_qbk_ref_impl : public value_node
- {
- public:
- explicit value_qbk_ref_impl(quickbook::iterator begin, quickbook::iterator end, value::tag_type);
- private:
- char const* type_name() const { return "quickbook"; }
-
- virtual ~value_qbk_ref_impl();
+ virtual ~qbk_value_impl();
             virtual value_node* clone() const;
- virtual value_node* store();
- virtual file_position get_position() const;
- virtual std::string get_quickbook() const;
- qbk_range get_quickbook_range() const;
- virtual bool is_string() const;
+ virtual file_ptr get_file() const;
+ virtual string_iterator get_position() const;
+ virtual string_ref get_quickbook() const;
             virtual bool empty() const;
             virtual bool equals(value_node*) const;
 
- quickbook::iterator begin_;
- quickbook::iterator end_;
+ file_ptr file_;
+ string_iterator begin_;
+ string_iterator end_;
         };
     
- struct value_qbk_bbk_impl : public value_node
+ struct encoded_qbk_value_impl : public value_node
         {
         private:
- char const* type_name() const { return "quickbook/boostbook"; }
+ char const* type_name() const { return "encoded text with quickbook reference"; }
 
- value_qbk_bbk_impl(
- std::string const& qbk, std::string const& bbk,
- file_position const&, value::tag_type);
- value_qbk_bbk_impl(std::string const&, value::tag_type);
- value_qbk_bbk_impl(
- quickbook::iterator, quickbook::iterator,
+ encoded_qbk_value_impl(file_ptr const&,
+ string_iterator, string_iterator,
                     std::string const&, value::tag_type);
     
- virtual ~value_qbk_bbk_impl();
+ virtual ~encoded_qbk_value_impl();
             virtual value_node* clone() const;
- virtual file_position get_position() const;
- virtual std::string get_quickbook() const;
- qbk_range get_quickbook_range() const;
- virtual std::string get_boostbook() const;
- virtual bool is_string() const;
+ virtual file_ptr get_file() const;
+ virtual string_iterator get_position() const;
+ virtual string_ref get_quickbook() const;
+ virtual std::string get_encoded() const;
             virtual bool empty() const;
+ virtual bool is_encoded() const;
             virtual bool equals(value_node*) const;
 
- std::string qbk_value_;
- std::string bbk_value_;
- file_position position_;
+ file_ptr file_;
+ string_iterator begin_;
+ string_iterator end_;
+ std::string encoded_value_;
             
- friend quickbook::value quickbook::qbk_bbk_value(
- std::string const&, quickbook::value::tag_type);
- friend quickbook::value quickbook::qbk_bbk_value(
- quickbook::iterator, quickbook::iterator,
+ friend quickbook::value quickbook::encoded_qbk_value(
+ file_ptr const&, string_iterator, string_iterator,
                     std::string const&, quickbook::value::tag_type);
         };
 
- // value_string_impl
+ // encoded_value_impl
     
- value_string_impl::value_string_impl(
+ encoded_value_impl::encoded_value_impl(
                 std::string const& val,
                 value::tag_type tag
             )
@@ -432,125 +380,66 @@
         {
         }
     
- value_string_impl::~value_string_impl()
+ encoded_value_impl::~encoded_value_impl()
         {
         }
 
- value_node* value_string_impl::clone() const
+ value_node* encoded_value_impl::clone() const
         {
- return new value_string_impl(value_, tag_);
+ return new encoded_value_impl(value_, tag_);
         }
     
- std::string value_string_impl::get_boostbook() const
+ std::string encoded_value_impl::get_encoded() const
             { return value_; }
 
- bool value_string_impl::is_string() const
- { return true; }
-
- bool value_string_impl::empty() const
+ bool encoded_value_impl::empty() const
             { return value_.empty(); }
 
- bool value_string_impl::equals(value_node* other) const {
- try {
- return value_ == other->get_boostbook();
- }
- catch(value_undefined_method&) {
- return false;
- }
- }
-
- // value_qbk_string_impl
-
- value_qbk_string_impl::value_qbk_string_impl(
- std::string const& v,
- file_position p,
- value::tag_type tag)
- : value_node(tag)
- , value_(v)
- , position_(p)
- {}
-
- value_qbk_string_impl::value_qbk_string_impl(
- quickbook::iterator begin, quickbook::iterator end,
- value::tag_type tag)
- : value_node(tag)
- , value_(begin, end)
- , position_(begin.get_position())
- {}
-
- value_qbk_string_impl::~value_qbk_string_impl()
- {}
-
- value_node* value_qbk_string_impl::clone() const
- {
- return new value_qbk_string_impl(value_, position_, tag_);
- }
-
- file_position value_qbk_string_impl::get_position() const
- { return position_; }
-
- std::string value_qbk_string_impl::get_quickbook() const
- { return value_; }
-
- value::qbk_range value_qbk_string_impl::get_quickbook_range() const
- { return qbk_range(
- iterator(value_.begin(), position_),
- iterator(value_.end())); }
-
- bool value_qbk_string_impl::is_string() const
+ bool encoded_value_impl::is_encoded() const
             { return true; }
 
- bool value_qbk_string_impl::empty() const
- { return value_.empty(); }
-
- bool value_qbk_string_impl::equals(value_node* other) const {
+ bool encoded_value_impl::equals(value_node* other) const {
             try {
- return value_ == other->get_quickbook();
+ return value_ == other->get_encoded();
             }
             catch(value_undefined_method&) {
                 return false;
             }
         }
 
- // value_qbk_ref_impl
+ // qbk_value_impl
     
- value_qbk_ref_impl::value_qbk_ref_impl(
- quickbook::iterator begin, quickbook::iterator end,
+ qbk_value_impl::qbk_value_impl(
+ file_ptr const& f,
+ string_iterator begin,
+ string_iterator end,
                 value::tag_type tag
- ) : value_node(tag), begin_(begin), end_(end)
+ ) : value_node(tag), file_(f), begin_(begin), end_(end)
         {
         }
     
- value_qbk_ref_impl::~value_qbk_ref_impl()
+ qbk_value_impl::~qbk_value_impl()
         {
         }
     
- value_node* value_qbk_ref_impl::clone() const
+ value_node* qbk_value_impl::clone() const
         {
- return new value_qbk_ref_impl(begin_, end_, tag_);
+ return new qbk_value_impl(file_, begin_, end_, tag_);
         }
 
- value_node* value_qbk_ref_impl::store()
- {
- return new value_qbk_string_impl(begin_, end_, tag_);
- }
+ file_ptr qbk_value_impl::get_file() const
+ { return file_; }
 
- file_position value_qbk_ref_impl::get_position() const
- { return begin_.get_position(); }
+ string_iterator qbk_value_impl::get_position() const
+ { return begin_; }
 
- std::string value_qbk_ref_impl::get_quickbook() const
- { return std::string(begin_.base(), end_.base()); }
+ string_ref qbk_value_impl::get_quickbook() const
+ { return string_ref(begin_, end_); }
 
- value::qbk_range value_qbk_ref_impl::get_quickbook_range() const
- { return qbk_range(begin_, end_); }
-
- bool value_qbk_ref_impl::is_string() const
- { return true; }
-
- bool value_qbk_ref_impl::empty() const
+ bool qbk_value_impl::empty() const
             { return begin_ == end_; }
     
- bool value_qbk_ref_impl::equals(value_node* other) const {
+ bool qbk_value_impl::equals(value_node* other) const {
             try {
                 return this->get_quickbook() == other->get_quickbook();
             }
@@ -559,83 +448,60 @@
             }
         }
 
- // value_qbk_bbk_impl
+ // encoded_qbk_value_impl
     
- value_qbk_bbk_impl::value_qbk_bbk_impl(
- std::string const& qbk,
- std::string const& bbk,
- file_position const& pos,
+ encoded_qbk_value_impl::encoded_qbk_value_impl(
+ file_ptr const& f,
+ string_iterator begin,
+ string_iterator end,
+ std::string const& encoded,
                 value::tag_type tag)
             : value_node(tag)
- , qbk_value_(qbk)
- , bbk_value_(bbk)
- , position_(pos)
+ , file_(f)
+ , begin_(begin)
+ , end_(end)
+ , encoded_value_(encoded)
             
         {
         }
     
- value_qbk_bbk_impl::value_qbk_bbk_impl(
- quickbook::iterator begin,
- quickbook::iterator end,
- std::string const& bbk,
- value::tag_type tag)
- : value_node(tag)
- , qbk_value_(begin.base(), end.base())
- , bbk_value_(bbk)
- , position_(begin.get_position())
-
- {
- }
-
- value_qbk_bbk_impl::value_qbk_bbk_impl(
- std::string const& val,
- value::tag_type tag)
- : value_node(tag)
- , qbk_value_(val)
- , bbk_value_(val)
- , position_()
- {
- }
-
- value_qbk_bbk_impl::~value_qbk_bbk_impl()
+ encoded_qbk_value_impl::~encoded_qbk_value_impl()
         {
         }
 
- value_node* value_qbk_bbk_impl::clone() const
+ value_node* encoded_qbk_value_impl::clone() const
         {
- return new value_qbk_bbk_impl(
- qbk_value_, bbk_value_, position_, tag_);
+ return new encoded_qbk_value_impl(
+ file_, begin_, end_, encoded_value_, tag_);
         }
 
- file_position value_qbk_bbk_impl::get_position() const
- { return position_; }
+ file_ptr encoded_qbk_value_impl::get_file() const
+ { return file_; }
 
- std::string value_qbk_bbk_impl::get_quickbook() const
- { return qbk_value_; }
+ string_iterator encoded_qbk_value_impl::get_position() const
+ { return begin_; }
 
- value::qbk_range value_qbk_bbk_impl::get_quickbook_range() const
- { return qbk_range(
- iterator(qbk_value_.begin(), position_),
- iterator(qbk_value_.end())); }
+ string_ref encoded_qbk_value_impl::get_quickbook() const
+ { return string_ref(begin_, end_); }
 
- std::string value_qbk_bbk_impl::get_boostbook() const
- { return bbk_value_; }
-
- bool value_qbk_bbk_impl::is_string() const
- { return true; }
+ std::string encoded_qbk_value_impl::get_encoded() const
+ { return encoded_value_; }
 
         // Should this test the quickbook, the boostbook or both?
- bool value_qbk_bbk_impl::empty() const
- { return bbk_value_.empty(); }
+ bool encoded_qbk_value_impl::empty() const
+ { return encoded_value_.empty(); }
 
- bool value_qbk_bbk_impl::equals(value_node* other) const {
+ bool encoded_qbk_value_impl::is_encoded() const
+ { return true; }
+
+ bool encoded_qbk_value_impl::equals(value_node* other) const {
             try {
                 return this->get_quickbook() == other->get_quickbook();
             }
             catch(value_undefined_method&) {}
 
             try {
- return this->get_boostbook() == other->get_boostbook();
+ return this->get_encoded() == other->get_encoded();
             }
             catch(value_undefined_method&) {}
 
@@ -643,31 +509,21 @@
         }
     }
 
- value qbk_value(iterator x, iterator y, value::tag_type t)
+ value qbk_value(file_ptr const& f, string_iterator x, string_iterator y, value::tag_type t)
     {
- return value(new detail::value_qbk_ref_impl(x, y, t));
+ return value(new detail::qbk_value_impl(f, x, y, t));
     }
 
- value qbk_value(std::string const& x, file_position pos, value::tag_type t)
+ value encoded_value(std::string const& x, value::tag_type t)
     {
- return value(new detail::value_qbk_string_impl(x, pos, t));
+ return value(new detail::encoded_value_impl(x, t));
     }
 
- value bbk_value(std::string const& x, value::tag_type t)
- {
- return value(new detail::value_string_impl(x, t));
- }
-
- value qbk_bbk_value(std::string const& x, value::tag_type t)
- {
- return value(new detail::value_qbk_bbk_impl(x,t));
- }
-
- value qbk_bbk_value(
- iterator x, iterator y,
+ value encoded_qbk_value(
+ file_ptr const& f, string_iterator x, string_iterator y,
             std::string const& z, value::tag_type t)
     {
- return value(new detail::value_qbk_bbk_impl(x,y,z,t));
+ return value(new detail::encoded_qbk_value_impl(f,x,y,z,t));
     }
 
     //////////////////////////////////////////////////////////////////////////
@@ -789,7 +645,6 @@
 
             virtual ~value_list_impl();
             virtual value_node* clone() const;
- virtual value_node* store();
             virtual bool empty() const;
             virtual bool equals(value_node*) const;
 
@@ -825,35 +680,6 @@
             return new value_list_impl(*this);
         }
 
- value_node* value_list_impl::store()
- {
- value_node* pos = head_;
- boost::intrusive_ptr<value_node> new_node;
-
- for(;;) {
- if(pos == &value_list_end_impl::instance)
- return this;
- new_node = pos->store();
- if(new_node.get() != pos) break;
- pos = pos->next_;
- }
-
- value_list_builder build;
-
- value_node* pos2 = head_;
-
- for(;pos2 != pos; pos2 = pos2->next_)
- build.append(pos2);
-
- build.append(new_node.get());
- pos2 = pos2->next_;
-
- for(;pos2 != &value_list_end_impl::instance; pos2 = pos2->next_)
- build.append(pos2->store());
-
- return new value_list_impl(build, tag_);
- }
-
         bool value_list_impl::empty() const
         {
             return head_ == &value_list_end_impl::instance;
@@ -979,6 +805,10 @@
         list_tag = value::default_tag;
     }
 
+ void value_builder::set_tag(value::tag_type tag) {
+ list_tag = tag;
+ }
+
     void value_builder::insert(value const& item) {
         current.append(item.value_);
     }

Modified: trunk/tools/quickbook/src/values.hpp
==============================================================================
--- trunk/tools/quickbook/src/values.hpp (original)
+++ trunk/tools/quickbook/src/values.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -16,14 +16,14 @@
 #include <cassert>
 #include <boost/scoped_ptr.hpp>
 #include <boost/iterator/iterator_traits.hpp>
-#include <boost/range/iterator_range.hpp>
 #include <stdexcept>
 #include "fwd.hpp"
+#include "string_ref.hpp"
+#include "files.hpp"
 
 namespace quickbook
 {
     struct value;
- struct stored_value;
     struct value_builder;
     struct value_error;
 
@@ -40,7 +40,6 @@
 
         public:
             typedef int tag_type;
- typedef boost::iterator_range<quickbook::iterator> qbk_range;
 
         protected:
             explicit value_node(tag_type);
@@ -49,18 +48,17 @@
         public:
             virtual char const* type_name() const = 0;
             virtual value_node* clone() const = 0;
- virtual value_node* store();
 
- virtual file_position get_position() const;
- virtual std::string get_quickbook() const;
- virtual std::string get_boostbook() const;
- virtual qbk_range get_quickbook_range() const;
+ virtual file_ptr get_file() const;
+ virtual string_iterator get_position() const;
+ virtual string_ref get_quickbook() const;
+ virtual std::string get_encoded() const;
             virtual int get_int() const;
 
             virtual bool check() const;
             virtual bool empty() const;
+ virtual bool is_encoded() const;
             virtual bool is_list() const;
- virtual bool is_string() const;
             virtual bool equals(value_node*) const;
 
             virtual value_node* get_list() const;
@@ -89,7 +87,6 @@
             typedef iterator const_iterator;
             typedef value_node::tag_type tag_type;
             enum { default_tag = 0 };
- typedef boost::iterator_range<quickbook::iterator> qbk_range;
 
         protected:
             explicit value_base(value_node* base)
@@ -104,22 +101,22 @@
         public:
             bool check() const { return value_->check(); }
             bool empty() const { return value_->empty(); }
+ bool is_encoded() const { return value_->is_encoded(); }
             bool is_list() const { return value_->is_list(); }
- bool is_string() const { return value_->is_string(); }
 
             iterator begin() const;
             iterator end() const;
 
             // Item accessors
             int get_tag() const { return value_->tag_; }
- file_position get_position() const
+ file_ptr get_file() const
+ { return value_->get_file(); }
+ string_iterator get_position() const
             { return value_->get_position(); }
- std::string get_quickbook() const
+ string_ref get_quickbook() const
             { return value_->get_quickbook(); }
- qbk_range get_quickbook_range() const
- { return value_->get_quickbook_range(); }
- std::string get_boostbook() const
- { return value_->get_boostbook(); }
+ std::string get_encoded() const
+ { return value_->get_encoded(); }
             int get_int() const
             { return value_->get_int(); }
 
@@ -134,7 +131,6 @@
             // value_builder needs to access 'value_' to get the node
             // from a value.
             friend struct quickbook::value_builder;
- friend struct quickbook::stored_value;
         };
         
         ////////////////////////////////////////////////////////////////////////
@@ -237,33 +233,27 @@
         void swap(value& x) { detail::value_counted::swap(x); }
     };
     
- struct stored_value : public detail::value_counted
- {
- public:
- stored_value();
- stored_value(stored_value const&);
- stored_value(detail::value_base const&);
- stored_value& operator=(stored_value);
- void swap(stored_value& x) { detail::value_counted::swap(x); }
- };
-
     // Empty
     value empty_value(value::tag_type = value::default_tag);
 
     // Integers
     value int_value(int, value::tag_type = value::default_tag);
 
- // Boostbook and quickbook strings
- value qbk_value(iterator, iterator, value::tag_type = value::default_tag);
- value qbk_value(std::string const&,
- file_position = file_position(),
- value::tag_type = value::default_tag);
- value bbk_value(std::string const&, value::tag_type = value::default_tag);
- value qbk_bbk_value(std::string const&,
+ // String types
+
+ // Quickbook strings contain a reference to the original quickbook source.
+ value qbk_value(file_ptr const&, string_iterator, string_iterator,
             value::tag_type = value::default_tag);
- value qbk_bbk_value(iterator, iterator, std::string const&,
+
+ // Encoded strings are either plain text or boostbook.
+ value encoded_value(std::string const&,
             value::tag_type = value::default_tag);
 
+ // An encoded quickbook string is an encoded string that contains a
+ // reference to the quickbook source it was generated from.
+ value encoded_qbk_value(file_ptr const&, string_iterator, string_iterator,
+ std::string const&, value::tag_type = value::default_tag);
+
     ////////////////////////////////////////////////////////////////////////////
     // Value Builder
     //

Modified: trunk/tools/quickbook/src/values_parse.hpp
==============================================================================
--- trunk/tools/quickbook/src/values_parse.hpp (original)
+++ trunk/tools/quickbook/src/values_parse.hpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -44,7 +44,7 @@
             return true;
         }
 
- void success() { builder.finish_list(); }
+ void success(parse_iterator, parse_iterator) { builder.finish_list(); }
         void failure() { builder.clear_list(); }
 
         value_builder& builder;
@@ -57,24 +57,15 @@
             typedef void type;
         };
 
- value_entry(value_builder& b)
- : b(b) {}
+ value_entry(value_builder& b, file_ptr* current_file)
+ : b(b), current_file(current_file) {}
 
- template <typename Iterator>
- void operator()(Iterator begin, Iterator end,
+ void operator()(parse_iterator begin, parse_iterator end,
                 value::tag_type tag = value::default_tag) const
         {
- b.insert(qbk_value(begin, end, tag));
+ b.insert(qbk_value(*current_file, begin.base(), end.base(), tag));
         }
 
- template <typename Iterator>
- void operator()(Iterator begin, Iterator,
- std::string const& v,
- value::tag_type tag = value::default_tag) const
- {
- b.insert(qbk_value(v, begin.get_position(), tag));
- }
-
         void operator()(int v,
             value::tag_type tag = value::default_tag) const
         {
@@ -82,22 +73,9 @@
         }
 
         value_builder& b;
+ file_ptr* current_file;
     };
 
- struct value_reset
- {
- typedef void result_type;
-
- value_reset(value_builder& b)
- : b(b) {}
-
- void operator()() const {
- b.reset();
- }
-
- value_builder& b;
- };
-
     struct value_sort
     {
         typedef void result_type;
@@ -114,12 +92,11 @@
 
     struct value_parser
     {
- value_parser()
+ value_parser(file_ptr* current_file)
             : builder()
             , save(builder)
             , list(builder)
- , entry(builder)
- , reset(builder)
+ , entry(value_entry(builder, current_file))
             , sort(builder)
             {}
     
@@ -129,7 +106,6 @@
         scoped_parser<value_builder_save> save;
         scoped_parser<value_builder_list> list;
         ph::function<value_entry> entry;
- ph::function<value_reset> reset;
         ph::function<value_sort> sort;
     };
 }

Modified: trunk/tools/quickbook/test/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/test/Jamfile.v2 (original)
+++ trunk/tools/quickbook/test/Jamfile.v2 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -16,81 +16,100 @@
 build-project command-line ;
 build-project snippets ;
 build-project "include" ;
+build-project versions ;
 
 import quickbook-testing : quickbook-test quickbook-error-test ;
 
 test-suite quickbook.test :
- [ quickbook-test quickbook-manual ]
- [ quickbook-test code-block ]
- [ quickbook-test code-block-1 ]
- [ quickbook-test code-block-2 ]
- [ quickbook-test code-block-3 ]
- [ quickbook-test code-block-teletype ]
- [ quickbook-test code-block-cpp ]
- [ quickbook-test code-block-python ]
- [ quickbook-test code-snippet ]
- [ quickbook-test preformatted ]
- [ quickbook-test link ]
- [ quickbook-test escape ]
- [ quickbook-test templates ]
- [ quickbook-test templates_1_4 ]
- [ quickbook-test templates_1_5 ]
- [ quickbook-test template-section ]
- [ quickbook-test mismatched-brackets-1 ]
- [ quickbook-test mismatched-brackets-2 ]
- [ quickbook-error-test mismatched-brackets-3 ]
- [ quickbook-test xinclude : : : <quickbook-xinclude-base>../src ]
- [ quickbook-test import ]
- [ quickbook-test include_1_5 ]
- [ quickbook-test include_1_6 ]
- [ quickbook-test include_1_6-2 ]
- [ quickbook-test section_1_4 ]
- [ quickbook-test section_1_5 ]
- [ quickbook-test section_1_5-unclosed ]
- [ quickbook-test heading_1_1 ]
- [ quickbook-test heading_1_3 ]
- [ quickbook-test heading_1_6 ]
- [ quickbook-test identifier_1_5 ]
- [ quickbook-test identifier_1_6 ]
- [ quickbook-test para-test ]
- [ quickbook-test variablelist ]
- [ quickbook-test table_1_3 ]
- [ quickbook-test table_1_5 ]
- [ quickbook-test image_1_5 ]
- [ quickbook-test list_test ]
- [ quickbook-test cond_phrase ]
- [ quickbook-test macro ]
- [ quickbook-test callouts ]
- [ quickbook-test simple_markup ]
- [ quickbook-test xml-escape_1_2 ]
- [ quickbook-test xml-escape_1_5 ]
- [ quickbook-test blocks ]
- [ quickbook-test elements_1_5 ]
- [ quickbook-test elements_1_6 ]
- [ quickbook-test newline ]
- [ quickbook-test anchor ]
- [ quickbook-test command_line_macro : : : <quickbook-test-define>__macro__=*bold* ]
- [ quickbook-error-test fail-include ]
- [ quickbook-error-test fail-import ]
- [ quickbook-error-test fail-template-arguments1 ]
- [ quickbook-error-test fail-template-arguments2 ]
- [ quickbook-error-test fail-template-arguments3 ]
- [ quickbook-error-test fail-cpp-mismatched-escape ]
- [ quickbook-error-test fail-python-mismatched-escape ]
- [ quickbook-error-test fail-post-process ]
- [ quickbook-error-test fail-parse-error1 ]
- [ quickbook-error-test fail-parse-error2 ]
- [ quickbook-error-test fail-template-lookup1 ]
- [ quickbook-error-test fail-template-section-1 ]
- [ quickbook-error-test fail-template-section-2 ]
- [ quickbook-error-test fail-template-section-3 ]
- [ quickbook-error-test fail-unknown-quickbook-1 ]
- [ quickbook-error-test fail-unknown-quickbook-2 ]
- [ quickbook-error-test fail-unknown-quickbook-3 ]
- [ quickbook-error-test fail-mismatched-boostbook-escape ]
- [ quickbook-test utf-8 ]
- [ quickbook-test utf-8-bom ]
- [ quickbook-test unicode-escape ]
- [ quickbook-error-test utf-16be-bom ]
- [ quickbook-error-test utf-16le-bom ]
+ [ quickbook-test anchor-1_1 ]
+ [ quickbook-test anchor-1_6 ]
+ [ quickbook-test blocks-1_5 ]
+ [ quickbook-test callouts-1_5 ]
+ [ quickbook-test code-1_1 ]
+ [ quickbook-test code-1_5 ]
+ [ quickbook-test code_cpp-1_5 ]
+ [ quickbook-error-test code_cpp_mismatched_escape-1_4-fail ]
+ [ quickbook-test code_python-1_5 ]
+ [ quickbook-error-test code_python_mismatched_escape-1_4-fail ]
+ [ quickbook-test code_snippet-1_1 ]
+ [ quickbook-test code_teletype-1_5 ]
+ [ quickbook-test command_line_macro-1_1 : : :
+ <quickbook-test-define>__macro__=*bold* ]
+ [ quickbook-error-test command_line_macro-1_1-invalid :
+ command_line_macro-1_1.quickbook :
+ <testing.arg>'-Dsomething[]' ]
+ [ quickbook-test cond_phrase-1_5 ]
+ [ quickbook-test elements-1_5 ]
+ [ quickbook-test elements-1_6 ]
+ [ quickbook-test escape-1_1 ]
+ [ quickbook-test escape-1_6 ]
+ [ quickbook-error-test escape-mismatched-1_5-fail ]
+ [ quickbook-test heading-1_1 ]
+ [ quickbook-test heading-1_3 ]
+ [ quickbook-test heading-1_5 ]
+ [ quickbook-test heading-1_6 ]
+ [ quickbook-error-test heading_unclosed-1_4-fail ]
+ [ quickbook-test hr-1_5 ]
+ [ quickbook-test hr-1_6 ]
+ [ quickbook-test identifier-1_5 ]
+ [ quickbook-test identifier-1_6 ]
+ [ quickbook-test image-1_5 ]
+ [ quickbook-test image-1_6 ]
+ [ quickbook-error-test import-1_1-fail ]
+ [ quickbook-error-test include-1_1-fail ]
+ [ quickbook-test include-1_5 ]
+ [ quickbook-test include-1_6 ]
+ [ quickbook-test include2-1_6 ]
+ [ quickbook-error-test include_win_path-1_6-fail ]
+ [ quickbook-test link-1_1 ]
+ [ quickbook-test link-1_6 ]
+ [ quickbook-test list_test-1_5 ]
+ [ quickbook-test list_test-1_6 ]
+ [ quickbook-test macro-1_5 ]
+ [ quickbook-test macro-1_6 ]
+ [ quickbook-error-test mismatched_brackets-1_1-fail ]
+ [ quickbook-test mismatched_brackets1-1_1 ]
+ [ quickbook-test mismatched_brackets2-1_1 ]
+ [ quickbook-test newline-1_1 ]
+ [ quickbook-test para_test-1_5 ]
+ [ quickbook-error-test post_process-fail ]
+ [ quickbook-test preformatted-1_1 ]
+ [ quickbook-test preformatted-1_6 ]
+ [ quickbook-test role-1_6 ]
+ [ quickbook-test section-1_4 ]
+ [ quickbook-test section-1_5-unclosed ]
+ [ quickbook-test section-1_5 ]
+ [ quickbook-test simple_markup-1_5 ]
+ [ quickbook-test svg-1_1 ]
+ [ quickbook-test table-1_3 ]
+ [ quickbook-test table-1_5 ]
+ [ quickbook-test table-1_6 ]
+ [ quickbook-error-test template_arguments1-1_1-fail ]
+ [ quickbook-error-test template_arguments2-1_1-fail ]
+ [ quickbook-error-test template_arguments3-1_1-fail ]
+ [ quickbook-test template_section-1_5 ]
+ [ quickbook-error-test template_section1-1_5-fail ]
+ [ quickbook-error-test template_section2-1_5-fail ]
+ [ quickbook-error-test template_section3-1_5-fail ]
+ [ quickbook-test templates-1_3 ]
+ [ quickbook-test templates-1_4 ]
+ [ quickbook-test templates-1_5 ]
+ [ quickbook-test unicode_escape-1_5 ]
+ [ quickbook-test unmatched_element-1_5 ]
+ [ quickbook-test unmatched_element-1_6 ]
+ [ quickbook-error-test utf16be_bom-1_5-fail ]
+ [ quickbook-error-test utf16le_bom-1_5-fail ]
+ [ quickbook-test utf8-1_5 ]
+ [ quickbook-test utf8_bom-1_5 ]
+ [ quickbook-error-test variablelist-1_5-fail ]
+ [ quickbook-test variablelist-1_5 ]
+ [ quickbook-error-test version-0_1-fail ]
+ [ quickbook-error-test version-1_7-fail ]
+ [ quickbook-error-test version-2_0-fail ]
+ [ quickbook-test xinclude-1_1 : : : <quickbook-xinclude-base>../src ]
+ [ quickbook-test xmlbase-1_6 : : : <quickbook-xinclude-base>../src ]
+ [ quickbook-test xml_escape-1_2 ]
+ [ quickbook-test xml_escape-1_5 ]
+
+ [ quickbook-test quickbook_manual-1_4 ]
     ;

Deleted: trunk/tools/quickbook/test/anchor.quickbook
==============================================================================
--- trunk/tools/quickbook/test/anchor.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,50 +0,0 @@
-[article Anchor Test
-]
-
-[section Anchors]
-
-[#a1] A paragraph containing several anchors. [#a2] We want to make sure
-they appear in the correct place. [#a3]
-
-[heading This heading shouldn't pick up the previous anchor]
-
-[#a4]
-
-[heading This heading should pick up the previous anchor]
-
-[#a5]
-[heading And this one]
-
-[#a6][heading Also this one]
-
-[#a7][h3 Finally this]
-
-[#a8]
-
-[endsect]
-
-[#a9]
-[section Section Anchor]
-[#a10][section Nested Section]
-[endsect]
-[/ This anchor is invalid, I'm not sure what to do with it]
-[#a11]
-[endsect]
-
-[#a12][?__not_defined__ #a13]
-[section Conditional Section Anchor]
-[endsect]
-
-[section Lists]
-
-[#a14]
-
-* Item 1
-* Item 2
-* Nested List
- [#a15]
- * Nested Item 1
- * Nested Item 2
-* Item 3
-
-[endsect]
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/blocks.quickbook
==============================================================================
--- trunk/tools/quickbook/test/blocks.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,46 +0,0 @@
-[article Various blocks
-[quickbook 1.5]
-]
-
-[heading Blockquotes]
-
-Here's a blockquote:
-
-[:Blockquote.]
-
-And another:
-
-[:
-Blockquote first paragraph.
-
-Blockquote second paragraph.
-]
-
-[heading Admonitions]
-
-[warning Warning]
-[caution Caution]
-[important Important]
-[note Note]
-[tip Tip]
-
-[warning Warning first paragraph.
-
-Warning second paragraph.]
-
-[heading Blurb]
-
-[blurb Blurb]
-
-[heading Inline blocks]
-
-[: Blockquote containing a footnote[footnote Here it is!].]
-
-[/ Unfortunately footnotes currently can't contain blocks.]
-
-[/ Quickbook shouldn't think that this is a tip]
-[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

Deleted: trunk/tools/quickbook/test/code-block-1.quickbook
==============================================================================
--- trunk/tools/quickbook/test/code-block-1.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,16 +0,0 @@
-[article Code Block 1
-]
-
-[section A code block]
-
-A code block with proper indentation ;-)
-
- #include <iostream>
-
- int main()
- {
- std::cout << "Hello, World!" << std::endl;
- return 0;
- }
-
-[endsect]

Deleted: trunk/tools/quickbook/test/code-block-2.quickbook
==============================================================================
--- trunk/tools/quickbook/test/code-block-2.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,18 +0,0 @@
-[article Code Block 2
-]
-
-[section A code block]
-
-A code block with proper indentation ;-)
-
-``
- #include <iostream>
-
- int main()
- {
- std::cout << "Hello, World!" << std::endl;
- return 0;
- }
-``
-
-[endsect]

Deleted: trunk/tools/quickbook/test/code-block-cpp.quickbook
==============================================================================
--- trunk/tools/quickbook/test/code-block-cpp.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,22 +0,0 @@
-[article C++ Code Blocks
-[quickbook 1.5]
-]
-
- // No escape
- /* No escape */
- /* No escape
- * with newlines
- */
- // In Header: <``[@boost:/boost/optional/optional.hpp boost/optional/optional.hpp]``>
- /* In Header: <``[@boost:/boost/optional/optional.hpp boost/optional/optional.hpp]``> */
- /* Multiple escapes: ``/italic/``
- * ``_underline_````*bold*``
- */
-
-A badly formed comment:
-
- /* Oh dear
-
-A badly formed comment with an escape:
-
- /* Oh dear ``*bold*``

Deleted: trunk/tools/quickbook/test/code-block-python.quickbook
==============================================================================
--- trunk/tools/quickbook/test/code-block-python.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,8 +0,0 @@
-[article Python Code Blocks
-[quickbook 1.5]
-[source-mode python]
-]
-
- # No escape
- # Escape: ``*bold*``
- # Escape: ``_underline_````/italic/``

Deleted: trunk/tools/quickbook/test/code-block-teletype.quickbook
==============================================================================
--- trunk/tools/quickbook/test/code-block-teletype.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,14 +0,0 @@
-[article Code Block Teletype 1
- [quickbook 1.5]
-]
-
-[teletype]
-
-[section A code block]
-
-[def __text__ text]
-
- Just some plain __text__.
- ``With some *quickbook* thrown in?``
-
-[endsect]

Deleted: trunk/tools/quickbook/test/code-block.quickbook
==============================================================================
--- trunk/tools/quickbook/test/code-block.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,29 +0,0 @@
-[article Indented code blocks
- [quickbook 1.5]
- [source-mode teletype]
-]
-
-In a paragraph.
- Still in a paragraph.
-
- In a code block.
-
-Back in a paragraph.
-
- Code block line 1.
- Code block line 2.
- Code block line 3.
-
-Paragraph.
-
- Code block with no trailing blank lines.
-Paragraph.
-
-[heading Code blocks separated by comment]
-
- First code block.
-[/ Comment]
- Second code block.
- [/ Comment in second code block]
- Still second code block.
- [/ Comment trailing second code block]

Deleted: trunk/tools/quickbook/test/code-snippet.gold
==============================================================================
--- trunk/tools/quickbook/test/code-snippet.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,22 +0,0 @@
-<?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="code_snippets" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Code Snippets</title>
- <section id="code_snippets.a_code_snippet">
- <title>A code snippet</title>
- <para>
- Code snippets inlined in text, as in <code><phrase role="keyword">namespace</phrase>
- <phrase role="identifier">quickbook</phrase> <phrase role="special">{</phrase>
- <phrase role="keyword">static</phrase> <phrase role="keyword">const</phrase>
- <phrase role="keyword">int</phrase> <phrase role="identifier">value</phrase>
- <phrase role="special">=</phrase> <phrase role="number">0</phrase><phrase role="special">;</phrase>
- <phrase role="special">}</phrase></code>, should be properly formatted and
- not glued to the surrounding text.
- </para>
- <para>
- There shoud be no spacees around (<code><phrase role="keyword">this</phrase></code>),
- and spaces around <code><phrase role="keyword">this</phrase></code> code.
- </para>
- </section>
-</article>

Deleted: trunk/tools/quickbook/test/code-snippet.quickbook
==============================================================================
--- trunk/tools/quickbook/test/code-snippet.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,12 +0,0 @@
-[article Code Snippets
-]
-
-[section A code snippet]
-
-Code snippets inlined in text, as in `namespace quickbook { static const int
-value = 0; }`, should be properly formatted and not glued to the surrounding
-text.
-
-There shoud be no spacees around (`this`), and spaces around `this` code.
-
-[endsect]

Deleted: trunk/tools/quickbook/test/command_line_macro.gold
==============================================================================
--- trunk/tools/quickbook/test/command_line_macro.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,9 +0,0 @@
-<?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="command_line_macro" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Command Line Macro</title>
- <para>
- <emphasis role="bold">bold</emphasis>
- </para>
-</article>

Deleted: trunk/tools/quickbook/test/command_line_macro.quickbook
==============================================================================
--- trunk/tools/quickbook/test/command_line_macro.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,6 +0,0 @@
-[article Command Line Macro
-]
-
-[/ This test relies on __macro__ being defined at the command line.]
-
-__macro__
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/cond_phrase.gold
==============================================================================
--- trunk/tools/quickbook/test/cond_phrase.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,15 +0,0 @@
-<?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="coniditional_phrase_test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Coniditional Phrase Test</title>
- <para>
- This should show
- </para>
- <para>
- The should be no space inserted.
- </para>
- <para>
- <emphasis role="bold">Bold text</emphasis>
- </para>
-</article>

Deleted: trunk/tools/quickbook/test/cond_phrase.quickbook
==============================================================================
--- trunk/tools/quickbook/test/cond_phrase.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,12 +0,0 @@
-[article Coniditional Phrase Test
- [quickbook 1.5]
-]
-
-[def __defined__]
-
-[? __defined__ This should show]
-[? __undefined__ This should not show]
-
-The should be no sp[?__undefined__ just some junk]ace inserted.
-
-[? __defined__ [*Bold text]]
\ No newline at end of file

Modified: trunk/tools/quickbook/test/doc-info/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/test/doc-info/Jamfile.v2 (original)
+++ trunk/tools/quickbook/test/doc-info/Jamfile.v2 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -24,4 +24,11 @@
     [ quickbook-test copyright1 ]
     [ quickbook-error-test copyright-fail1 ]
     [ quickbook-error-test copyright-fail2 ]
+ [ quickbook-test id1-1.5 ]
+ [ quickbook-test title_trailing_space-1_1 ]
+ [ quickbook-test title_trailing_space-1_6 ]
+ [ quickbook-test empty_title-1_1 ]
+ [ quickbook-test empty_title-1_5 ]
+ [ quickbook-test empty_title-1_6 ]
+ [ quickbook-error-test missing_doc_info-1_6-fail ]
     ;

Modified: trunk/tools/quickbook/test/doc-info/escape-1.6.gold
==============================================================================
--- trunk/tools/quickbook/test/doc-info/escape-1.6.gold (original)
+++ trunk/tools/quickbook/test/doc-info/escape-1.6.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 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" lang="en"
-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_" 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: trunk/tools/quickbook/test/doc-info/source-mode-1.6.gold
==============================================================================
--- trunk/tools/quickbook/test/doc-info/source-mode-1.6.gold (original)
+++ trunk/tools/quickbook/test/doc-info/source-mode-1.6.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -1,9 +1,9 @@
 <?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="c___test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
+<article id="c_test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>C++ test</title>
   <articleinfo>
- <legalnotice id="c___test.legal">
+ <legalnotice id="c_test.legal">
       <para>
         <code><phrase role="keyword">def</phrase> <phrase role="identifier">foo</phrase><phrase
         role="special">(</phrase><phrase role="identifier">x</phrase><phrase role="special">):</phrase>
@@ -17,21 +17,33 @@
   <para>
 <programlisting>This shouldn't be highlighted.</programlisting>
   </para>
- <para>
+ <article id="c___source_mode_include" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>C++ source mode include</title>
+ <para>
 <programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">main</phrase><phrase role="special">()</phrase> <phrase role="special">{}</phrase></programlisting>
- </para>
+ </para>
+ </article>
   <para>
 <programlisting>This shouldn't be highlighted.</programlisting>
   </para>
- <para>
+ <article id="python_source_mode_include" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Python source mode include</title>
+ <para>
 <programlisting><phrase role="keyword">def</phrase> <phrase role="identifier">foo</phrase><phrase role="special">():</phrase></programlisting>
- </para>
+ </para>
+ </article>
   <para>
 <programlisting>This shouldn't be highlighted.</programlisting>
   </para>
- <para>
+ <article id="teletype_source_mode_include" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Teletype source mode include</title>
+ <para>
 <programlisting>This shouldn't be highlighted</programlisting>
- </para>
+ </para>
+ </article>
   <para>
 <programlisting>This shouldn't be highlighted.</programlisting>
   </para>

Modified: trunk/tools/quickbook/test/doc-info/source-mode-cpp-include.quickbook
==============================================================================
--- trunk/tools/quickbook/test/doc-info/source-mode-cpp-include.quickbook (original)
+++ trunk/tools/quickbook/test/doc-info/source-mode-cpp-include.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -1,5 +1,4 @@
-[article C++ source mode include
 [source-mode c++]
-]
+[article C++ source mode include]
 
 ```int main() {}```
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/elements_1_5.gold
==============================================================================
--- trunk/tools/quickbook/test/elements_1_5.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,12 +0,0 @@
-<?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="1_5_elements" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>1.5 Elements</title>
- <para>
- [ordered_list [item1][item2]]
- </para>
- <para>
- [itemized_list [item1][item2]]
- </para>
-</article>

Deleted: trunk/tools/quickbook/test/elements_1_5.quickbook
==============================================================================
--- trunk/tools/quickbook/test/elements_1_5.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,9 +0,0 @@
-[article 1.5 Elements
-[quickbook 1.5]
-]
-
-[/ elements from 1.6]
-
-[ordered_list [item1][item2]]
-
-[itemized_list [item1][item2]]

Deleted: trunk/tools/quickbook/test/elements_1_6.gold
==============================================================================
--- trunk/tools/quickbook/test/elements_1_6.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,30 +0,0 @@
-<?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="1_6_elements" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>1.6 Elements</title>
- <orderedlist>
- <listitem>
- <para>
- item1
- </para>
- </listitem>
- <listitem>
- <para>
- item2
- </para>
- </listitem>
- </orderedlist>
- <itemizedlist>
- <listitem>
- <para>
- item1
- </para>
- </listitem>
- <listitem>
- <para>
- item2
- </para>
- </listitem>
- </itemizedlist>
-</article>

Deleted: trunk/tools/quickbook/test/elements_1_6.quickbook
==============================================================================
--- trunk/tools/quickbook/test/elements_1_6.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,9 +0,0 @@
-[article 1.6 Elements
-[quickbook 1.6]
-]
-
-[/ elements from 1.6]
-
-[ordered_list [item1][item2]]
-
-[itemized_list [item1][item2]]

Deleted: trunk/tools/quickbook/test/empty.quickbook
==============================================================================

Deleted: trunk/tools/quickbook/test/escape.gold
==============================================================================
--- trunk/tools/quickbook/test/escape.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,26 +0,0 @@
-<?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="escape" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Escape</title>
- <section id="escape.escape">
- <title>Escape</title>
- <para>
- <emphasis>Da do do do. Da da da da. That's all I have to say to you.</emphasis>
- </para>
- <para>
- This letter &#x3B1; should have a space either side of it.
- </para>
- <para>
- These should be properly encoded: &gt; &lt; &quot;
- </para>
- <para>
- This <link linkend="$0">link</link> shouldn't be changed.
- </para>
- <para>
- Some other problematic links:
-<link linkend="$157">one</link>,
-<link linkend="$-256">two</link>,
-<link linkend="$text">three</link>.
- </para>
- </section>
-</article>

Deleted: trunk/tools/quickbook/test/escape.quickbook
==============================================================================
--- trunk/tools/quickbook/test/escape.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,28 +0,0 @@
-[article Escape
-]
-
-[section Escape]
-
-'''
-<emphasis>Da do do do. Da da da da. That's all I have to say to you.</emphasis>
-'''
-
-This letter '''&#x3B1;''' should have a space either side of it.
-
-These should be properly encoded: \> \< \"
-
-[/ The following tests are based on internal knowledge of
- how quickbook's id generator works. They make sure it
- doesn't mess up escaped docbook. ]
-
-'''This <link linkend="$0">link</link> shouldn't be changed.'''
-
-'''
-Some other problematic links:
-<link linkend="$157">one</link>,
-<link linkend="$-256">two</link>,
-<link linkend="$text">three</link>.
-'''
-
-[endsect]
-

Deleted: trunk/tools/quickbook/test/fail-cpp-mismatched-escape.quickbook
==============================================================================
--- trunk/tools/quickbook/test/fail-cpp-mismatched-escape.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,5 +0,0 @@
-[article Odd code markup. [quickbook 1.4] ]
-
-[c++]
-
- `` int main() {}

Deleted: trunk/tools/quickbook/test/fail-import.quickbook
==============================================================================
--- trunk/tools/quickbook/test/fail-import.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,11 +0,0 @@
-[article Expect import Fail
-]
-
-[section Failure]
-
-[import this-is-not-a-file.cpp]
-
-[endsect]
-
-
-

Deleted: trunk/tools/quickbook/test/fail-include.quickbook
==============================================================================
--- trunk/tools/quickbook/test/fail-include.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,11 +0,0 @@
-[article Expect xinclude Fail
-]
-
-[section Failure]
-
-[include this-is-not-a-file.qbk]
-
-[endsect]
-
-
-

Deleted: trunk/tools/quickbook/test/fail-mismatched-boostbook-escape.quickbook
==============================================================================
--- trunk/tools/quickbook/test/fail-mismatched-boostbook-escape.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,5 +0,0 @@
-[article Badly escaped boostbook
-[quickbook 1.5]
-]
-
-'''<emphasis>something</emphasis>
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/fail-parse-error1.quickbook
==============================================================================
--- trunk/tools/quickbook/test/fail-parse-error1.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,3 +0,0 @@
-[article Parse error [quickbook 1.4]]
-
-[heading Incomplete heading

Deleted: trunk/tools/quickbook/test/fail-parse-error2.quickbook
==============================================================================
--- trunk/tools/quickbook/test/fail-parse-error2.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,5 +0,0 @@
-[article Parse error [quickbook 1.4]]
-
-[variablelist Variable List
-[[1234]]
-]

Deleted: trunk/tools/quickbook/test/fail-post-process.quickbook
==============================================================================
--- trunk/tools/quickbook/test/fail-post-process.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,3 +0,0 @@
-[article Fail post process due to invalid embedded xml [quickbook 1.4] ]
-
-Invalid xml follows: '''<!--quickbook-escape-postfix--><>'''

Deleted: trunk/tools/quickbook/test/fail-python-mismatched-escape.quickbook
==============================================================================
--- trunk/tools/quickbook/test/fail-python-mismatched-escape.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,5 +0,0 @@
-[article Odd code markup. [quickbook 1.4] ]
-
-[python]
-
- print "Hello World." ``

Deleted: trunk/tools/quickbook/test/fail-template-arguments1.quickbook
==============================================================================
--- trunk/tools/quickbook/test/fail-template-arguments1.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,13 +0,0 @@
-[article Expect template to fail because there are too many arguments.
-]
-
-[template unary[x] [x]]
-
-[section Failure]
-
-[unary a..b ]
-
-[endsect]
-
-
-

Deleted: trunk/tools/quickbook/test/fail-template-arguments2.quickbook
==============================================================================
--- trunk/tools/quickbook/test/fail-template-arguments2.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,13 +0,0 @@
-[article Expect template to fail because there are not enough arguments.
-]
-
-[template ternary[x y z] [x][y][z]]
-
-[section Failure]
-
-[ternary a b ]
-
-[endsect]
-
-
-

Deleted: trunk/tools/quickbook/test/fail-template-arguments3.quickbook
==============================================================================
--- trunk/tools/quickbook/test/fail-template-arguments3.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,6 +0,0 @@
-[article Expect template to fail because there are not enough arguments on 1.5.
- [quickbook 1.5]
-]
-
-[template ternary[x y z] {[x]-[y]-[z]}]
-[ternary 1..2 3 4]
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/fail-template-lookup1.quickbook
==============================================================================
--- trunk/tools/quickbook/test/fail-template-lookup1.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,7 +0,0 @@
-[article Fail Template Lookup 1
- [quickbook 1.5]
-]
-
-[template test1[] [a]]
-[template test2[a] [test1]]
-[test2 1]
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/fail-template-section-1.quickbook
==============================================================================
--- trunk/tools/quickbook/test/fail-template-section-1.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,9 +0,0 @@
-[article Template should contain balanced sections
- [quickbook 1.5]
-]
-
-[template begin_no_end[]
-[section Test]
-]
-
-[begin_no_end]
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/fail-template-section-2.quickbook
==============================================================================
--- trunk/tools/quickbook/test/fail-template-section-2.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,10 +0,0 @@
-[article Template should contain balanced sections
- [quickbook 1.5]
-]
-
-[template end_before_begin[]
-[endsect]
-[section Test]
-]
-
-[end_before_begin]
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/fail-template-section-3.quickbook
==============================================================================
--- trunk/tools/quickbook/test/fail-template-section-3.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,9 +0,0 @@
-[article Template should contain balanced sections
- [quickbook 1.5]
-]
-
-[template end_no_begin[]
-[endsect]
-]
-
-[end_no_begin]
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/fail-unknown-quickbook-1.quickbook
==============================================================================
--- trunk/tools/quickbook/test/fail-unknown-quickbook-1.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,5 +0,0 @@
-[article Future version of quickbook
- [quickbook 1.7]
-]
-
-This should fail...
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/fail-unknown-quickbook-2.quickbook
==============================================================================
--- trunk/tools/quickbook/test/fail-unknown-quickbook-2.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,5 +0,0 @@
-[article Far future version of quickbook
- [quickbook 2.0]
-]
-
-This should fail...
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/fail-unknown-quickbook-3.quickbook
==============================================================================
--- trunk/tools/quickbook/test/fail-unknown-quickbook-3.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,5 +0,0 @@
-[article Non-existant version of quickbook
- [quickbook 0.1]
-]
-
-This should fail...
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/heading_1_6.quickbook
==============================================================================
--- trunk/tools/quickbook/test/heading_1_6.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,16 +0,0 @@
-[article Header
- [quickbook 1.6]
- [id header]
-]
-
-[heading Header Test]
-
-Paragraph.
-
-[heading:heading_id Heading with an id]
-
-Paragraph.
-
-[h3:heading_id2 Heading with an id]
-
-Paragraph.

Deleted: trunk/tools/quickbook/test/identifier_1_5.quickbook
==============================================================================
--- trunk/tools/quickbook/test/identifier_1_5.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,148 +0,0 @@
-[article Identifiers in quickbook 1.5
- [quickbook 1.5]
-]
-
-[heading Test heading with `code`]
-
-[heading Identifier 10]
-[heading Identifier 10]
-[table Identifier 10
-[[]]
-]
-
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having lots of headers]
-[heading Generate a really long id and duplicate it by having lots of headers]
-[heading Generate a really long id and duplicate it by having lots of headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having even more headers]
-[heading Generate a really long id and duplicate it by having even more headers]
-[heading Generate a really long id and duplicate it by having even more headers]
-[heading Generate a really long id and duplicate it by having several headers]
-
-[heading Generate a really long id and d4]
-[heading Generate a really long id and 15]
-[heading Generate a really long id and d4]
-[heading Generate a really long id and 15]
-
-[heading a2345678901234567890123456789012]
-[heading a2345678901234567890123456789012]
-[heading abcdefghijklmnopqrstuvwxyzabcdef]
-[heading abcdefghijklmnopqrstuvwxyzabcdef]
-[heading abcdefghijklmnopqrstuvwxyzabcdef]
-[heading abcdefghijklmnopqrstuvwxyzabcdef]
-
-[heading Markup in `heading` in *order* to test normalization]
-[heading Markup in `heading` in *order* to test normalization]
-[heading Markup in `heading` in *order* to test normalization]
-
-[section Identifier 10]
-
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having lots of headers]
-[heading Generate a really long id and duplicate it by having lots of headers]
-[heading Generate a really long id and duplicate it by having lots of headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having even more headers]
-[heading Generate a really long id and duplicate it by having even more headers]
-[heading Generate a really long id and duplicate it by having even more headers]
-[heading Generate a really long id and duplicate it by having several headers]
-
-[heading Generate a really long id and d4]
-[heading Generate a really long id and 15]
-[heading Generate a really long id and d4]
-[heading Generate a really long id and 15]
-
-[heading a2345678901234567890123456789012]
-[heading a2345678901234567890123456789012]
-[heading abcdefghijklmnopqrstuvwxyzabcdef]
-[heading abcdefghijklmnopqrstuvwxyzabcdef]
-[heading abcdefghijklmnopqrstuvwxyzabcdef]
-[heading abcdefghijklmnopqrstuvwxyzabcdef]
-
-[heading Markup in `heading` in *order* to test normalization]
-[heading Markup in `heading` in *order* to test normalization]
-[heading Markup in `heading` in *order* to test normalization]
-
-[table h3
-[[]]
-]
-
-[table h3
-[[]]
-]
-
-[endsect]
-
-[section Punctuation & stuff]
-
-[heading A + B]
-[heading A + B]
-
-[endsect]
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/identifier_1_6.quickbook
==============================================================================
--- trunk/tools/quickbook/test/identifier_1_6.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,148 +0,0 @@
-[article Identifiers in quickbook 1.6
- [quickbook 1.6]
-]
-
-[heading Test heading with `code`]
-
-[heading Identifier 10]
-[heading Identifier 10]
-[table Identifier 10
-[[]]
-]
-
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having lots of headers]
-[heading Generate a really long id and duplicate it by having lots of headers]
-[heading Generate a really long id and duplicate it by having lots of headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having even more headers]
-[heading Generate a really long id and duplicate it by having even more headers]
-[heading Generate a really long id and duplicate it by having even more headers]
-[heading Generate a really long id and duplicate it by having several headers]
-
-[heading Generate a really long id and d4]
-[heading Generate a really long id and 15]
-[heading Generate a really long id and d4]
-[heading Generate a really long id and 15]
-
-[heading a2345678901234567890123456789012]
-[heading a2345678901234567890123456789012]
-[heading abcdefghijklmnopqrstuvwxyzabcdef]
-[heading abcdefghijklmnopqrstuvwxyzabcdef]
-[heading abcdefghijklmnopqrstuvwxyzabcdef]
-[heading abcdefghijklmnopqrstuvwxyzabcdef]
-
-[heading Markup in `heading` in *order* to test normalization]
-[heading Markup in `heading` in *order* to test normalization]
-[heading Markup in `heading` in *order* to test normalization]
-
-[section Identifier 10]
-
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having lots of headers]
-[heading Generate a really long id and duplicate it by having lots of headers]
-[heading Generate a really long id and duplicate it by having lots of headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having too many headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having several headers]
-[heading Generate a really long id and duplicate it by having even more headers]
-[heading Generate a really long id and duplicate it by having even more headers]
-[heading Generate a really long id and duplicate it by having even more headers]
-[heading Generate a really long id and duplicate it by having several headers]
-
-[heading Generate a really long id and d4]
-[heading Generate a really long id and 15]
-[heading Generate a really long id and d4]
-[heading Generate a really long id and 15]
-
-[heading a2345678901234567890123456789012]
-[heading a2345678901234567890123456789012]
-[heading abcdefghijklmnopqrstuvwxyzabcdef]
-[heading abcdefghijklmnopqrstuvwxyzabcdef]
-[heading abcdefghijklmnopqrstuvwxyzabcdef]
-[heading abcdefghijklmnopqrstuvwxyzabcdef]
-
-[heading Markup in `heading` in *order* to test normalization]
-[heading Markup in `heading` in *order* to test normalization]
-[heading Markup in `heading` in *order* to test normalization]
-
-[table h3
-[[]]
-]
-
-[table h3
-[[]]
-]
-
-[endsect]
-
-[section Punctuation & stuff]
-
-[heading A + B]
-[heading A + B]
-
-[endsect]
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/image_1_5.gold
==============================================================================
--- trunk/tools/quickbook/test/image_1_5.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,64 +0,0 @@
-<?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="images_1_5" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Images 1.5</title>
- <para>
- <inlinemediaobject><imageobject><imagedata fileref="test.gif"></imagedata></imageobject>
- <textobject>
- <phrase>test</phrase>
- </textobject>
- </inlinemediaobject> <inlinemediaobject><imageobject><imagedata fileref="test this.gif"></imagedata></imageobject>
- <textobject>
- <phrase>test this</phrase>
- </textobject>
- </inlinemediaobject> <inlinemediaobject><imageobject><imagedata fileref="test&amp;this.gif"></imagedata></imageobject>
- <textobject>
- <phrase>test&amp;this</phrase>
- </textobject>
- </inlinemediaobject> <inlinemediaobject><imageobject><imagedata fileref="test.gif"
- height="10cm" width="10cm"></imagedata></imageobject>
- <textobject>
- <phrase>test</phrase>
- </textobject>
- </inlinemediaobject> <inlinemediaobject><imageobject><imagedata fileref="test.gif"></imagedata></imageobject>
- <textobject>
- <phrase>Foo</phrase>
- </textobject>
- </inlinemediaobject> <inlinemediaobject><imageobject><imagedata fileref="test.gif"></imagedata></imageobject>
- <textobject>
- <phrase>Foobie foobie foo</phrase>
- </textobject>
- </inlinemediaobject> <inlinemediaobject><imageobject><imagedata fileref="test.gif"></imagedata></imageobject>
- <textobject>
- <phrase>Foo &amp; bar</phrase>
- </textobject>
- </inlinemediaobject> <inlinemediaobject><imageobject><imagedata fileref="test.gif"
- height="10cm" width="10cm"></imagedata></imageobject>
- <textobject>
- <phrase>Foo</phrase>
- </textobject>
- </inlinemediaobject>
- </para>
- <para>
- <inlinemediaobject><imageobject><imagedata fileref="test.gif"></imagedata></imageobject>
- <textobject>
- <phrase>test</phrase>
- </textobject>
- </inlinemediaobject> <inlinemediaobject><imageobject><imagedata fileref="test.gif"></imagedata></imageobject>
- <textobject>
- <phrase>test</phrase>
- </textobject>
- </inlinemediaobject> <inlinemediaobject><imageobject><imagedata fileref="test.gif"></imagedata></imageobject>
- <textobject>
- <phrase>comment</phrase>
- </textobject>
- </inlinemediaobject>
- </para>
- <para>
- <inlinemediaobject><imageobject><imagedata fileref="test.gif" height="10cm" width="10cm"></imagedata></imageobject>
- <textobject>
- <phrase>test</phrase>
- </textobject>
- </inlinemediaobject>
- </para>
-</article>

Deleted: trunk/tools/quickbook/test/image_1_5.quickbook
==============================================================================
--- trunk/tools/quickbook/test/image_1_5.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,19 +0,0 @@
-[article Images 1.5
- [quickbook 1.5]
-]
-
-[$test.gif]
-[$test this.gif]
-[$test&this.gif]
-[$test.gif [width 10cm] [height 10cm]]
-[$test.gif [alt Foo]]
-[$test.gif [alt Foobie foobie foo]]
-[$test.gif [alt Foo & bar]]
-[$test.gif [alt Foo] [width 10cm] [height 10cm]]
-
-[$ [/comment] test.gif ]
-[$ [/comment] test.gif [/comment] ]
-[$ [/comment] test.gif [/comment] [alt comment] ]
-
-[/ This should warn about repeated attribute and then ignore it. ]
-[$test.gif [width 10cm] [height 10cm] [width 20cm]]

Deleted: trunk/tools/quickbook/test/include-sub.quickbook
==============================================================================
--- trunk/tools/quickbook/test/include-sub.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,6 +0,0 @@
-[article Include Test Sub Document
- [quickbook 1.5]
- [id include-sub]
-]
-
-[/ Empty. Shouldn't really need this comment.]

Deleted: trunk/tools/quickbook/test/include-sub2.quickbook
==============================================================================
--- trunk/tools/quickbook/test/include-sub2.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,9 +0,0 @@
-[/ I'm trying not to break existing behaviour even when buggy.
- In this case, this section will get an id using the title from
- the previous 'include'.]
-
-[section:test Test]
-
-Just testing.
-
-[endsect]
\ No newline at end of file

Modified: trunk/tools/quickbook/test/include/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/test/include/Jamfile.v2 (original)
+++ trunk/tools/quickbook/test/include/Jamfile.v2 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -14,6 +14,31 @@
 import quickbook-testing : quickbook-test quickbook-error-test ;
 
 test-suite quickbook.test :
+ [ quickbook-test import-basic-1.6 ]
     [ quickbook-test filename ]
     [ quickbook-test filename-path : : : <quickbook-test-include>sub ]
- ;
\ No newline at end of file
+ [ quickbook-test doc-title1-1.5 ]
+ [ quickbook-test doc-title1a-1.5 ]
+ [ quickbook-test section ]
+ [ quickbook-test section-unclosed ]
+ [ quickbook-test templates-1.5 ]
+ [ quickbook-test templates-1.6 ]
+ [ quickbook-test macros-1.5 ]
+ [ quickbook-test macros-1.6 ]
+ [ quickbook-test code-import ]
+ [ quickbook-test code-include ]
+ [ quickbook-test include-id-1.5 ]
+ [ quickbook-test include-id-1.6 ]
+ [ quickbook-test include_id_unbalanced-1_6 ]
+ [ quickbook-error-test section-fail1 ]
+ [ quickbook-error-test section-fail2 ]
+ [ quickbook-test in_section-1_5 ]
+ [ quickbook-test in_section-1_6 ]
+ [ quickbook-test compatibility-1_1 ]
+ [ quickbook-test compatibility-1_5 ]
+ [ quickbook-test compatibility-1_6 ]
+ [ quickbook-test source_mode-1_5 ]
+ [ quickbook-test source_mode-1_6 ]
+ [ quickbook-test nested_compatibility-1_5 ]
+ [ quickbook-test nested_compatibility-1_6 ]
+ ;

Deleted: trunk/tools/quickbook/test/include_1_5.gold
==============================================================================
--- trunk/tools/quickbook/test/include_1_5.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,30 +0,0 @@
-<?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="include-test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Include Test</title>
- <section id="include_test_sub_document.test">
- <title><link linkend="include_test_sub_document.test">Test</link></title>
- <para>
- Just testing.
- </para>
- </section>
- <section id="foo.test">
- <title><link linkend="foo.test">Test</link></title>
- <para>
- 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>

Deleted: trunk/tools/quickbook/test/include_1_5.quickbook
==============================================================================
--- trunk/tools/quickbook/test/include_1_5.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,16 +0,0 @@
-[article Include Test
- [quickbook 1.5]
- [id include-test]
-]
-
-[include include-sub.quickbook]
-[include include-sub2.quickbook]
-[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.]

Deleted: trunk/tools/quickbook/test/include_1_6-2.gold
==============================================================================
--- trunk/tools/quickbook/test/include_1_6-2.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,18 +0,0 @@
-<?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="include-test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Include Test</title>
- <section id="include-test.test">
- <title><link linkend="include-test.test">Test</link></title>
- <para>
- Just testing.
- </para>
- </section>
- <section id="foo.test">
- <title><link linkend="foo.test">Test</link></title>
- <para>
- Just testing.
- </para>
- </section>
-</article>

Deleted: trunk/tools/quickbook/test/include_1_6-2.quickbook
==============================================================================
--- trunk/tools/quickbook/test/include_1_6-2.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,8 +0,0 @@
-[article Include Test
- [quickbook 1.6]
- [id include-test]
-]
-
-[include include-sub.quickbook]
-[include include-sub2.quickbook]
-[include:foo include-sub2.quickbook]

Deleted: trunk/tools/quickbook/test/include_1_6.gold
==============================================================================
--- trunk/tools/quickbook/test/include_1_6.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,30 +0,0 @@
-<?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="include-test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Include Test</title>
- <section id="include-test.test">
- <title><link linkend="include-test.test">Test</link></title>
- <para>
- Just testing.
- </para>
- </section>
- <section id="foo.test">
- <title><link linkend="foo.test">Test</link></title>
- <para>
- 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>

Deleted: trunk/tools/quickbook/test/include_1_6.quickbook
==============================================================================
--- trunk/tools/quickbook/test/include_1_6.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,14 +0,0 @@
-[article Include Test
- [quickbook 1.6]
- [id include-test]
-]
-
-[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.]

Deleted: trunk/tools/quickbook/test/link.gold
==============================================================================
--- trunk/tools/quickbook/test/link.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,31 +0,0 @@
-<?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="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>
- <para>
- <ulink url="http://www.boost.org/">http://www.boost.org/> <ulink url="http://www.boost.org/">Boost</ulink>
- <link linkend="link-id">link-id</link> <link linkend="link-id">Link Text</link>
- <anchor id="link-id"/><functionname alt="foo">foo</functionname> <functionname
- 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">
- <title>Side-by-side links</title>
- <para>
- <link linkend="x">x</link> and <link linkend="y">y</link> are two distinct
- links, which should be separated by whitespace when they appear together as
- in <link linkend="x">x</link> <link linkend="y">y</link>. Also in <link linkend="x">x</link>
- <link linkend="y">y</link>, and in <link linkend="x">x</link> <link linkend="y">y</link>
- as well.
- </para>
- </section>
-</article>

Deleted: trunk/tools/quickbook/test/link.quickbook
==============================================================================
--- trunk/tools/quickbook/test/link.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,39 +0,0 @@
-[article Link tests
-]
-
-[section Different types of links]
-
-[@http://www.boost.org/]
-[@ http://www.boost.org/ Boost]
-[link link-id]
-[link link-id Link Text]
-[#link-id]
-[funcref foo]
-[funcref foo link text]
-[classref foo]
-[classref foo link text]
-[memberref foo]
-[memberref foo link text]
-[enumref foo]
-[enumref foo link text]
-[macroref foo]
-[macroref foo link text]
-[headerref foo]
-[headerref foo link text]
-[conceptref foo]
-[conceptref foo link text]
-[globalref foo]
-[globalref foo link text]
-
-[endsect]
-
-[section Side-by-side links]
-
-[link x] and [link y] are two distinct links, which should be separated by
-whitespace when they appear together as in [link x] [link y]. Also in [link x]
-[link y], and in
-[link x]
-[link y]
-as well.
-
-[endsect]

Deleted: trunk/tools/quickbook/test/list_test.gold
==============================================================================
--- trunk/tools/quickbook/test/list_test.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,263 +0,0 @@
-<?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="list_test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>List Test</title>
- <para>
- Simple list:
- </para>
- <itemizedlist>
- <listitem>
- <simpara>
- A
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- B
- </simpara>
- </listitem>
- </itemizedlist>
- <para>
- Simple list:
- </para>
- <orderedlist>
- <listitem>
- <simpara>
- A
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- B
- </simpara>
- </listitem>
- </orderedlist>
- <para>
- Two level list:
- </para>
- <itemizedlist>
- <listitem>
- <simpara>
- A
- <itemizedlist>
- <listitem>
- <simpara>
- A
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- B
- </simpara>
- </listitem>
- </itemizedlist>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- B
- <itemizedlist>
- <listitem>
- <simpara>
- A
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- B
- </simpara>
- </listitem>
- </itemizedlist>
- </simpara>
- </listitem>
- </itemizedlist>
- <para>
- Two level list:
- </para>
- <orderedlist>
- <listitem>
- <simpara>
- A
- <itemizedlist>
- <listitem>
- <simpara>
- A
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- B
- </simpara>
- </listitem>
- </itemizedlist>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- B
- <itemizedlist>
- <listitem>
- <simpara>
- A
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- B
- </simpara>
- </listitem>
- </itemizedlist>
- </simpara>
- </listitem>
- </orderedlist>
- <para>
- Three level list:
- </para>
- <orderedlist>
- <listitem>
- <simpara>
- A
- <itemizedlist>
- <listitem>
- <simpara>
- A
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- B
- <itemizedlist>
- <listitem>
- <simpara>
- C
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- D
- </simpara>
- </listitem>
- </itemizedlist>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- E
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- F
- <itemizedlist>
- <listitem>
- <simpara>
- G
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- H
- </simpara>
- </listitem>
- </itemizedlist>
- </simpara>
- </listitem>
- </itemizedlist>
- </simpara>
- </listitem>
- </orderedlist>
- <para>
- Three level list:
- </para>
- <orderedlist>
- <listitem>
- <simpara>
- A
- <itemizedlist>
- <listitem>
- <simpara>
- A
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- B
- <orderedlist>
- <listitem>
- <simpara>
- C
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- D
- </simpara>
- </listitem>
- </orderedlist>
- </simpara>
- </listitem>
- </itemizedlist>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- G
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- H
- </simpara>
- </listitem>
- </orderedlist>
- <para>
- Markup in list:
- </para>
- <itemizedlist>
- <listitem>
- <simpara>
- <emphasis role="bold">Bold</emphasis>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <emphasis role="bold">Bold</emphasis>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <quote>Quoted</quote>
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- <footnote id="list_test.f0">
- <para>
- Footnote
- </para>
- </footnote>
- </simpara>
- </listitem>
- </itemizedlist>
- <section id="list_test.list_immediately_following_markup">
- <title><link linkend="list_test.list_immediately_following_markup">List immediately
- following markup</link></title>
- <itemizedlist>
- <listitem>
- <simpara>
- One
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- Two
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- Three
- </simpara>
- </listitem>
- </itemizedlist>
- </section>
-</article>

Deleted: trunk/tools/quickbook/test/list_test.quickbook
==============================================================================
--- trunk/tools/quickbook/test/list_test.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,67 +0,0 @@
-[article List Test
-[quickbook 1.5]
-]
-
-Simple list:
-
-* A
-* B
-
-Simple list:
-
-# A
-# B
-
-Two level list:
-
-* A
- * A
- * B
-* B
- * A
- * B
-
-Two level list:
-
-# A
- * A
- * B
-# B
- * A
- * B
-
-Three level list:
-
-# A
- * A
- * B
- * C
- * D
- * E
- * F
- * G
- * H
-
-Three level list:
-
-# A
- * A
- * B
- # C
- # D
-# G
-# H
-
-Markup in list:
-
-* *Bold*
-* [*Bold]
-* ["Quoted]
-* [footnote Footnote]
-
-[section List immediately following markup]
-* One
-* Two
-* Three
-
-[endsect]

Deleted: trunk/tools/quickbook/test/macro.gold
==============================================================================
--- trunk/tools/quickbook/test/macro.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,14 +0,0 @@
-<?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="macro_test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Macro Test</title>
- <para>
- 1
- </para>
- <para>
- 2
- </para>
- <para>
- two
- </para>
-</article>

Deleted: trunk/tools/quickbook/test/macro.quickbook
==============================================================================
--- trunk/tools/quickbook/test/macro.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,16 +0,0 @@
-[article Macro Test
-[quickbook 1.5]
-]
-
-[def one 1]
-
-one
-
-[template foo[]
-
-[def two 2]
-two
-]
-
-[foo]
-two [/This shouldn't expand]
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/mismatched-brackets-1.gold
==============================================================================
--- trunk/tools/quickbook/test/mismatched-brackets-1.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,12 +0,0 @@
-<?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="mismatched_brackets" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Mismatched brackets</title>
- <para>
- [foo
- </para>
- <para>
- Eek
- </para>
-</article>

Deleted: trunk/tools/quickbook/test/mismatched-brackets-1.quickbook
==============================================================================
--- trunk/tools/quickbook/test/mismatched-brackets-1.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,7 +0,0 @@
-[article Mismatched brackets]
-
-[template foo Oops]
-
-[foo
-[template blah Eek]
-[blah]
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/mismatched-brackets-2.gold
==============================================================================
--- trunk/tools/quickbook/test/mismatched-brackets-2.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,9 +0,0 @@
-<?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="mismatched_brackets" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Mismatched brackets</title>
- <para>
- [foo Eek
- </para>
-</article>

Deleted: trunk/tools/quickbook/test/mismatched-brackets-2.quickbook
==============================================================================
--- trunk/tools/quickbook/test/mismatched-brackets-2.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,7 +0,0 @@
-[article Mismatched brackets]
-
-[template foo Oops]
-[template blah Eek]
-
-[foo
-[blah]
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/mismatched-brackets-3.quickbook
==============================================================================
--- trunk/tools/quickbook/test/mismatched-brackets-3.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,5 +0,0 @@
-[article Mismatched brackets]
-
-[template foo Oops]
-[template blah Eek
-[foo]

Deleted: trunk/tools/quickbook/test/newline.gold
==============================================================================
--- trunk/tools/quickbook/test/newline.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,24 +0,0 @@
-<?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="test_newlines" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Test newlines</title>
- <para>
- Line 1<sbr/> Line 2
- </para>
- <blockquote>
- <para>
- <quote>It is better to be approximately right than exactly wrong.</quote><sbr/>
- <emphasis>-- Old adage</emphasis>
- </para>
- </blockquote>
- <para>
- Line 1<sbr/> Line 2
- </para>
- <blockquote>
- <para>
- <quote>It is better to be approximately right than exactly wrong.</quote><sbr/>
- <emphasis>-- Old adage</emphasis>
- </para>
- </blockquote>
-</article>

Deleted: trunk/tools/quickbook/test/newline.quickbook
==============================================================================
--- trunk/tools/quickbook/test/newline.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,10 +0,0 @@
-[article Test newlines
-]
-
-Line 1\nLine 2
-
-[:["It is better to be approximately right than exactly wrong.]\n['-- Old adage]]
-
-Line 1[br]Line 2
-
-[:["It is better to be approximately right than exactly wrong.][br]['-- Old adage]]
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/para-test.gold
==============================================================================
--- trunk/tools/quickbook/test/para-test.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,75 +0,0 @@
-<?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="paragraph_test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Paragraph Test</title>
- <section id="paragraph_test.some_paragraphs">
- <title><link linkend="paragraph_test.some_paragraphs">Some Paragraphs</link></title>
- <para>
- Shouldn't be a code block.
- </para>
- <para>
- <emphasis role="bold">Should be bold</emphasis>.
- </para>
- <para>
- Should be a single paragraph.
- </para>
- <para>
- Single paragraph.
- </para>
- <para>
- Single paragraph.
- </para>
- <para>
- Single paragraph.
- </para>
- <para>
- Single paragraph.
- </para>
- <para>
- Lots of newlines round this paragraph.
- </para>
- <para>
- Last paragraph.
- </para>
- </section>
- <section id="paragraph_test.inside___breaking_comment__blocks">
- <title><link linkend="paragraph_test.inside___breaking_comment__blocks">Inside
- blocks</link></title>
- <variablelist>
- <title></title>
- <varlistentry>
- <term>Paragraphs</term>
- <listitem>
- <para>
- Shouldn't be a code block.
- </para>
- <para>
- <emphasis role="bold">Should be bold</emphasis>.
- </para>
- <para>
- Should be a single paragraph.
- </para>
- <para>
- Single paragraph.
- </para>
- <para>
- Single paragraph.
- </para>
- <para>
- Single paragraph.
- </para>
- <para>
- Single paragraph.
- </para>
- <para>
- Lots of newlines round this paragraph.
- </para>
- <para>
- Last paragraph.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </section>
-</article>

Deleted: trunk/tools/quickbook/test/para-test.quickbook
==============================================================================
--- trunk/tools/quickbook/test/para-test.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,81 +0,0 @@
-[article Paragraph Test
- [quickbook 1.5]
-]
-
-[section Some Paragraphs]
-
-[/ Leading comment ] Shouldn't be a code block.
-
-[/ Leading comment ]*Should be bold*.
-
-Should be a
-[/ Breaking comment]
-single paragraph.
-
-Single paragraph.
-[/ Breaking comment]
-
-Single paragraph.
-
-[/ Breaking comment]
-Single paragraph.
-
-Single paragraph.[/ Trailing comment]
-
-
-
-
-
-
-Lots of newlines round this paragraph.
-
-
-
-
-
-
-
-
-Last paragraph.[endsect]
-
-[section Inside
-[/Breaking comment]
-blocks]
-
-[variablelist
-[[Paragraphs][
-[/ Leading comment ] Shouldn't be a code block.
-
-[/ Leading comment ]*Should be bold*.
-
-Should be a
-[/ Breaking comment]
-single paragraph.
-
-Single paragraph.
-[/ Breaking comment]
-
-Single paragraph.
-
-[/ Breaking comment]
-Single paragraph.
-
-Single paragraph.[/ Trailing comment]
-
-
-
-
-
-
-Lots of newlines round this paragraph.
-
-
-
-
-
-
-
-
-Last paragraph.]]]
-
-[endsect]
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/preformatted.quickbook
==============================================================================
--- trunk/tools/quickbook/test/preformatted.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,22 +0,0 @@
-[article Preformatted
-]
-
-[section Preformatted]
-
-Here's the ubiquitous /Hello World/ program in C++.
-
-[pre
-#include <iostream>
-
-int main()
-{
- std::cout << "Hello, World!" << std::endl;
- return 0;
-}
-]
-
-The code should appear as a single block of code in a monospaced font and with
-no syntax highlighting. The fifth and sixth lines should appear indented to the
-right, aligning under `main`, on line 3.
-
-[endsect]

Deleted: trunk/tools/quickbook/test/quickbook-manual.quickbook
==============================================================================
--- trunk/tools/quickbook/test/quickbook-manual.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,1981 +0,0 @@
-[article Quickbook
- [quickbook 1.4]
- [version 1.4]
- [authors [de Guzman, Joel], [Niebler, Eric]]
- [copyright 2002 2004 2006 Joel de Guzman, Eric Niebler]
- [purpose /WikiWiki/ style documentation tool]
- [license
- 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])
- ]
-]
-
-[/ QuickBook Document version 1.3 ]
-[/ Sept 24, 2002 ]
-[/ Sept 2, 2004 ]
-[/ Feb 14, 2005 ]
-[/ Sept 13, 2005 ]
-
-[/ Some links]
-
-[def __note__ [$images/note.png]]
-[def __alert__ [$images/alert.png]]
-[def __tip__ [$images/tip.png]]
-[def :-) [$images/smiley.png]]
-[def __spirit__ [@http://spirit.sourceforge.net Spirit]]
-[def __boostbook__ [@http://www.boost.org/doc/html/boostbook.html BoostBook]]
-[def __docbook__ [@http://www.docbook.org/ DocBook]]
-
-[def __comments__ [link quickbook.syntax.comments Comments]]
-
-[def __font_styles__ [link quickbook.syntax.phrase.font_styles Font Styles]]
-[def __quotations__ [link quickbook.syntax.phrase.quotations Quotations]]
-[def __replaceable__ [link quickbook.syntax.phrase.replaceable Replaceble]]
-[def __simple_formatting__ [link quickbook.syntax.phrase.simple_formatting Simple formatting]]
-[def __inline_code__ [link quickbook.syntax.phrase.inline_code Inline code]]
-[def __code_blocks__ [link quickbook.syntax.phrase.code_blocks Code blocks]]
-[def __source_mode__ [link quickbook.syntax.phrase.source_mode Source Mode]]
-[def __line_break__ [link quickbook.syntax.phrase.line_break line-break]]
-[def __anchors__ [link quickbook.syntax.phrase.anchors Anchors]]
-[def __links__ [link quickbook.syntax.phrase.links Links]]
-[def __anchor_links__ [link quickbook.syntax.phrase.anchor_links Anchor links]]
-[def __refentry_links__ [link quickbook.syntax.phrase.refentry_links refentry links]]
-[def __code_links__ [link quickbook.syntax.phrase.code_links function, class, member, enum, macro, concept or header links]]
-[def __escape__ [link quickbook.syntax.phrase.escape Escape]]
-[def __single_char_escape__ [link quickbook.syntax.phrase.single_char_escape Single char escape]]
-[def __images__ [link quickbook.syntax.phrase.images Images]]
-
-[def __document__ [link quickbook.syntax.block.document Document]]
-[def __section__ [link quickbook.syntax.block.section Section]]
-[def __xinclude__ [link quickbook.syntax.block.xinclude xinclude]]
-[def __paragraphs__ [link quickbook.syntax.block.paragraphs Paragraphs]]
-[def __ordered_lists__ [link quickbook.syntax.block.lists.ordered_lists Ordered lists]]
-[def __list_hierarchies__ [link quickbook.syntax.block.lists.list_hierarchies List Hierarchies]]
-[def __long_list_lines__ [link quickbook.syntax.block.lists.long_list_lines Long List Lines]]
-[def __unordered_lists__ [link quickbook.syntax.block.lists.unordered_lists Unordered lists]]
-[def __mixed_lists__ [link quickbook.syntax.block.lists.mixed_lists Mixed lists]]
-[def __code__ [link quickbook.syntax.block.code Code]]
-[def __escape_back__ [link quickbook.syntax.block.escape_back Escaping Back To QuickBook]]
-[def __preformatted__ [link quickbook.syntax.block.preformatted Preformatted]]
-[def __blockquote__ [link quickbook.syntax.block.blockquote Blockquote]]
-[def __heading__ [link quickbook.syntax.block.headings Heading]]
-[def __macros__ [link quickbook.syntax.block.macros Macros]]
-[def __templates__ [link quickbook.syntax.block.templates Templates]]
-[def __predefined_macros__ [link quickbook.syntax.block.predefined_macros Predefined Macros]]
-[def __blurbs__ [link quickbook.syntax.block.blurbs Blurbs]]
-[def __admonitions__ [link quickbook.syntax.block.admonitions Admonitions]]
-[def __tables__ [link quickbook.syntax.block.tables Tables]]
-[def __variable_lists__ [link quickbook.syntax.block.variable_lists Variable Lists]]
-[def __include__ [link quickbook.syntax.block.include Include]]
-[def __import__ [link quickbook.syntax.block.import Import]]
-
-[section:intro Introduction]
-
-[:[*['["Why program by hand in five days what you can spend five years of your
-life automating?]]]
-
--- Terrence Parr, author ANTLR/PCCTS
-]
-
-Well, QuickBook started as a weekend hack. It was originally intended to be a
-sample application using __spirit__. What is it? What you are viewing now, this
-documentation, is autogenerated by QuickBook. These files were generated from
-one master:
-
-[:[@../quickbook.qbk quickbook.qbk]]
-
-Originally named QuickDoc, this funky tool that never dies evolved into a
-funkier tool thanks to Eric Niebler who resurrected the project making it
-generate __boostbook__ instead of HTML. The __boostbook__ documentation format
-is an extension of __docbook__, an SGML or XML based format for describing
-documentation.
-
-QuickBook is a WikiWiki style documentation tool geared towards C++
-documentation using simple rules and markup for simple formatting tasks.
-QuickBook extends the WikiWiki concept. Like the WikiWiki, QuickBook documents are
-simple text files. A single QuickBook document can generate a fully linked set
-of nice HTML and PostScript/PDF documents complete with images and syntax-
-colorized source code.
-
-Features include:
-
-* generate __boostbook__ xml, to generate HTML, PostScript and PDF
-* simple markup to link to Doxygen-generated entities
-* macro system for simple text substitution
-* simple markup for italics, bold, preformatted, blurbs, code samples,
- tables, URLs, anchors, images, etc.
-* automatic syntax coloring of code samples
-* CSS support
-
-[endsect]
-
-[section:change_log Change Log]
-
-[h3 Version 1.3]
-
-* Quickbook file inclusion \[include\].
-* Better xml output (pretty layout). Check out the generated XML.
-* Regression testing facility: to make sure your document will always be
- compatible (full backward compatibility) regardless of changes to
- QuickBook.
-* Code cleanup and refactoring.
-* Allow phrase markup in the doc-info.
-* Preformatted code blocks via \`\`code\`\` (double ticks) allows code in tables
- and lists, for example.
-* Quickbook versioning; allows full backward compatibility. You have to add
- \[quickbook 1.3\] to the doc-info header to enable the new features. Without
- this, QuickBook will assume that the document is a pre-1.3 document.
-* Better (intuitive) paragraph termination. Some markups may terminate a paragraph.
- Example:``
- [section x]
- blah...
- [endsect]``
-* Fully qualified section and headers. Subsection names are concatenated to the
- ID to avoid clashing. Example: `doc_name.sect_name.sub_sect_name.sub_sub_sect_name`
-* Better &nbsp; and whitespace handling in code snippets.
-* \[xinclude\] fixes up the relative path to the target XML file when
- input_directory is not the same as the output_directory.
-* Allow untitled tables.
-* Allow phrase markups in section titles.
-* Allow escaping back to QuickBook from code, code blocks and inline code.
-* Footnotes, with the \[footnote This is the footnote\] syntax.
-* Post-processor bug fix for escaped XML code that it does not recognize.
-* Replaceable, with the \[~replacement\] syntax.
-* Generic Headers
-* Code changes to allow full recursion (i.e. Collectors and push/pop functions)
-* Various code cleanup/maintenance
-* Templates!
-* \[conceptref\] for referencing BoostBook <concept> entities.
-* Allow escape of spaces. The escaped space is removed from the output. Syntax:
- `\ `.
-* Nested comments are now allowed.
-* Quickbook blocks can nest inside comments.
-* __import__ facility.
-* Callouts on imported code
-* Simple markups can now span a whole block.
-* __blurbs__, __admonitions__ and table cells (see __tables__) may now
- contain paragraphs.
-* `\n` and `[br]` are now deprecated.
-
-[endsect]
-
-[section:syntax Syntax Summary]
-
-A QuickBook document is composed of one or more blocks. An example of
-a block is the paragraph or a C++ code snippet. Some blocks have
-special mark-ups. Blocks, except code snippets which have their own
-grammar (C++ or Python), are composed of one or more phrases. A phrase
-can be a simple contiguous run of characters. Phrases can have special
-mark-ups. Marked up phrases can recursively contain other phrases, but
-cannot contain blocks. A terminal is a self contained block-level or
-phrase-level element that does not nest anything.
-
-Blocks, in general, are delimited by two end-of-lines (the block terminator).
-Phrases in each block cannot contain a block terminator. This way, syntax errors
-such as un-matched closing brackets do not go haywire and corrupt anything past
-a single block.
-
-[section Comments]
-
-Can be placed anywhere.
-
-[pre
-'''[/ comment (no output generated) ]'''
-]
-
-[/ for testing only... ]
-
-[pre
-'''[/ comments can be nested [/ some more here] ]'''
-]
-
-[/ for testing [/ only ] ]
-
-[pre
-'''[/ Quickbook blocks can nest inside comments. [*Comment this out too!] ]'''
-]
-
-[/ for testing [*only ] ]
-
-[endsect]
-
-[section:phrase Phrase Level Elements]
-
-[section Font Styles]
-
-[pre'''
-['italic], [*bold], [_underline], [^teletype], [-strikethrough]
-''']
-
-will generate:
-
-['italic], [*bold], [_underline], [^teletype], [-strikethrough]
-
-Like all non-terminal phrase level elements, this can of course be nested:
-
-[pre'''
-[*['bold-italic]]
-''']
-
-will generate:
-
-[*['bold-italic]]
-
-[endsect]
-
-[section Replaceable]
-
-When you want content that may or must be replaced by the user, use the syntax:
-
-[pre'''
-[~replacement]
-''']
-
-This will generate:
-
-[~replacement]
-
-[endsect]
-
-[section Quotations]
-
-[pre'''
-["A question that sometimes drives me hazy: am I or are the others crazy?]--Einstein
-''']
-
-will generate:
-
-["A question that sometimes drives me hazy: am I or are the others crazy?]--Einstein
-
-Note the proper left and right quote marks. Also, while you can simply use
-ordinary quote marks like "quoted", our quotation, above, will generate correct
-DocBook quotations (e.g. <quote>quoted</quote>).
-
-Like all phrase elements, quotations may be nested. Example:
-
-[pre'''
-["Here's the rule for bargains: ["Do other men, for they would do you.] That's
-the true business precept.]
-''']
-
-will generate:
-
-["Here's the rule for bargains: ["Do other men, for they would do you.]
-That's the true business precept.]
-
-[endsect]
-[section Simple formatting]
-
-Simple markup for formatting text, common in many applications, is now supported:
-
-[pre'''
-/italic/, *bold*, _underline_, =teletype=
-''']
-
-will generate:
-
-/italic/, *bold*, _underline_, =teletype=
-
-Unlike QuickBook's standard formatting scheme, the rules for simpler
-alternatives are much stricter[footnote Thanks to David Barrett, author of
-[@http://quinthar.com/qwikiwiki/index.php?page=Home Qwiki], for sharing
-these samples and teaching me these obscure formatting rules. I wasn't sure
-at all if __spirit__, being more or less a formal EBNF parser, can handle
-the context sensitivity and ambiguity.].
-
-* Simple markups cannot nest. You can combine a simple markup with a nestable markup.
-* Simple markups cannot contain any other form of quickbook markup.
-* A non-space character must follow the leading markup
-* A non-space character must precede the trailing markup
-* A space or a punctuation must follow the trailing markup
-* If the matching markup cannot be found within a block, the formatting
- will not be applied. This is to ensure that un-matched formatting markups,
- which can be a common mistake, does not corrupt anything past a single block.
- We do not want the rest of the document to be rendered bold just because we
- forgot a trailing '*'. A single block is terminated by two end of lines or
- the close bracket: ']'.
-* A line starting with the star will be interpreted as an unordered list.
- See __unordered_lists__.
-
-[table More Formatting Samples
- [[Markup] [Result]]
- [[[^'''*Bold*''']] [*Bold*]]
- [[[^'''*Is bold*''']] [*Is bold*]]
- [[[^'''* Not bold* *Not bold * * Not bold *''']] [* Not bold* *Not bold * * Not bold *]]
- [[[^'''This*Isn't*Bold (no bold)''']] [This*Isn't*Bold (no bold)]]
- [[[^'''(*Bold Inside*) (parenthesis not bold)''']] [(*Bold Inside*) (parenthesis not bold)]]
- [[[^'''*(Bold Outside)* (parenthesis bold)''']] [*(Bold Outside)* (parenthesis bold)]]
- [[[^'''3*4*5 = 60 (no bold)''']] [3*4*5 = 60 (no bold)]]
- [[[^'''3 * 4 * 5 = 60 (no bold)''']] [3 * 4 * 5 = 60 (no bold)]]
- [[[^'''3 *4* 5 = 60 (4 is bold)''']] [3 *4* 5 = 60 (4 is bold)]]
- [[[^'''*This is bold* this is not *but this is*''']][*This is bold* this is not *but this is*]]
- [[[^'''*This is bold*.''']] [*This is bold*.]]
- [[[^'''*B*. (bold B)''']] [*B*. (bold B)]]
- [[[^'''['*Bold-Italic*]''']] [['*Bold-Italic*]]]
- [[[^'''*side-by*/-side/''']] [*side-by*/-side/]]
-]
-
-As mentioned, simple markups cannot go past a single block. The text
-from "have" to "full" in the following paragraph will be rendered as
-bold:
-
-[pre'''
-Baa baa black sheep, *have you any wool?
-Yes sir, yes sir, three bags full!*
-One for the master, one for the dame,
-And one for the little boy who lives down the lane.
-''']
-
-Baa baa black sheep, *have you any wool?
-Yes sir, yes sir, three bags full!*
-One for the master, one for the dame,
-And one for the little boy who lives down the lane.
-
-But in the following paragraph, bold is not applied:
-
-[pre'''
-Baa baa black sheep, *have you any wool?
-Yes sir, yes sir, three bags full!
-One for the master, one for the dame,
-And one for the little boy who lives down the lane.
-''']
-
-Baa baa black sheep, *have you any wool?
-Yes sir, yes sir, three bags full!
-One for the master, one for the dame,
-And one for the little boy who lives down the lane.
-
-[endsect]
-[section Inline code]
-
-Inlining code in paragraphs is quite common when writing C++ documentation. We
-provide a very simple markup for this. For example, this:
-
-[pre'''
-This text has inlined code `int main() { return 0; }` in it.
-''']
-
-will generate:
-
-This text has inlined code `int main() { return 0; }` in it. The code will be
-syntax highlighted.
-
-[note We simply enclose the code with the tick: [^'''"`"'''], not the
-single quote: `"'"`. Note too that [^'''`some code`'''] is preferred over
-[^'''[^some code]''']. ]
-
-[endsect]
-[section Code blocks]
-
-Preformatted code simply starts with a space or a tab (See __code__).
-However, such a simple syntax cannot be used as phrase elements in lists
-(See __ordered_lists__ and __unordered_lists__), tables (See __tables__),
-etc. Inline code (see above) can. The problem is, inline code does not
-allow formatting with newlines, spaces, and tabs. These are lost.
-
-We provide a phrase level markup that is a mix between the two. By using the
-double-tick, instead of the single-tick, we are telling QuickBook to use
-preformatted blocks of code. Example:
-
-[pre
-\`\`
- #include <iostream>
-
- int main()
- {
- std::cout << "Hello, World!" << std::endl;
- return 0;
- }
-\`\`
-]
-
-will generate:
-
-``
- #include <iostream>
-
- int main()
- {
- std::cout << "Hello, World!" << std::endl;
- return 0;
- }
-``
-
-[endsect]
-[section Source Mode]
-
-If a document contains more than one type of source code then the source
-mode may be changed dynamically as the document is processed. All QuickBook
-documents are initially in C++ mode by default, though an alternative
-initial value may be set in the __document__ section.
-
-To change the source mode, use the [^\[source-mode\]] markup, where
-=source-mode= is one of the supported modes. For example, this:
-
-[pre'''
-Python's [python] `import` is rather like C++'s [c++] `#include`. A
-C++ comment `// looks like this` whereas a Python comment [python]
-`# looks like this`.
-''']
-
-will generate:
-
-Python's [python] `import` is rather like C++'s [c++] `#include`. A
-C++ comment `// looks like this` whereas a Python comment [python]
-`#looks like this`.
-
-[table Supported Source Modes
- [[Mode] [Source Mode Markup]]
- [[C++] [[^\[c++\]]]]
- [[Python] [[^\[python\]]]]
-]
-
-[note The source mode strings are lowercase.]
-
-[endsect]
-[section line-break]
-
-[pre'''
-[br]
-''']
-
-[warning `[br]` is now deprecated. __blurbs__, __admonitions__ and
-table cells (see __tables__) may now contain paragraphs.]
-
-[endsect]
-[section Anchors]
-
-[pre'''
-[#named_anchor]
-''']
-
-A named anchor is a hook that can be referenced by a link elsewhere in the
-document. You can then reference an anchor with [^'''[link named_anchor
-Some link text]''']. See __anchor_links__, __section__ and __heading__.
-
-[endsect]
-[section Links]
-
-[pre'''
-[@http://www.boost.org this is [*boost's] website....]
-''']
-
-will generate:
-
-[@http://www.boost.org this is [*boost's] website....]
-
-URL links where the link text is the link itself is common. Example:
-
-[pre'''
-see http://spirit.sourceforge.net/
-''']
-
-so, when the text is absent in a link markup, the URL is assumed. Example:
-
-[pre
-see '''[@http://spirit.sourceforge.net/]'''
-]
-
-will generate:
-
-see [@http://spirit.sourceforge.net/]
-
-[endsect]
-[section Anchor links]
-
-You can link within a document using:
-
-[pre'''
-[link section_id.normalized_header_text The link text]
-''']
-
-See sections __section__ and __heading__ for more info.
-
-[endsect]
-[section refentry links]
-
-In addition, you can link internally to an XML refentry like:
-
-[pre'''
-[link xml.refentry The link text]
-''']
-
-This gets converted into [^<link linkend="xml.refentry">The link text</link>].
-
-Like URLs, the link text is optional. If this is not present, the link text will
-automatically be the refentry. Example:
-
-[pre'''
-[link xml.refentry]
-''']
-
-This gets converted into [^<link linkend="xml.refentry">xml.refentry</link>].
-
-[endsect]
-[section:code_links Code Links]
-
-If you want to link to a function, class, member, enum, concept or header in the reference
-section, you can use:
-
-[pre'''
-[funcref fully::qualified::function_name The link text]
-[classref fully::qualified::class_name The link text]
-[memberref fully::qualified::member_name The link text]
-[enumref fully::qualified::enum_name The link text]
-[macroref MACRO_NAME The link text]
-[conceptref ConceptName The link text]
-[headerref path/to/header.hpp The link text]
-''']
-
-Again, the link text is optional. If this is not present, the link text will
-automatically be the function, class, member, enum, macro, concept or header. Example:
-
-[pre'''
-[classref boost::bar::baz]
-''']
-
-would have "boost::bar::baz" as the link text.
-
-[endsect]
-[section Escape]
-
-The escape mark-up is used when we don't want to do any processing.
-
-[pre
-\'\'\'
-escape (no processing/formatting)
-\'\'\'
-]
-
-Escaping allows us to pass XML markup to __boostbook__ or __docbook__. For example:
-
-[pre
-\'\'\'
-<emphasis role="bold">This is direct XML markup</emphasis>
-\'\'\'
-]
-
-'''
-<emphasis role="bold">This is direct XML markup</emphasis>
-'''
-
-[important Be careful when using the escape. The text must conform to
-__boostbook__/__docbook__ syntax.]
-
-[endsect]
-[section Single char escape]
-
-The backslash may be used to escape a single punctuation character. The
-punctuation immediately after the backslash is passed without any processing.
-This is useful when we need to escape QuickBook punctuations such as `[` and `]`.
-For example, how do you escape the triple quote? Simple: [^\\'\\'\\']
-
-
-`\n` has a special meaning. It is used to generate line breaks.
-
-[warning `\n` and `[br]` are now deprecated. __blurbs__, __admonitions__
-and table cells (see __tables__) may now contain paragraphs.]
-
-The escaped space: `\ ` also has a special meaning. The escaped space is removed
-from the output.
-
-[endsect]
-[section Images]
-
-[pre'''
-[$image.jpg]
-''']
-
-[endsect]
-[section Footnotes]
-
-As of version 1.3, QuickBook supports footnotes. Just put the text of the
-footnote in a `[footnote]` block, and the text will be put at the bottom
-of the current page. For example, this:
-
-[pre'''
-[footnote A sample footnote]
-''']
-
-will generate this[footnote A sample footnote].
-
-[section Macro Expansion]
-
-[pre'''
-__a_macro_identifier__
-''']
-
-See __macros__ for details.
-
-[endsect]
-
-[section Template Expansion]
-
-[pre'''
-[a_template_identifier]
-''']
-
-See __templates__ for details.
-
-[endsect]
-
-[endsect]
-[endsect]
-[section:block Block Level Elements]
-
-[section Document]
-
-Every document must begin with a Document Info section, which should look
-like this:
-
-[pre'''
-[document-type The Document Title
- [quickbook 1.3]
- [version 1.0]
- [id the_document_name]
- [dirname the_document_dir]
- [copyright 2000 2002 2003 Joe Blow, Jane Doe]
- [purpose The document's reason for being]
- [category The document's category]
- [authors [Blow, Joe], [Doe, Jane]]
- [license The document's license]
- [source-mode source-type]
-]
-''']
-
-Where document-type is one of:
-
-* book
-* article
-* library
-* chapter
-* part
-* appendix
-* preface
-* qandadiv
-* qandaset
-* reference
-* set
-
-quickbook 1.3 declares the version of quickbook the document is written for.
-In its absence, version 1.1 is assumed.
-
-=version=, =id=, =dirname=, =copyright=, =purpose=, =category=, =authors=,
-=license=, =last-revision= and =source-mode= are optional information.
-
-=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]
-[section Section]
-
-Starting a new section is accomplished with:
-
-[pre'''
-[section:id The Section Title]
-''']
-
-where /id/ is optional. id will be the filename of the generated section.
-If it is not present, "The Section Title" will be normalized and become the id.
-Valid characters are =a-Z=, =A-Z=, =0-9= and =_=. All non-valid characters are
-converted to underscore and all upper-case are converted to lower case.
-Thus: "The Section Title" will be normalized to "the_section_title".
-
-End a section with:
-
-[pre'''
-[endsect]
-''']
-
-Sections can nest, and that results in a hierarchy in the table of contents.
-
-[endsect]
-[section xinclude]
-
-You can include another XML file with:
-
-[pre'''
-[xinclude file.xml]
-''']
-
-This is useful when file.xml has been generated by Doxygen and contains your
-reference section.
-
-[endsect]
-[section Paragraphs]
-
-Paragraphs start left-flushed and are terminated by two or more newlines. No
-markup is needed for paragraphs. QuickBook automatically detects paragraphs from
-the context. Block markups \[section, endsect, h1, h2, h3, h4, h5, h6, blurb,
-(block-quote) ':', pre, def, table and include \] may also terminate a paragraph.
-
-[endsect]
-
-[section Lists]
-[section Ordered lists]
-
-[pre
-# One
-# Two
-# Three
-]
-
-will generate:
-
-# One
-# Two
-# Three
-
-[endsect]
-[section List Hierarchies]
-
-List hierarchies are supported. Example:
-
-[pre
-# One
-# Two
-# Three
- # Three.a
- # Three.b
- # Three.c
-# Four
- # Four.a
- # Four.a.i
- # Four.a.ii
-# Five
-]
-
-will generate:
-
-# One
-# Two
-# Three
- # Three.a
- # Three.b
- # Three.c
-# Fourth
- # Four.a
- # Four.a.i
- # Four.a.ii
-# Five
-
-[endsect]
-[section Long List Lines]
-
-Long lines will be wrapped appropriately. Example:
-
-[pre
-# A short item.
-# A very long item. A very long item. A very long item.
- A very long item. A very long item. A very long item.
- A very long item. A very long item. A very long item.
- A very long item. A very long item. A very long item.
- A very long item. A very long item. A very long item.
-# A short item.
-]
-
-# A short item.
-# A very long item. A very long item. A very long item.
- A very long item. A very long item. A very long item.
- A very long item. A very long item. A very long item.
- A very long item. A very long item. A very long item.
- A very long item. A very long item. A very long item.
-# A short item.
-
-[endsect]
-[section Unordered lists]
-
-[pre'''
-* First
-* Second
-* Third
-''']
-
-will generate:
-
-* First
-* Second
-* Third
-
-[endsect]
-[section Mixed lists]
-
-Mixed lists (ordered and unordered) are supported. Example:
-
-[pre'''
-# One
-# Two
-# Three
- * Three.a
- * Three.b
- * Three.c
-# Four
-''']
-
-will generate:
-
-# One
-# Two
-# Three
- * Three.a
- * Three.b
- * Three.c
-# Four
-
-And...
-
-[pre'''
-# 1
- * 1.a
- # 1.a.1
- # 1.a.2
- * 1.b
-# 2
- * 2.a
- * 2.b
- # 2.b.1
- # 2.b.2
- * 2.b.2.a
- * 2.b.2.b
-''']
-
-will generate:
-
-# 1
- * 1.a
- # 1.a.1
- # 1.a.2
- * 1.b
-# 2
- * 2.a
- * 2.b
- # 2.b.1
- # 2.b.2
- * 2.b.2.a
- * 2.b.2.b
-
-[endsect]
-[endsect]
-
-[section Code]
-
-Preformatted code starts with a space or a tab. The code will be
-syntax highlighted according to the current __source_mode__:
-
-[c++]
-
- #include <iostream>
-
- int main()
- {
- // Sample code
- std::cout << "Hello, World\n";
- return 0;
- }
-
-[python]
-
- import cgi
-
- def cookForHtml(text):
- '''"Cooks" the input text for HTML.'''
-
- return cgi.escape(text)
-
-[c++]
-
-Macros that are already defined are expanded in source code. Example:
-
-[pre'''
-[def __array__ [@http://www.boost.org/doc/html/array/reference.html array]]
-[def __boost__ [@http://www.boost.org/libs/libraries.htm boost]]
-
- using __boost__::__array__;
-''']
-
-Generates:
-
-[def __array__ [@http://www.boost.org/doc/html/array/reference.html array]]
-[def __boost__ [@http://www.boost.org/libs/libraries.htm boost]]
-
- using __boost__::__array__;
-
-[endsect]
-[section:escape_back Escaping Back To QuickBook]
-
-Inside code, code blocks and inline code, QuickBook does not allow any
-markup to avoid conflicts with the target syntax (e.g. c++). In case you
-need to switch back to QuickBook markup inside code, you can do so using a
-language specific /escape-back/ delimiter. In C++ and Python, the delimiter
-is the double tick (back-quote): "\`\`" and "\`\`". Example:
-
-[pre'''
-void ``[@http://en.wikipedia.org/wiki/Foo#Foo.2C_Bar_and_Baz foo]``()
-{
-}
-''']
-
-Will generate:
-
- void ``[@http://en.wikipedia.org/wiki/Foo#Foo.2C_Bar_and_Baz foo]``()
- {
- }
-
-When escaping from code to QuickBook, only phrase level markups are
-allowed. Block level markups like lists, tables etc. are not allowed.
-
-[endsect]
-[section Preformatted]
-
-Sometimes, you don't want some preformatted text to be parsed as C++. In such
-cases, use the [^[pre ... \]] markup block.
-
-[pre'''
-[pre
-
- Some *preformatted* text Some *preformatted* text
-
- Some *preformatted* text Some *preformatted* text
-
- Some *preformatted* text Some *preformatted* text
-
-]
-''']
-
-Spaces, tabs and newlines are rendered as-is. Unlike all quickbook block level
-markup, pre (and Code) are the only ones that allow multiple newlines. The
-markup above will generate:
-
-[pre
-
-Some *preformatted* text Some *preformatted* text
-
- Some *preformatted* text Some *preformatted* text
-
- Some *preformatted* text Some *preformatted* text
-
-]
-
-Notice that unlike Code, phrase markup such as font style is still permitted
-inside =pre= blocks.
-
-[endsect]
-[section Blockquote]
-
-[pre
-'''[:sometext...]'''
-]
-
-[:Indents the paragraph. This applies to one paragraph only.]
-
-[endsect]
-[section Admonitions]
-
-[pre'''
-[note This is a note]
-[tip This is a tip]
-[important This is important]
-[caution This is a caution]
-[warning This is a warning]
-''']
-
-generates __docbook__ admonitions:
-
-[note This is a note]
-[tip This is a tip]
-[important This is important]
-[caution This is a caution]
-[warning This is a warning]
-
-These are the only admonitions supported by __docbook__. So,
-for example [^\[information This is some information\]] is unlikely
-to produce the desired effect.
-
-[endsect]
-[section Headings]
-
-[pre'''
-[h1 Heading 1]
-[h2 Heading 2]
-[h3 Heading 3]
-[h4 Heading 4]
-[h5 Heading 5]
-[h6 Heading 6]
-''']
-
-[h1 Heading 1]
-[h2 Heading 2]
-[h3 Heading 3]
-[h4 Heading 4]
-[h5 Heading 5]
-[h6 Heading 6]
-
-Headings 1-3 \[h1 h2 and h3\] will automatically have anchors with normalized
-names with [^name="section_id.normalized_header_text"] (i.e. valid characters are
-=a-z=, =A-Z=, =0-9= and =_=. All non-valid characters are converted to underscore
-and all upper-case are converted to lower-case. For example: Heading
-1 in section Section 2 will be normalized to [^section_2.heading_1]). You can use:
-
-[pre'''
-[link section_id.normalized_header_text The link text]
-''']
-
-to link to them. See __anchor_links__ and __section__ for more info.
-
-[endsect]
-[section Generic Heading]
-
-In cases when you don't want to care about the heading level (1 to 6), you
-can use the /Generic Heading/:
-
-[pre'''
-[heading Heading]
-''']
-
-The /Generic Heading/ assumes the level, plus one, of the innermost section
-where it is placed. For example, if it is placed in the outermost section,
-then, it assumes /h2/.
-
-Headings are often used as an alternative to sections. It is used
-particularly if you do not want to start a new section. In many cases,
-however, headings in a particular section is just flat. Example:
-
-[pre'''
-[section A]
-[h2 X]
-[h2 Y]
-[h2 Z]
-[endsect]
-''']
-
-Here we use h2 assuming that section A is the outermost level. If it is
-placed in an inner level, you'll have to use h3, h4, etc. depending on
-where the section is. In general, it is the section level plus one. It is
-rather tedious, however, to scan the section level everytime. If you
-rewrite the example above as shown below, this will be automatic:
-
-[pre'''
-[section A]
-[heading X]
-[heading Y]
-[heading Z]
-[endsect]
-''']
-
-They work well regardless where you place them. You can rearrange sections
-at will without any extra work to ensure correct heading levels. In fact,
-with /section/ and /heading/, you have all you need. /h1/../h6/ becomes
-redundant. /h1/../h6/ might be deprecated in the future.
-
-[endsect]
-[section Macros]
-
-[pre'''
-[def macro_identifier some text]
-''']
-
-When a macro is defined, the identifier replaces the text anywhere in the
-file, in paragraphs, in markups, etc. macro_identifier is a string of non-
-white space characters except '\]'. A macro may not follow an alphabetic
-character or the underscore. The replacement text can be any phrase (even
-marked up). Example:
-
-[pre'''
-[def sf_logo [$http://sourceforge.net/sflogo.php?group_id=28447&amp;type=1]]
-sf_logo
-''']
-
-Now everywhere the sf_logo is placed, the picture will be inlined.
-
-[def sf_logo [$http://sourceforge.net/sflogo.php?group_id=28447&type=1]]
-sf_logo
-
-[tip It's a good idea to use macro identifiers that are distinguishable.
-For instance, in this document, macro identifiers have two leading and
-trailing underscores (e.g. [^'''__spirit__''']). The reason is to avoid
-unwanted macro replacement.]
-
-Links (URLS) and images are good candidates for macros. *1*) They tend to
-change a lot. It is a good idea to place all links and images in one place near the top
-to make it easy to make changes. *2*) The syntax is not pretty. It's easier to read and
-write, e.g. [^'''__spirit__'''] than [^'''[@http://spirit.sourceforge.net Spirit]'''].
-
-Some more examples:
-
-[pre'''
-[def :-) [$theme/smiley.png]]
-[def __spirit__ [@http://spirit.sourceforge.net Spirit]]
-''']
-
-(See __images__ and __links__)
-
-Invoking these macros:
-
-[pre'''
-Hi __spirit__ :-)
-''']
-
-will generate this:
-
-Hi __spirit__ :-)
-
-[endsect]
-[section Predefined Macros]
-
-Quickbook has some predefined macros that you can already use.
-
-[table Predefined Macros
- [[Macro] [Meaning] [Example]]
- [['''__DATE__'''] [Today's date] [__DATE__]]
- [['''__TIME__'''] [The current time] [__TIME__]]
- [['''__FILENAME__'''] [Quickbook source filename] [__FILENAME__]]
-]
-
-[endsect]
-[section Templates]
-
-Templates provide a more versatile text substitution mechanism. Templates
-come in handy when you need to create parameterizable, multi-line,
-boilerplate text that you specify once and expand many times. Templates
-accept one or more arguments. These arguments act like place-holders for
-text replacement. Unlike simple macros, which are limited to phrase level
-markup, templates can contain block level markup (e.g. paragraphs, code
-blocks and tables).
-
-Example template:
-
-[pre'''
-[template person[name age what]
-
-Hi, my name is [name]. I am [age] years old. I am a [what].
-
-]
-''']
-
-[template person[name age what]
-
-Hi, my name is [name]. I am [age] years old. I am a [what].
-
-]
-
-[heading Template Identifier]
-
-Template identifiers can either consist of:
-
-* An initial alphabetic character or the underscore, followed by
- zero or more alphanumeric characters or the underscore. This is
- similar to your typical C/C++ identifier.
-* A single character punctuation (a non-alphanumeric printable character)
-
-[heading Formal Template Arguments]
-
-Template formal arguments are identifiers consisting of an initial
-alphabetic character or the underscore, followed by zero or more
-alphanumeric characters or the underscore. This is similar to your typical
-C/C++ identifier.
-
-A template formal argument temporarily hides a template of the same name at
-the point where the [link quickbook.syntax.block.templates.template_expansion
-template is expanded]. Note that the body of the [^person] template above
-refers to [^name] [^age] and [^what] as [^\[name\]] [^\[age\]] and
-[^\[what\]]. [^name] [^age] and [^what] are actually templates that exist
-in the duration of the template call.
-
-[heading Template Body]
-
-The template body can be just about any QuickBook block or phrase. There
-are actually two forms. Templates may be phrase or block level. Phrase
-templates are of the form:
-
-[pre'''
-[template sample[arg1 arg2...argN] replacement text... ]
-''']
-
-Block templates are of the form:
-
-[pre'''
-[template sample[arg1 arg2...argN]
-replacement text...
-]
-''']
-
-The basic rule is as follows: if a newline immediately follows the argument
-list, then it is a block template, otherwise, it is a phrase template.
-Phrase templates are typically expanded as part of phrases. Like macros,
-block level elements are not allowed in phrase templates.
-
-[heading Template Expansion]
-
-You expand a template this way:
-
-[pre'''
-[template_identifier arg1..arg2..arg3]
-''']
-
-At template expansion, you supply the actual arguments. The template will
-be expanded with your supplied arguments. Example:
-
-[pre'''
-[person James Bond..39..Spy]
-[person Santa Clause..87..Big Red Fatso]
-''']
-
-Which will expand to:
-
-[person James Bond..39..Spy]
-[person Santa Clause..87..Big Red Fatso]
-
-[caution A word of caution: Templates are recursive. A template can call
-another template or even itself, directly or indirectly. There are no
-control structures in QuickBook (yet) so this will always mean infinite
-recursion. QuickBook can detect this situation and report an error if
-recursion exceeds a certain limit.]
-
-Each actual argument can be a word, a text fragment or just about any [link
-quickbook.syntax.phrase QuickBook phrase]. Arguments are separated by the
-double dot [^".."] and terminated by the close parenthesis.
-
-[heading Nullary Templates]
-
-Nullary templates look and act like simple macros. Example:
-
-[pre'''
-[template alpha[]&apos;&apos;&apos;&amp;#945;&apos;&apos;&apos;]
-[template beta[]&apos;&apos;&apos;&amp;#946;&apos;&apos;&apos;]
-''']
-
-[template alpha[]'''&#945;''']
-[template beta[]'''&#946;''']
-
-Expanding:
-
-[pre'''Some squigles...[*[alpha][beta]]''']
-
-We have:
-
-Some squiggles...[*[alpha][beta]]
-
-The difference with macros are
-
-* The explicit [link quickbook.syntax.block.templates.template_expansion
- template expansion syntax]. This is an advantage because, now, we don't
- have to use obscure naming conventions like double underscores (e.g.
- \_\_alpha\_\_) to avoid unwanted
- macro replacement.
-* The template is expanded at the point where it is invoked. A macro is
- expanded immediately at its point of declaration. This is subtle and
- can cause a slight difference in behavior especially if you refer to
- other macros and templates in the body.
-
-The empty brackets after the template identifier ([^alpha\[\]]) indicates no
-arguments. If the template body does not look like a template argument list, we
-can elide the empty brackets. Example:
-
-[pre'''
-[template aristotle_quote Aristotle: [*['Education is the best provision
-for the journey to old age.]]]
-''']
-
-[template aristotle_quote\ Aristotle: [*['Education is the best provision
-for the journey to old age.]]]
-
-Expanding:
-
-[pre'''
-Here's a quote from [aristotle_quote].
-''']
-
-We have:
-
-Here's a quote from [aristotle_quote].
-
-The disadvantage is that you can't avoid the space between the template
-identifier, `aristotle_quote`, and the template body "Aristotle...". This space
-will be part of the template body. If that space is unwanted, use empty
-brackets or use the space escape: "`\ `". Example:
-
-[pre'''
-[template tag\ _tag]
-''']
-
-[template tag\ _tag]
-
-Then expanding:
-
-[pre'''
-`struct` x[tag];
-''']
-
-We have:
-
-`struct` x[tag];
-
-You have a couple of ways to do it. I personally prefer the explicit empty
-brackets, though.
-
-[heading Simple Arguments]
-
-As mentioned, arguments are separated by the double dot [^".."]. If there
-are less arguments passed than expected, QuickBook attempts to break the
-last argument into two or more arguments following this logic:
-
-* Break the last argument into two, at the first space found ([^'', '\\n',
- \\t' or '\\r']).
-* Repeat until there are enough arguments or if there are no more spaces
- found (in which case, an error is reported).
-
-For example:
-
-[pre'''
-[template simple[a b c d] [a][b][c][d]]
-[simple w x y z]
-''']
-
-will produce:
-
-[template simple[a b c d] [a][b][c][d]]
-[simple w x y z]
-
-"w x y z" is initially treated as a single argument because we didn't
-supply any [^".."] separators. However, since [^simple] expects 4
-arguments, "w x y z" is broken down iteratively (applying the logic above)
-until we have "w", "x", "y" and "z".
-
-QuickBook only tries to get the arguments it needs. For example:
-
-[pre'''
-[simple w x y z trail]
-''']
-
-will produce:
-
-[simple w x y z trail]
-
-The arguments being: "w", "x", "y" and "z trail".
-
-It should be obvious now that for simple arguments with no spaces, we can
-get by without separating the arguments with [^".."] separators. It is
-possible to combine [^".."] separators with the argument passing
-simplification presented above. Example:
-
-[pre'''
-[simple what do you think ..m a n?]
-''']
-
-will produce:
-
-[simple what do you think ..m a n?]
-
-[heading Punctuation Templates]
-
-With templates, one of our objectives is to allow us to rewrite QuickBook
-in QuickBook (as a qbk library). For that to happen, we need to accommodate
-single character punctuation templates which are fairly common in
-QuickBook. You might have noticed that single character punctuations are
-allowed as [link quickbook.syntax.block.templates.template_identifier
-template identifiers]. Example:
-
-[pre'''
-[template ![bar] '''<hey>'''[bar]'''</hey>''']
-''']
-
-Now, expanding this:
-
-[pre'''
-[!baz]
-''']
-
-We will have:
-
-[pre
-<hey>baz</hey>
-]
-
-[endsect]
-[section Blurbs]
-
-[pre'''
-[blurb :-) [*An eye catching advertisement or note...]
-
- __spirit__ is an object-oriented recursive-descent parser generator framework
- implemented using template meta-programming techniques. Expression templates
- allow us to approximate the syntax of Extended Backus-Normal Form (EBNF)
- completely in C++.
-]
-''']
-
-will generate this:
-
-[blurb :-) [*An eye catching advertisement or note...]
-
- __spirit__ is an object-oriented recursive-descent parser generator
- framework implemented using template meta-programming techniques. Expression
- templates allow us to approximate the syntax of Extended Backus-Normal Form
- (EBNF) completely in C++.
-]
-
-[note Prefer [link quickbook.syntax.block.admonitions admonitions] wherever
-appropriate.]
-
-[endsect]
-[section Tables]
-
-[pre'''
-[table A Simple Table
- [[Heading 1] [Heading 2] [Heading 3]]
- [[R0-C0] [R0-C1] [R0-C2]]
- [[R1-C0] [R1-C1] [R1-C2]]
- [[R2-C0] [R2-C1] [R2-C2]]
-]
-''']
-
-will generate:
-
-[table A Simple Table
- [[Heading 1] [Heading 2] [Heading 3]]
- [[R0-C0] [R0-C1] [R0-C2]]
- [[R2-C0] [R2-C1] [R2-C2]]
- [[R3-C0] [R3-C1] [R3-C2]]
-]
-
-The table title is optional. The first row of the table is automatically
-treated as the table header; that is, it is wrapped in
-[^<thead>...</thead>] XML tags. Note that unlike the original QuickDoc, the
-columns are nested in [ cells... ]. The syntax is free-format and allows
-big cells to be formatted nicely. Example:
-
-[pre'''
-[table Table with fat cells
- [[Heading 1] [Heading 2]]
- [
- [Row 0, Col 0: a small cell]
- [
- Row 0, Col 1: a big fat cell with paragraphs
-
- Boost provides free peer-reviewed portable C++ source libraries.
-
- We emphasize libraries that work well with the C++ Standard Library.
- Boost libraries are intended to be widely useful, and usable across
- a broad spectrum of applications. The Boost license encourages both
- commercial and non-commercial use.
- ]
- ]
- [
- [Row 1, Col 0: a small cell]
- [Row 1, Col 1: a small cell]
- ]
-]
-''']
-
-and thus:
-
-[table Table with fat cells
- [[Heading 1] [Heading 2]]
- [
- [Row 0, Col 0: a small cell]
- [
- Row 0, Col 1: a big fat cell with paragraphs
-
- Boost provides free peer-reviewed portable C++ source libraries.
-
- We emphasize libraries that work well with the C++ Standard Library.
- Boost libraries are intended to be widely useful, and usable across
- a broad spectrum of applications. The Boost license encourages both
- commercial and non-commercial use.
- ]
- ]
- [
- [Row 1, Col 0: a small cell]
- [Row 1, Col 1: a small cell]
- ]
-]
-
-Here's how to have preformatted blocks of code in a table cell:
-
-[pre'''
-[table Table with code
- [[Comment] [Code]]
- [
- [My first program]
- ['''\`\`
- #include <iostream>
-
- int main()
- {
- std::cout << "Hello, World!" << std::endl;
- return 0;
- }
- \`\`''']
- ]
-]
-''']
-
-[table Table with code
- [[Comment] [Code]]
- [
- [My first program]
- [``
- #include <iostream>
-
- int main()
- {
- std::cout << "Hello, World!" << std::endl;
- return 0;
- }
- ``]
- ]
-]
-
-[endsect]
-[section Variable Lists]
-
-[pre'''
-[variablelist A Variable List
- [[term 1] [The definition of term 1]]
- [[term 2] [The definition of term 2]]
- [[term 3] [The definition of term 3]]
-]
-''']
-
-will generate:
-
-[variablelist A Variable List
- [[term 1] [The definition of term 1]]
- [[term 2] [The definition of term 2]]
- [[term 3] [The definition of term 3]]
-]
-
-The rules for variable lists are the same as for tables, except that
-only 2 "columns" are allowed. The first column contains the terms, and
-the second column contains the definitions. Those familiar with HTML
-will recognize this as a "definition list".
-
-[endsect]
-[section Include]
-
-You can include one QuickBook file from another. The syntax is simply:
-
-[pre'''
-[include someother.qbk]
-''']
-
-The included file will be processed as if it had been cut and pasted
-into the current document, with the following exceptions:
-
-* The '''__FILENAME__''' predefined macro will reflect the name of the
- file currently being processed.
-* Any macros defined in the included file are scoped to that file.
-
-The [^\[include\]] directive lets you specify a document id to use for the
-included file. When this id is not explicitly specified, the id defaults to
-the filename ("someother", in the example above). You can specify the id
-like this:
-
-[pre'''
-[include:someid someother.qbk]
-''']
-
-All auto-generated anchors will use the document id as a unique prefix. So
-for instance, if there is a top section in someother.qbk named "Intro", the
-named anchor for that section will be "someid.intro", and you can link to
-it with [^\[link someid.intro The Intro\]].
-
-[endsect]
-
-[section Import]
-
-When documenting code, you'd surely need to present code from actual source
-files. While it is possible to copy some code and paste them in your QuickBook
-file, doing so is error prone and the extracted code in the documentation tends
-to get out of sync with the actual code as the code evolves. The problem, as
-always, is that once documentation is written, the tendency is for the docs to
-languish in the archives without maintenance.
-
-QuickBook's import facility provides a nice solution.
-
-[heading Example]
-
-You can effortlessly import code snippets from source code into your QuickBook.
-The following illustrates how this is done:
-
-[pre'''
-[import ../test/stub.cpp]
-[foo]
-[bar]
-''']
-
-The first line:
-
-[pre'''
-[import ../test/stub.cpp]
-''']
-
-collects specially marked-up code snippets from [@../../test/stub.cpp stub.cpp]
-and places them in your QuickBook file as virtual templates. Each of the
-specially marked-up code snippets has a name (e.g. `foo` and `bar` in the
-example above). This shall be the template identifier for that particular code
-snippet. The second and third line above does the actual template expansion:
-
-[pre'''
-[foo]
-[bar]
-''']
-
-And the result is:
-
-[import ../test/stub.cpp]
-[foo]
-[bar]
-
-[heading Code Snippet Markup]
-
-Note how the code snippets in [@../../test/stub.cpp stub.cpp] get marked up. We
-use distinguishable comments following the form:
-
- //[id
- some code here
- //]
-
-The first comment line above initiates a named code-snippet. This prefix will
-not be visible in quickbook. The entire code-snippet in between `//[id` and
-`//]` will be inserted as a template in quickbook with name ['/id/]. The comment
-`//]` ends a code-snippet This too will not be visible in quickbook.
-
-[heading Special Comments]
-
-Special comments of the form:
-
- //` some [*quickbook] markup here
-
-and:
-
- /*` some [*quickbook] markup here */
-
-will be parsed by QuickBook. This can contain quickbook /blocks/ (e.g. sections,
-paragraphs, tables, etc). In the first case, the initial slash-slash, tick and
-white-space shall be ignored. In the second, the initial slash-star-tick and the
-final star-slash shall be ignored.
-
-[heading Callouts]
-
-Special comments of the form:
-
- /*< some [*quickbook] markup here >*/
-
-will be regarded as callouts. These will be collected, numbered and
-rendered as a "callout bug" (a small icon with a number). After the
-whole snippet is parsed, the callout list is generated. See
-[@http://www.docbook.org/tdg/en/html/callout.html Callouts] for details.
-Example:
-
-[foo_bar]
-
-Checkout [@../../test/stub.cpp stub.cpp] to see the actual code.
-
-[endsect]
-
-[endsect]
-[endsect]
-
-[section:install Installation and configuration]
-
-This section provides some guidelines on how to install and configure
-BoostBook and Quickbook under several operating systems.
-
-Before continuing, it is very important that you keep this in mind: if you
-try to build some documents and the process breaks due to misconfiguration,
-be absolutely sure to delete any `bin` and `bin.v2` directories generated
-by the build before trying again. Otherwise your configuration fixes will
-not take any effect.
-
-[section:windows Windows 2000, XP, 2003, Vista]
-
-[python]
-
-[:['Section contributed by Julio M. Merino Vidal]]
-
-The following instructions apply to any Windows system based on Windows
-2000, including Windows XP, Windows 2003 Server and Windows Vista. The
-paths shown below are taken from a Windows Vista machine; you will need to
-adjust them to match your system in case you are running an older version.
-
-# First of all you need to have a copy of `xsltproc` for Windows. There
- are many ways to get this tool, but to keep things simple, use the
- [@http://www.zlatkovic.com/pub/libxml/ binary packages] made by Igor
- Zlatkovic. At the very least, you need to download the following
- packages: `iconv`, `zlib`, `libxml2` and `libxslt`.
-
-# Unpack all these packages in the same directory so that you get unique
- `bin`, `include` and `lib` directories within the hierarchy. These
- instructions use `C:\Users\example\Documents\boost\xml` as the root for
- all files.
-
-# From the command line, go to the `bin` directory and launch
- `xsltproc.exe` to ensure it works. You should get usage information on
- screen.
-
-# Download [@http://www.docbook.org/xml/4.2/docbook-xml-4.2.zip Docbook XML
- 4.2] and unpack it in the same directory used above. That is:
- `C:\Users\example\Documents\boost\xml\docbook-xml`.
-
-# Download the latest
- [@http://sourceforge.net/project/showfiles.php?group_id=21935&package_id=16608
- Docbook XSL] version and unpack it, again in the same directory
- used before. To make things easier, rename the directory created
- during the extraction to `docbook-xsl` (bypassing the version name):
- `C:\Users\example\Documents\boost\xml\docbook-xsl`.
-
-# Add the following to your `user-config.jam` file, which should live in
- your home directory (`%HOMEDRIVE%%HOMEPATH%`). You must already have it
- somewhere or otherwise you could not be building Boost (i.e. missing
- tools configuration).
-
- using xsltproc
- : "C:/Users/example/Documents/boost/xml/bin/xsltproc.exe"
- ;
-
- using boostbook
- : "C:/Users/example/Documents/boost/xml/docbook-xsl"
- : "C:/Users/example/Documents/boost/xml/docbook-xml"
- ;
-
-The above steps are enough to get a functional BoostBook setup. Quickbook
-will be automatically built when needed. If you want to avoid these
-rebuilds:
-
-# Go to Quickbook's source directory (`BOOST_ROOT\tools\quickbook`).
-
-# Build the utility by issuing `bjam --v2`.
-
-# Copy the resulting `quickbook.exe` binary (located under the
- `BOOST_ROOT\bin.v2` hierarchy) to a safe place. Following our previous
- example, you can install it into:
- `C:\Users\example\Documents\boost\xml\bin`.
-
-# Add the following to your `user-config.jam` file:
-
- using quickbook
- : "C:/Users/example/Documents/boost/xml/bin/quickbook.exe"
- ;
-
-[endsect]
-
-[section:linux Debian, Ubuntu]
-
-The following instructions apply to Debian and its derivatives. They are based
-on a Ubuntu Edgy install but should work on other Debian based systems.
-
-First install the `bjam`, `xsltproc`, `docbook-xsl` and `docbook-xml` packages.
-For example, using `apt-get`:
-
- sudo apt-get install xsltprc docbook-xsl docbook-xml
-
-If you're planning on building boost's documentation, you'll also need to
-install the `doxygen` package as well.
-
-Next, we need to configure Boost Build to compile BoostBook files. Add the
-following to your `user-config.jam` file, which should be in your home
-directory. If you don't have one, create a file containing this text. For more
-information on setting up `user-config.jam`, see the
-[@http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html Boost
-Build documentation].
-
- using xsltproc ;
-
- using boostbook
- : /usr/share/xml/docbook/stylesheet/nwalsh
- : /usr/share/xml/docbook/schema/dtd/4.2
- ;
-
- # Remove this line if you're not using doxygen
- using doxygen ;
-
-The above steps are enough to get a functional BoostBook setup. Quickbook
-will be automatically built when needed. If you want to avoid these
-rebuilds:
-
-# Go to Quickbook's source directory (`BOOST_ROOT/tools/quickbook`).
-
-# Build the utility by issuing `bjam --v2`.
-
-# Copy the resulting `quickbook` binary (located under the
- `BOOST_ROOT/bin.v2` hierarchy) to a safe place. The traditional location is
- `/usr/local/bin`.
-
-# Add the following to your `user-config.jam` file, using the full path of the
- quickbook executable:
-
- using quickbook
- : /usr/local/bin/quickbook
- ;
-
-[endsect]
-[endsect] [/Installation and configuration]
-
-[section:editors Editor Support]
-
-Editing quickbook files is usually done with text editors both simple and
-powerful. The following sections list the settings for some editors which can
-help make editing quickbook files a bit easier.
-
-[blurb __note__ You may submit your settings, tips, and suggestions to the
-authors, or through the [@https://lists.sourceforge.net/lists/listinfo/boost-
-docs Boost Docs mailing list].]
-
-[section:scite Scintilla Text Editor]
-
-[:['Section contributed by Dean Michael Berris]]
-
-The Scintilla Text Editor (SciTE) is a free source code editor for Win32 and X.
-It uses the SCIntilla source code editing component.
-
-[blurb __tip__ SciTE can be downloaded from [@http://www.scintilla.org/SciTE.html]]
-
-You can use the following settings to highlight quickbook tags when
-editing quickbook files.
-
-[pre'''
-qbk=*.qbk
-lexer.*.qbk=props
-use.tabs.$(qbk)=0
-tab.size.$(qbk)=4
-indent.size.$(qbk)=4
-style.props.32=$(font.base)
-comment.stream.start.props=[/
-comment.stream.end.props=]
-comment.box.start.props=[/
-comment.box.middle.props=
-comment.box.end.props=]
-''']
-
-[blurb __note__ Thanks to Rene Rivera for the above SciTE settings.]
-
-[endsect] [/scite]
-[endsect] [/editors]
-
-[section:faq Frequently Asked Questions]
-
-[heading Can I use QuickBook for non-Boost documentation?]
-
-QuickBook can be used for non-Boost documentation with a little extra work.
-
-[:['Faq contributed by Michael Marcin]]
-
-When building HTML documentation with BoostBook a Boost C++ Libraries header
-is added to the files. When using QuickBook to document projects outside of
-Boost this is not desirable. This behavior can be overridden at the BoostBook
-level by specifying some XSLT options. When using Boost Build version 2 (BBv2)
-this can be achieved by adding parameters to the BoostBook target declaration.
-
-For example:
-[pre
-using quickbook ;
-
-xml my_doc : my_doc.qbk ;
-
-boostbook standalone
- :
- my_doc
- :
- <xsl:param>boost.image.src=images/my_project_logo.png
- <xsl:param>boost.image.alt="\\"My Project\\""
- <xsl:param>boost.image.w=100
- <xsl:param>boost.image.h=50
- <xsl:param>nav.layout=none
- ;
-]
-
-[endsect] [/faq]
-
-[section:ref Quick Reference]
-
-[cpp]
-
-[template ordered_list_sample[]
-[pre'''
-# one
-# two
-# three
-''']
-]
-
-[template unordered_list_sample[]
-[pre'''
-* one
-* two
-* three
-''']
-]
-
-[template table_sample[]
-[pre'''
-[table Title
-[[a][b][c]]
-[[a][b][c]]
-]
-''']
-]
-
-[template var_list_sample[]
-[pre'''
-[variablelist Title
-[[a][b]]
-[[a][b]]
-]
-''']
-]
-
-
-[table Syntax Compendium
- [[To do this...] [Use this...] [See this...]]
- [[comment] [[^'''[/ some comment]''']] [__comments__]]
- [[['italics]] [[^'''['italics] or /italics/''']] [__font_styles__ and __simple_formatting__]]
- [[[*bold]] [[^'''[*bold] or *bold*''']] [__font_styles__ and __simple_formatting__]]
- [[[_underline]] [[^'''[_underline] or _underline_''']] [__font_styles__ and __simple_formatting__]]
- [[[^teletype]] [[^'''[^teletype] or =teletype=''']] [__font_styles__ and __simple_formatting__]]
- [[[-strikethrough]] [[^'''[-strikethrough]''']] [__font_styles__ and __simple_formatting__]]
- [[[~replaceable]] [[^'''[~replaceable]''']] [__replaceable__]]
- [[source mode] [[^\[c++\]] or [^\[python\]]] [__source_mode__]]
- [[inline code] [[^'''`int main();`''']] [__inline_code__]]
- [[code block] [[^'''``int main();``''']] [__code__]]
- [[code escape] [[^'''``from c++ to QuickBook``''']] [__escape_back__]]
- [[line break] [[^'''[br] or \n''']] [__line_break__ *DEPRECATED*]]
- [[anchor] [[^'''[#anchor]''']] [__anchors__]]
- [[link] [[^'''[@http://www.boost.org Boost]''']] [__links__]]
- [[anchor link] [[^'''[link section.anchor Link text]''']] [__anchor_links__]]
- [[refentry link] [[^'''[link xml.refentry Link text]''']] [__refentry_links__]]
- [[function link] [[^'''[funcref fully::qualified::function_name Link text]''']] [__code_links__]]
- [[class link] [[^'''[classref fully::qualified::class_name Link text]''']] [__code_links__]]
- [[member link] [[^'''[memberref fully::qualified::member_name Link text]''']] [__code_links__]]
- [[enum link] [[^'''[enumref fully::qualified::enum_name Link text]''']] [__code_links__]]
- [[macro link] [[^'''[macroref MACRO_NAME Link text]''']] [__code_links__]]
- [[concept link] [[^'''[conceptref ConceptName Link text]''']] [__code_links__]]
- [[header link] [[^'''[headerref path/to/header.hpp Link text]''']] [__code_links__]]
- [[escape] [[^\'\'\'escaped text (no processing/formatting)\'\'\']] [__escape__]]
- [[single char escape] [[^\\c]] [__single_char_escape__]]
- [[images] [[^'''[$image.jpg]''']] [__images__]]
- [[begin section] [[^'''[section The Section Title]''']] [__section__]]
- [[end section] [[^'''[endsect]''']] [__section__]]
- [[paragraph] [No markup. Paragraphs start left-flushed and are terminated by two or more newlines.] [__paragraphs__]]
- [[ordered list] [[ordered_list_sample]] [__ordered_lists__]]
- [[unordered list] [[unordered_list_sample]] [__unordered_lists__]]
- [[code] [No markup. Preformatted code starts with a space or a tab.] [__code__]]
- [[preformatted] [[^'''[pre preformatted]''']] [__preformatted__]]
- [[block quote] [[^'''[:sometext...]''']] [__blockquote__]]
- [[heading 1] [[^'''[h1 Heading 1]''']] [__heading__]]
- [[heading 2] [[^'''[h2 Heading 2]''']] [__heading__]]
- [[heading 3] [[^'''[h3 Heading 3]''']] [__heading__]]
- [[heading 4] [[^'''[h4 Heading 4]''']] [__heading__]]
- [[heading 5] [[^'''[h5 Heading 5]''']] [__heading__]]
- [[heading 6] [[^'''[h6 Heading 6]''']] [__heading__]]
- [[macro] [[^'''[def macro_identifier some text]''']] [__macros__]]
- [[template] [[^'''[template[a b] [a] body [b]]''']] [__templates__]]
- [[blurb] [[^'''[blurb advertisement or note...]''']] [__blurbs__]]
- [[admonition] [[^'''[warning Warning text...]''']] [__admonitions__]]
- [[table] [[table_sample]] [__tables__]]
- [[variablelist] [[var_list_sample]] [__variable_lists__]]
- [[include] [[^'''[include someother.qbk]''']] [__include__]]
-]
-
-[endsect]

Deleted: trunk/tools/quickbook/test/section_1_4.gold
==============================================================================
--- trunk/tools/quickbook/test/section_1_4.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,20 +0,0 @@
-<?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="section_id_1_4" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Section Id 1.4</title>
- <section id="section_id_1_4.id_test1">
- <title><link linkend="section_id_1_4.id_test1">Quickbook section id test</link></title>
- </section>
- <section id="section_id_1_4.id_test2">
- <title><link linkend="section_id_1_4.id_test2">Quickbook section id test</link></title>
- </section>
- <section id="section_id_1_4.quickbook_section_no_id_test_1">
- <title><link linkend="section_id_1_4.quickbook_section_no_id_test_1">Quickbook
- section no id test 1</link></title>
- </section>
- <section id="section_id_1_4.___quickbook_section_no_id_test_2">
- <title><link linkend="section_id_1_4.___quickbook_section_no_id_test_2">++ Quickbook
- section no id test 2</link></title>
- </section>
-</article>

Deleted: trunk/tools/quickbook/test/section_1_4.quickbook
==============================================================================
--- trunk/tools/quickbook/test/section_1_4.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,12 +0,0 @@
-[article Section Id 1.4
- [quickbook 1.4]
-]
-
-[section:id_test1 Quickbook section id test]
-[endsect]
-[section :id_test2 Quickbook section id test]
-[endsect]
-[section: Quickbook section no id test 1]
-[endsect]
-[section:++ Quickbook section no id test 2]
-[endsect]
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/section_1_5.gold
==============================================================================
--- trunk/tools/quickbook/test/section_1_5.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,19 +0,0 @@
-<?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="section_id_1_5" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Section Id 1.5</title>
- <section id="section_id_1_5.id_test1">
- <title><link linkend="section_id_1_5.id_test1">Quickbook section id test</link></title>
- </section>
- <section id="section_id_1_5.id_test2">
- <title><link linkend="section_id_1_5.id_test2">Quickbook section id test</link></title>
- </section>
- <section id="section_id_1_5.id_test3">
- <title><link linkend="section_id_1_5.id_test3">Quickbook section id test</link></title>
- </section>
- <section id="section_id_1_5.___quickbook_section_no_id_test">
- <title><link linkend="section_id_1_5.___quickbook_section_no_id_test">++ Quickbook
- section no id test</link></title>
- </section>
-</article>

Deleted: trunk/tools/quickbook/test/section_1_5.quickbook
==============================================================================
--- trunk/tools/quickbook/test/section_1_5.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,12 +0,0 @@
-[article Section Id 1.5
- [quickbook 1.5]
-]
-
-[section:id_test1 Quickbook section id test]
-[endsect]
-[section :id_test2 Quickbook section id test]
-[endsect]
-[section: id_test3 Quickbook section id test]
-[endsect]
-[section:++ Quickbook section no id test]
-[endsect]
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/simple_markup.gold
==============================================================================
--- trunk/tools/quickbook/test/simple_markup.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,58 +0,0 @@
-<?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="simple_markup_test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Simple Markup Test</title>
- <section id="simple_markup_test.simple_markup">
- <title><link linkend="simple_markup_test.simple_markup">Simple Markup</link></title>
- <para>
- <emphasis>italic</emphasis> <emphasis role="bold">bold</emphasis> <emphasis
- role="underline">underline</emphasis> <literal>teletype</literal>
- </para>
- <para>
- //not italic// **not bold** __not underline__ ==not teletype==
- </para>
- <para>
- <emphasis role="underline">odd__ edge case</emphasis>
- </para>
- <para>
- not__underlined__hopefully
- </para>
- <para>
- (<emphasis role="bold">bold</emphasis>) <emphasis role="underline">und/er/lined</emphasis>
- </para>
- <para>
- <emphasis>all/italic</emphasis> * not bold*
- </para>
- <para>
- /not italic <ulink url="http://www.boost.org/"><emphasis role="bold">bold</emphasis></ulink>
- </para>
- <para>
- not_underlined_
- </para>
- <para>
- _Should not underline escaped markup_. _or this escaped_ markup form.
- </para>
- <para>
- <literal>Matti Meik\u00E4l\u00E4inen</literal>
- </para>
- <para>
- <literal>replaced</literal>
- </para>
- <para>
- <emphasis role="underline">replaced</emphasis>
- </para>
- <para>
- <literal>_mac\ ro_</literal>
- </para>
- <para>
- <emphasis>italic\</emphasis>
- </para>
- <para>
- These shouldn't be interepted as markup: == // **
- </para>
- <para>
- <literal>&lt;</literal> <literal>\&lt;</literal> <literal>\\&lt;</literal>
- </para>
- </section>
-</article>

Deleted: trunk/tools/quickbook/test/simple_markup.quickbook
==============================================================================
--- trunk/tools/quickbook/test/simple_markup.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,42 +0,0 @@
-[article Simple Markup Test
-[quickbook 1.5]
-]
-
-[def _macro_ replaced]
-
-[section Simple Markup]
-
-/italic/ *bold* _underline_ =teletype=
-
-//not italic// **not bold** __not underline__ ==not teletype==
-
-_odd__ edge case_
-
-not__underlined__hopefully
-
-(*bold*) _und/er/lined_
-
-/all/italic/ * not bold*
-
-/not italic [@http://www.boost.org/ *bold*]
-
-not_underlined_
-
-_Should not underline '''escaped''' markup_.
-_or this '''escaped_ markup''' form.
-
-=Matti Meik\u00E4l\u00E4inen=
-
-=_macro_=
-
-__macro__
-
-=_mac\ ro_=
-
-/italic\/
-
-These shouldn't be interepted as markup: == // **
-
-=<= =\<= =\\<=
-
-[endsect]

Modified: trunk/tools/quickbook/test/snippets/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/test/snippets/Jamfile.v2 (original)
+++ trunk/tools/quickbook/test/snippets/Jamfile.v2 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -12,4 +12,7 @@
 
 test-suite quickbook.test :
     [ quickbook-test pass_thru ]
+ [ quickbook-test unbalanced_snippet1-1_5 ]
+ [ quickbook-error-test unbalanced_snippet1-1_6-fail ]
+ [ quickbook-error-test unbalanced_snippet2-1_6-fail ]
     ;

Modified: trunk/tools/quickbook/test/snippets/pass_thru.gold
==============================================================================
--- trunk/tools/quickbook/test/snippets/pass_thru.gold (original)
+++ trunk/tools/quickbook/test/snippets/pass_thru.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -10,8 +10,7 @@
     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)
-=============================================================================*/</phrase>
-</programlisting>
+=============================================================================*/</phrase></programlisting>
   </para>
   <para>
 <programlisting><phrase role="keyword">struct</phrase> <phrase role="identifier">Foo</phrase><phrase role="special">{</phrase>
@@ -24,13 +23,10 @@
 <phrase role="keyword">int</phrase> <phrase role="identifier">main</phrase><phrase role="special">()</phrase>
 <phrase role="special">{</phrase>
     <phrase role="identifier">Foo</phrase> <phrase role="identifier">x</phrase><phrase role="special">;</phrase>
-<phrase role="special">}</phrase>
-
-</programlisting>
+<phrase role="special">}</phrase></programlisting>
   </para>
   <para>
 <programlisting><phrase role="keyword">def</phrase> <phrase role="identifier">foo</phrase><phrase role="special">:</phrase>
- <phrase role="keyword">print</phrase><phrase role="special">(</phrase><phrase role="string">'foo'</phrase><phrase role="special">)</phrase>
-</programlisting>
+ <phrase role="keyword">print</phrase><phrase role="special">(</phrase><phrase role="string">'foo'</phrase><phrase role="special">)</phrase></programlisting>
   </para>
 </article>

Modified: trunk/tools/quickbook/test/stub.c
==============================================================================
--- trunk/tools/quickbook/test/stub.c (original)
+++ trunk/tools/quickbook/test/stub.c 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -7,6 +7,12 @@
     http://www.boost.org/LICENSE_1_0.txt)
 =============================================================================*/
 
+/*`
+This should appear when =stub.c= is included.
+
+[foo_c]
+*/
+
 /*[foo_c */
     /*`
     This is the C [*['foo]] function.

Modified: trunk/tools/quickbook/test/stub.cpp
==============================================================================
--- trunk/tools/quickbook/test/stub.cpp (original)
+++ trunk/tools/quickbook/test/stub.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -6,6 +6,9 @@
     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
     http://www.boost.org/LICENSE_1_0.txt)
 =============================================================================*/
+
+/*` This should appear when =stub.cpp= is included. */
+
 #include <string>
 
 //[ bar

Modified: trunk/tools/quickbook/test/stub.py
==============================================================================
--- trunk/tools/quickbook/test/stub.py (original)
+++ trunk/tools/quickbook/test/stub.py 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -4,6 +4,8 @@
 # License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 # http://www.boost.org/LICENSE_1_0.txt)
 
+#` This should appear when =stub.py= is included.
+
 #[foo_py
 """`
     This is the Python [*['foo]] function.

Deleted: trunk/tools/quickbook/test/table_1_3.gold
==============================================================================
--- trunk/tools/quickbook/test/table_1_3.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,350 +0,0 @@
-<?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="table_1_3" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Table 1.3</title>
- <table frame="all" id="table_1_3.t0">
- <title>Table 2</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Heading
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- cell
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <informaltable frame="all">
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Heading
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- cell
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- <table frame="all" id="table_1_3.t1">
- <title>Title</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Heading
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- cell
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table frame="all" id="table_1_3.t2">
- <title>Title</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Heading
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- cell
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table frame="all" id="table_1_3.t3">
- <title>Title [/ ] containing a comment</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Heading
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- cell
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table frame="all" id="table_1_3.t4">
- <title>Title</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Heading
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- cell
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table frame="all" id="table_1_3.t5">
- <title>[[Title]]</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Heading
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- cell
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <section id="table_1_3.section1">
- <title><link linkend="table_1_3.section1">Section 1</link></title>
- <table frame="all" id="table_1_3.section1.t0">
- <title>A &amp; B</title>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>
- <para>
- A
- </para>
- </entry>
- <entry>
- <para>
- B
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- a
- </para>
- </entry>
- <entry>
- <para>
- b
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table frame="all" id="table_1_3.section1.t1">
- <title>Empty Table</title>
- <tgroup cols="0">
- <tbody>
- </tbody>
- </tgroup>
- </table>
- <table frame="all" id="table_1_3.section1.t2">
- <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_3.section1.t3">
- <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>
- <table frame="all" id="table_1_3.section1.t4">
- <title>Nested Tables</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Header 1
- </para>
- </entry>
- <entry>
- <para>
- Header 2
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <table frame="all" id="table_1_3.section1.t5">
- <title>Inner Table</title>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>
- <para>
- 1.1
- </para>
- </entry>
- <entry>
- <para>
- 1.2
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- 2.1
- </para>
- </entry>
- <entry>
- <para>
- 2.2
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </entry>
- </row>
- <row>
- <entry>
- <para>
- Something.
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <anchor id="id1"/>
- <table frame="all" id="table_1_3.section1.t6">
- <title>Table with anchors</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- <anchor id="id2"/>a<anchor id="id3"/>
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- b
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </section>
-</article>

Deleted: trunk/tools/quickbook/test/table_1_3.quickbook
==============================================================================
--- trunk/tools/quickbook/test/table_1_3.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,113 +0,0 @@
-[article Table 1.3
- [quickbook 1.3]
- [id table_1_3]
-]
-
-[table Table 2
- [[Heading]]
- [[cell]]
-]
-
-[table
- [[Heading]]
- [[cell]]
-]
-
-[table [/ Comment?] Title
- [[Heading]]
- [[cell]]
-]
-
-[table [/ Multi line
-comment] Title
- [[Heading]]
- [[cell]]
-]
-
-[table Title [/ ] containing a comment
- [[Heading]]
- [[cell]]
-]
-
-[/ These two might be considered to be a bug. ]
-
-[table [/ Multi line
-comment]
- Title
- [[Heading]]
- [[cell]]
-]
-
-[table [/ Multi line
-comment]
- [[Title]]
- [[Heading]]
- [[cell]]
-]
-
-[section:section1 Section 1]
-
-[table A & B
- [[A][B]]
- [[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.
- ]
- ]
-]
-
-[table Nested Tables
- [
- [
- Header 1
- ]
- [
- Header 2
- ]
- ]
- [
- [
- [table Inner Table
- [[1.1][1.2]]
- [[2.1][2.2]]
- ]
- ]
- ]
- [
- [
- Something.
- ]
- ]
-]
-
-[#id1]
-[table Table with anchors
-[[[#id2]a[#id3]]][[b]]
-]
-
-[endsect]

Deleted: trunk/tools/quickbook/test/table_1_5.gold
==============================================================================
--- trunk/tools/quickbook/test/table_1_5.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,441 +0,0 @@
-<?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="table_1_5" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Table 1.5</title>
- <table frame="all" id="table_1_5.table1">
- <title>Table 1</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Heading
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- cell
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table frame="all" id="table_1_5.table_2">
- <title>Table 2</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Heading
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- cell
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <informaltable frame="all">
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Heading
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- cell
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- <informaltable frame="all" id="table_1_5.table4">
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Heading
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- cell
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
- <table frame="all" id="table_1_5._table5_">
- <title>-table5-</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Heading
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- cell
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table frame="all" id="table_1_5.title">
- <title>Title</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Heading
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- cell
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table frame="all" id="table_1_5.title0">
- <title>Title</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Heading
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- cell
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table frame="all" id="table_1_5.title_______containing_a_comment">
- <title>Title [/ ] containing a comment</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Heading
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- cell
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table frame="all" id="table_1_5.title1">
- <title>Title</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Heading
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- cell
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table frame="all" id="table_1_5.__title__">
- <title>[[Title]]</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Heading
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- cell
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <section id="table_1_5.section1">
- <title><link linkend="table_1_5.section1">Section 1</link></title>
- <table frame="all" id="table_1_5.section1.table1">
- <title>Table 1</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Heading
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- cell
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <table frame="all" id="table_1_5.section1.a___b">
- <title>A &amp; B</title>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>
- <para>
- A
- </para>
- </entry>
- <entry>
- <para>
- B
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- a
- </para>
- </entry>
- <entry>
- <para>
- b
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <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>
- <table frame="all" id="table_1_5.section1.nested_tables">
- <title>Nested Tables</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- Header 1
- </para>
- </entry>
- <entry>
- <para>
- Header 2
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <table frame="all" id="table_1_5.section1.inner_table">
- <title>Inner Table</title>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>
- <para>
- 1.1
- </para>
- </entry>
- <entry>
- <para>
- 1.2
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- 2.1
- </para>
- </entry>
- <entry>
- <para>
- 2.2
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </entry>
- </row>
- <row>
- <entry>
- <para>
- Something.
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <anchor id="id1"/>
- <table frame="all" id="table_1_5.section1.table_with_anchors">
- <title>Table with anchors</title>
- <tgroup cols="1">
- <thead>
- <row>
- <entry>
- <para>
- <anchor id="id2"/>a<anchor id="id3"/>
- </para>
- </entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <para>
- b
- </para>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </section>
-</article>

Deleted: trunk/tools/quickbook/test/table_1_5.quickbook
==============================================================================
--- trunk/tools/quickbook/test/table_1_5.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,133 +0,0 @@
-[article Table 1.5
- [quickbook 1.5]
- [id table_1_5]
-]
-
-[table:table1 Table 1
- [[Heading]]
- [[cell]]
-]
-
-[table Table 2
- [[Heading]]
- [[cell]]
-]
-
-[table
- [[Heading]]
- [[cell]]
-]
-
-[table:table4
- [[Heading]]
- [[cell]]
-]
-
-[table:-table5-
- [[Heading]]
- [[cell]]
-]
-
-[table [/ Comment?] Title
- [[Heading]]
- [[cell]]
-]
-
-[table [/ Multi line
-comment] Title
- [[Heading]]
- [[cell]]
-]
-
-[table Title [/ ] containing a comment
- [[Heading]]
- [[cell]]
-]
-
-[/ These two might be considered to be a bug. ]
-
-[table [/ Multi line
-comment]
- Title
- [[Heading]]
- [[cell]]
-]
-
-[table [/ Multi line
-comment]
- [[Title]]
- [[Heading]]
- [[cell]]
-]
-
-[section:section1 Section 1]
-
-[table:table1 Table 1
- [[Heading]]
- [[cell]]
-]
-
-[table A & B
- [[A][B]]
- [[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.
- ]
- ]
-]
-
-[table Nested Tables
- [
- [
- Header 1
- ]
- [
- Header 2
- ]
- ]
- [
- [
- [table Inner Table
- [[1.1][1.2]]
- [[2.1][2.2]]
- ]
- ]
- ]
- [
- [
- Something.
- ]
- ]
-]
-
-[#id1]
-[table Table with anchors
-[[[#id2]a[#id3]]][[b]]
-]
-
-[endsect]

Deleted: trunk/tools/quickbook/test/template-section.quickbook
==============================================================================
--- trunk/tools/quickbook/test/template-section.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,20 +0,0 @@
-[article Section in a template
- [quickbook 1.5]
-]
-
-[template nestedsection[]
-
-Some text before the section.
-
-[section Test]
-
-Hello.
-
-[heading Just to test id generation]
-
-Goodbye.
-
-[endsect]
-]
-
-[nestedsection]
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/templates.quickbook
==============================================================================
--- trunk/tools/quickbook/test/templates.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,200 +0,0 @@
-[article Templates
- [quickbook 1.3]
-]
-
-[section Templates]
-
-[/-------------------------------- nullary arg ]
-
-[template foo0 nullary_arg]
-
-[foo0]
-
-[/-------------------------------- unary arg, phrase syle ]
-
-[template foo1[bar] foo [bar]]
-
-[foo1 baz]
-
-[/-------------------------------- unary arg, block syle ]
-
-[template foo2[bar]
-foo [bar]
-]
-
-[foo2 baz]
-
-[template foo3[bar]
-This is a complete paragraph. [bar] [bar] [bar] [bar] [bar]
-[bar] [bar] [bar] [bar].... blah blah blah......
-]
-
-[foo3 kalamazoo]
-
-[/-------------------------------- unary arg, using punctuation ]
-
-[template ![bar] '''<hey>'''[bar]'''</hey>''']
-
-[!baz]
-
-[/-------------------------------- recursive templates ]
-
-[template foo4[bar]
-[foo3 [bar]]
-]
-
-[foo3 madagascar]
-
-[template foo5[x] zoom [x]]
-[template foo6[x] [x] zoom]
-
-[foo6[foo5 peanut]]
-
-[template kinda_weird[x y] [x] [y]]
-
-[kinda_weird exactly..xanadu]
-
-
-[/-------------------------------- space delimitted args ]
-
-[template simple1[a b] [a][b]]
-
-[simple1 w x]
-
-[template simple2[a b c d] [a][b][c][d]]
-
-[simple2 w x y z][simple2 w x y z trail]
-
-[/-------------------------------- John's templates ]
-
-[template code[x]
- int main()
- {
- std::cout << ``[x]`` << std::endl;
- }
-]
-
-[code "Hello\, World"]
-
-[template alpha '''&alpha;''']
-[template pow[a b] [a]'''<superscript>'''[b]'''</superscript>''' ]
-[template super[text]'''<superscript>'''[text]'''</superscript>''' ]
-
-[pow x 2]
-
-[pow [alpha] 2]
-
-x[super 2]
-
-[/-------------------------------- Some more ]
-
-[template banana got a banana?]
-[template plantation[bananarama] [bananarama]]
-
-[plantation [banana]]
-
-[/-------------------------------- Not a bug (there was a syntax error here) ]
-
-[template join1[a b] [b][a]]
-[template join2[a b] [a][b]]
-[template test[x] [join1 [join2 0 [x]]...0]]
-[test 0]
-
-[/-------------------------------- Mismatched template ]
-
-[template foo 1]
-[fool]
-
-[template blah 10]
-
-[endsect]
-
-[section Empty Templates]
-
-[template empty1]
-[template empty2 ]
-[template empty3 [/comment]]
-[template empty4 [/comment]
-
-]
-[template empty5
-]
-[template empty6
-
-]
-[template empty7
-[/comment]
-]
-[template empty8
-
-[/comment]
-]
-[template empty_arg1[x]]
-[template empty_arg2[x y]]
-
-[empty1]
-[empty2]
-[empty3]
-[empty4]
-[empty5]
-[empty6]
-[empty7]
-[empty8]
-[empty_arg1 1]
-[empty_arg2 1 2]
-
-[endsect]
-
-[/----------------------------------- Nested templates ]
-
-[section Nested Templates]
-
-[template block[content]
-
-Start block template.
-
-[content]
-
-End block template.
-]
-
-[template phrase[content] Start phrase template. [content] End phrase template.]
-
-Pre [block [block Hello!]] Post
-
-Pre [block [phrase Hello!]] Post
-
-Pre [phrase [block Hello!]] Post
-
-Pre [phrase [phrase Hello!]] Post
-
-[endsect]
-
-[/----------------------------------- Block Markup ]
-
-[section Block Markup]
-
-[template list
-* a
-* b]
-
-[template horizontal
-----]
-
-[template codeblock
- int main() {}]
-
-[template paragraphs
-Paragraphs 1
-
-Paragraphs 2
-]
-
-[list][horizontal][codeblock][paragraphs]
-
-* [list]
-* [horizontal]
-* [codeblock]
-* [paragraphs]
-
-[endsect]

Deleted: trunk/tools/quickbook/test/templates_1_4.gold
==============================================================================
--- trunk/tools/quickbook/test/templates_1_4.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,21 +0,0 @@
-<?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="template_1_4" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Template 1.4</title>
- <para>
- dynamic scoping
- </para>
- <para>
- old
- </para>
- <para>
- {1-2} {1-2} {1-2 3 4} {1 2-3 4} {1 2 3-4} {[1-2} {1..2-3} {1..2-3}
- </para>
- <para>
- {[binary 1 2-3} 4]
- </para>
- <para>
- {1-2-3} {1-2-3} {1-2-3 4} {1 2-3-4} {[1-2-3}
- </para>
-</article>

Deleted: trunk/tools/quickbook/test/templates_1_4.quickbook
==============================================================================
--- trunk/tools/quickbook/test/templates_1_4.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,37 +0,0 @@
-[article Template 1.4
- [quickbook 1.4]
-]
-
-[/ 1.4 uses dynamic scoping ]
-
-[template x static scoping]
-[template foo1[] [x]]
-[template foo2[x] [foo1]]
-[foo2 dynamic scoping]
-
-[/ In 1.4 template arguments are scoped at the point they are used]
-
-[template y new]
-[template foo3[a y] [a]]
-[foo3 [y] old]
-
-[/ 1.4 template arguments]
-
-[template binary[x y] {[x]-[y]}]
-[binary 1..2] [/ {1-2} ]
-[binary 1 2] [/ {1-2} ]
-[binary 1..2 3 4] [/ {1-2 3 4} ]
-[binary 1 2..3 4] [/ {1 2-3 4} ]
-[binary 1 2 3..4] [/ {1 2 3-4} ]
-[binary [1..2] [/ {(1-2} but with a square bracket ]
-[binary 1.\.2..3] [/ {1..2-3} ]
-[binary 1.\.2 3] [/ {1..2-3} ]
-
-[binary [binary 1 2..3] 4] [/ {[binary 1 2-3} 4] ]
-
-[template ternary[x y z] {[x]-[y]-[z]}]
-[ternary 1..2..3] [/ {1-2-3} ]
-[ternary 1 2 3] [/ {1-2-3} ]
-[ternary 1..2 3 4] [/ {1-2-3 4} ]
-[ternary 1 2..3 4] [/ {1 2-3-4} ]
-[ternary [1..2..3] [/ {(1-2-3} (but with a square bracket) ]
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/templates_1_5.gold
==============================================================================
--- trunk/tools/quickbook/test/templates_1_5.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,27 +0,0 @@
-<?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="template_1_5" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Template 1.5</title>
- <para>
- static scoping
- </para>
- <para>
- new
- </para>
- <para>
- foo foo
- </para>
- <para>
- {1-2} {1-2} {1-2 3 4} {1 2-3 4} {1 2 3-4} {1..2-3} {1..2-3}
- </para>
- <para>
- { {1 2-3}-4} { {1 2-3}-4} { {1-2 3}-4}
- </para>
- <para>
- {[1-2] 3} {[1-2] 3} {[1-2}
- </para>
- <para>
- {1-2-3} {1-2-3}
- </para>
-</article>

Deleted: trunk/tools/quickbook/test/templates_1_5.quickbook
==============================================================================
--- trunk/tools/quickbook/test/templates_1_5.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,46 +0,0 @@
-[article Template 1.5
- [quickbook 1.5]
-]
-
-[/ 1.5 uses static scoping ]
-
-[template x static scoping]
-[template foo1[] [x]]
-[template foo2[x] [foo1]]
-[foo2 dynamic scoping]
-
-[/ In 1.5 template arguments are scoped at the point they are defined]
-
-[template y new]
-[template foo3[a y] [a]]
-[foo3 [y] old]
-
-[/ From https://svn.boost.org/trac/boost/ticket/2034 ]
-
-[template same[x] [x]]
-[template echo[a b] [a] [b]]
-[template echo_twice[x] [echo [same [x]]..[same [x]]]]
-[echo_twice foo]
-
-[/ 1.5 template arguments]
-
-[template binary[x y] {[x]-[y]}]
-[binary 1..2] [/ {1-2} ]
-[binary 1 2] [/ {1-2} ]
-[binary 1..2 3 4] [/ {1-2 3 4} ]
-[binary 1 2..3 4] [/ {1 2-3 4} ]
-[binary 1 2 3..4] [/ {1 2 3-4} ]
-[binary 1.\.2..3] [/ {1..2-3} ]
-[binary 1.\.2 3] [/ {1..2-3} ]
-
-[binary [binary 1 2..3]..4] [/ { {1 2-3}-4} ]
-[binary [binary 1 2..3] 4] [/ { {1 2-3}-4} ]
-[binary [binary 1 2 3]..4] [/ { {1-2 3}-4} ]
-
-[binary \[1 2\] 3] [/ {[1-2] 3} ]
-[binary \[1..2\] 3] [/ {[1-2] 3} ]
-[binary \[1 2] [/ {(1-2} ]
-
-[template ternary[x y z] {[x]-[y]-[z]}]
-[ternary 1..2..3] [/ {1-2-3} ]
-[ternary 1 2 3] [/ {1-2-3} ]

Deleted: trunk/tools/quickbook/test/unicode-escape.quickbook
==============================================================================
--- trunk/tools/quickbook/test/unicode-escape.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,37 +0,0 @@
-[article UTF-8 test
- [quickbook 1.5]
-]
-
-[heading I\u00F1t\u00EBrn\u00E2ti\u00F4n\u00E0liz\u00E6ti\u00F8n]
-
-* \u0391\u03B1 Alpha
-* \u0392\u03B2 Beta
-* \u0393\u03B3 Gamma
-* \u0394\u03B4 Delta
-* \u0395\u03B5 Epsilon
-* \u0396\u03B6 Zeta
-* \u0397\u03B7 Eta
-* \u0398\u03B8 Theta
-* \u0399\u03B9 Iota
-* \u039A\u03BA Kappa
-* \u039B\u03BB Lambda
-* \u039C\u03BC Mu
-* \u039D\u03BD Nu
-* \u039E\u03BE Xi
-* \u039F\u03BF Omicron
-* \u03A0\u03C0 Pi
-* \u03A1\u03C1 Rho
-* \u03A3\u03C3\u03C2 Sigma
-* \u03A4\u03C4 Tau
-* \u03A5\u03C5 Upsilon
-* \u03A6\u03C6 Phi
-* \u03A7\u03C7 Chi
-* \u03A8\u03C8 Psi
-* \u03A9\u03C9 Omega
-
-In the unlikely event that you've got a Mahjong font:
-
-* \U0001F000 East Wind
-* \U0001F001 South Wind
-* \U0001F002 West Wind
-* \U0001F003 North Wind
\ No newline at end of file

Modified: trunk/tools/quickbook/test/unit/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/test/unit/Jamfile.v2 (original)
+++ trunk/tools/quickbook/test/unit/Jamfile.v2 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -9,9 +9,15 @@
 import testing ;
 
 project quickbook-unit-tests
- : requirements <include>../../src <warnings>all
+ : requirements
+ <include>../../src
+ <warnings>all
+ <library>/boost//filesystem
     ;
 
-run values_test.cpp ../../src/values.cpp ;
-run post_process_test.cpp ../../src/post_process.cpp ../../src/id_generator.cpp ;
-run iterator_tests.cpp ../../src/values.cpp ;
+run values_test.cpp ../../src/values.cpp ../../src/files.cpp ../../src/string_ref.cpp ;
+run post_process_test.cpp ../../src/post_process.cpp ;
+
+# Copied from spirit
+run symbols_tests.cpp ;
+run symbols_find_null.cpp ;
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/unit/iterator_tests.cpp
==============================================================================
--- trunk/tools/quickbook/test/unit/iterator_tests.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,71 +0,0 @@
-/*=============================================================================
- Copyright (c) 2011 Daniel James
-
- 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)
-=============================================================================*/
-
-// Use boost's iterator concept tests for our iterators.
-
-#include "fwd.hpp"
-#include "values.hpp"
-#include <boost/iterator/new_iterator_tests.hpp>
-#include <boost/iterator/iterator_concepts.hpp>
-#include <boost/concept_check.hpp>
-
-void iterator_concept_checks()
-{
- typedef quickbook::iterator Iter;
- boost::function_requires< boost::ForwardIterator<Iter> >();
- boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
- boost::function_requires< boost_concepts::LvalueIteratorConcept<Iter> >();
- boost::function_requires< boost_concepts::ForwardTraversalConcept<Iter> >();
-}
-
-void value_iterator_concept_checks()
-{
- typedef quickbook::value::iterator Iter;
- boost::function_requires< boost::ForwardIterator<Iter> >();
- boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
- boost::function_requires< boost_concepts::ForwardTraversalConcept<Iter> >();
-}
-
-void iterator_runtime_checks()
-{
- std::string x = "Hello World";
-
- quickbook::iterator i1(x.begin(), quickbook::file_position(10, 5));
- quickbook::iterator i2(++x.begin(), quickbook::file_position(10, 6));
-
- boost::forward_readable_iterator_test(i1, i2, 'H', 'e');
- boost::constant_lvalue_iterator_test(i1, 'H');
-}
-
-void value_iterator_runtime_checks()
-{
- quickbook::value v1 = quickbook::bbk_value("a", 10);
- quickbook::value v2 = quickbook::int_value(25, 32);
-
- quickbook::value_builder b;
- b.insert(v1);
- b.insert(v2);
- quickbook::value x = b.release();
-
- quickbook::value::iterator i1 = x.begin();
- quickbook::value::iterator i2 = ++x.begin();
-
- boost::forward_readable_iterator_test(i1, i2, v1, v2);
-}
-
-int main()
-{
- // I know I don't have to run the concept checks.
- // I'm a bit irrational like that.
- iterator_concept_checks();
- value_iterator_concept_checks();
- iterator_runtime_checks();
- value_iterator_runtime_checks();
-
- return boost::report_errors();
-}

Modified: trunk/tools/quickbook/test/unit/values_test.cpp
==============================================================================
--- trunk/tools/quickbook/test/unit/values_test.cpp (original)
+++ trunk/tools/quickbook/test/unit/values_test.cpp 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
@@ -13,35 +13,42 @@
 #include <boost/range/algorithm/equal.hpp>
 #include <vector>
 #include "values.hpp"
+#include "files.hpp"
 
 void empty_tests()
 {
     quickbook::value q;
     BOOST_TEST(q.empty());
     BOOST_TEST(!q.is_list());
- BOOST_TEST(!q.is_string());
+ BOOST_TEST(!q.is_encoded());
 }
 
 void qbk_tests()
 {
- std::string src = "Source";
- quickbook::value q = quickbook::qbk_value(
- quickbook::iterator(src.begin()),
- quickbook::iterator(src.end()));
- BOOST_TEST_EQ(q.get_quickbook(), src);
+ std::string source = "Source";
+ quickbook::value q;
+ {
+ quickbook::file_ptr fake_file = new quickbook::file(
+ "(fake file)", source, 105u);
+ q = quickbook::qbk_value(
+ fake_file,
+ fake_file->source.begin(),
+ fake_file->source.end());
+ }
+ BOOST_TEST_EQ(q.get_quickbook(), source);
 }
 
 void sort_test()
 {
     quickbook::value_builder b;
- b.insert(quickbook::bbk_value("a", 10));
- b.insert(quickbook::bbk_value("b", 2));
- b.insert(quickbook::bbk_value("c", 5));
- b.insert(quickbook::bbk_value("d", 8));
+ b.insert(quickbook::encoded_value("a", 10));
+ b.insert(quickbook::encoded_value("b", 2));
+ b.insert(quickbook::encoded_value("c", 5));
+ b.insert(quickbook::encoded_value("d", 8));
     b.sort_list();
     
     quickbook::value_consumer c = b.release();
- BOOST_TEST(c.check(2)); BOOST_TEST_EQ(c.consume(2).get_boostbook(), "b");
+ BOOST_TEST(c.check(2)); BOOST_TEST_EQ(c.consume(2).get_encoded(), "b");
     BOOST_TEST(c.check(5)); c.consume(5);
     BOOST_TEST(c.check(8)); c.consume(8);
     BOOST_TEST(c.check(10)); c.consume(10);
@@ -53,85 +60,32 @@
     quickbook::value_builder list1;
     quickbook::value_builder list2;
 
- list1.insert(quickbook::bbk_value("b", 10));
+ list1.insert(quickbook::encoded_value("b", 10));
 
     {
- quickbook::value p1 = quickbook::bbk_value("a", 5);
+ quickbook::value p1 = quickbook::encoded_value("a", 5);
         list1.insert(p1);
         list2.insert(p1);
     }
 
- list2.insert(quickbook::bbk_value("c", 3));
+ list2.insert(quickbook::encoded_value("c", 3));
 
     quickbook::value_consumer l1 = list1.release();
     quickbook::value_consumer l2 = list2.release();
 
     BOOST_TEST(l1.check(10));
- BOOST_TEST_EQ(l1.consume(10).get_boostbook(), "b");
+ BOOST_TEST_EQ(l1.consume(10).get_encoded(), "b");
     BOOST_TEST(l1.check(5));
- BOOST_TEST_EQ(l1.consume(5).get_boostbook(), "a");
+ BOOST_TEST_EQ(l1.consume(5).get_encoded(), "a");
     BOOST_TEST(!l1.check());
 
     BOOST_TEST(l2.check(5));
- BOOST_TEST_EQ(l2.consume(5).get_boostbook(), "a");
+ BOOST_TEST_EQ(l2.consume(5).get_encoded(), "a");
     BOOST_TEST(l2.check(3));
- BOOST_TEST_EQ(l2.consume(3).get_boostbook(), "c");
+ BOOST_TEST_EQ(l2.consume(3).get_encoded(), "c");
     BOOST_TEST(!l2.check());
 }
 
-void store_test1()
-{
- quickbook::stored_value q;
-
- {
- std::string src = "Hello";
- quickbook::value q1 = quickbook::qbk_value(
- quickbook::iterator(src.begin()),
- quickbook::iterator(src.end()),
- 5);
-
- BOOST_TEST_EQ(q1.get_quickbook(), "Hello");
- q = q1;
- BOOST_TEST_EQ(q.get_quickbook(), "Hello");
- BOOST_TEST_EQ(q1.get_quickbook(), "Hello");
- }
-
- BOOST_TEST_EQ(q.get_quickbook(), "Hello");
-}
-
-void store_test2_check(quickbook::value const& q)
-{
- quickbook::value_consumer l1 = q;
- BOOST_TEST(l1.check(5));
- BOOST_TEST_EQ(l1.consume(5).get_quickbook(), "Hello");
- BOOST_TEST(l1.check(10));
- BOOST_TEST_EQ(l1.consume(10).get_boostbook(), "World");
- BOOST_TEST(!l1.check());
-}
-
-void store_test2()
-{
- quickbook::stored_value q;
-
- {
- quickbook::value_builder list1;
- std::string src = "Hello";
- list1.insert(quickbook::qbk_value(
- quickbook::iterator(src.begin()),
- quickbook::iterator(src.end()),
- 5));
- list1.insert(quickbook::bbk_value("World", 10));
-
- quickbook::value q2 = list1.release();
-
- store_test2_check(q2);
- q = q2;
- store_test2_check(q);
- store_test2_check(q2);
- }
- store_test2_check(q);
-}
-
 void equality_tests()
 {
     std::vector<quickbook::value> distinct_values;
@@ -165,8 +119,6 @@
     qbk_tests();
     sort_test();
     multiple_list_test();
- store_test1();
- store_test2();
     equality_tests();
 
     return boost::report_errors();

Deleted: trunk/tools/quickbook/test/utf-16be-bom.quickbook
==============================================================================
Binary files trunk/tools/quickbook/test/utf-16be-bom.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011) and (empty file) differ

Deleted: trunk/tools/quickbook/test/utf-16le-bom.quickbook
==============================================================================
Binary files trunk/tools/quickbook/test/utf-16le-bom.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011) and (empty file) differ

Deleted: trunk/tools/quickbook/test/utf-8-bom.quickbook
==============================================================================
--- trunk/tools/quickbook/test/utf-8-bom.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,30 +0,0 @@
-[article UTF-8 test
- [quickbook 1.5]
-]
-
-[heading Iñtërnâtiônàlizætiøn]
-
-* Αα Alpha
-* Ββ Beta
-* Γγ Gamma
-* Δδ Delta
-* Εε Epsilon
-* Ζζ Zeta
-* Ηη Eta
-* Θθ Theta
-* Ιι Iota
-* Κκ Kappa
-* Λλ Lambda
-* Μμ Mu
-* Νν Nu
-* Ξξ Xi
-* Οο Omicron
-* Ππ Pi
-* Ρρ Rho
-* Σσς Sigma
-* Ττ Tau
-* Υυ Upsilon
-* Φφ Phi
-* Χχ Chi
-* Ψψ Psi
-* Ωω Omega
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/utf-8.quickbook
==============================================================================
--- trunk/tools/quickbook/test/utf-8.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,30 +0,0 @@
-[article UTF-8 test
- [quickbook 1.5]
-]
-
-[heading Iñtërnâtiônàlizætiøn]
-
-* Αα Alpha
-* Ββ Beta
-* Γγ Gamma
-* Δδ Delta
-* Εε Epsilon
-* Ζζ Zeta
-* Ηη Eta
-* Θθ Theta
-* Ιι Iota
-* Κκ Kappa
-* Λλ Lambda
-* Μμ Mu
-* Νν Nu
-* Ξξ Xi
-* Οο Omicron
-* Ππ Pi
-* Ρρ Rho
-* Σσς Sigma
-* Ττ Tau
-* Υυ Upsilon
-* Φφ Phi
-* Χχ Chi
-* Ψψ Psi
-* Ωω Omega
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/variablelist.gold
==============================================================================
--- trunk/tools/quickbook/test/variablelist.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,107 +0,0 @@
-<?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="variable_list_tests" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Variable List Tests</title>
- <variablelist>
- <title>Empty</title>
- </variablelist>
- <variablelist>
- <title>One entry</title>
- <varlistentry>
- <term>a</term>
- <listitem>
- <para>
- b
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <variablelist>
- <title>One entry, multiple items</title>
- <varlistentry>
- <term>a</term>
- <listitem>
- <para>
- b
- </para>
- <para>
- c
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <variablelist>
- <title>Several entries</title>
- <varlistentry>
- <term>a</term>
- <listitem>
- <para>
- b
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>a</term>
- <listitem>
- <para>
- b
- </para>
- <para>
- c
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>a</term>
- <listitem>
- <para>
- b
- </para>
- <para>
- c
- </para>
- <para>
- d
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>a</term>
- <listitem>
- <para>
- b
- </para>
- <para>
- c
- </para>
- <para>
- d
- </para>
- <para>
- e
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>a</term>
- <listitem>
- <para>
- b
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <anchor id="id1"/>
- <variablelist>
- <title>Variable List with anchors</title>
- <varlistentry>
- <term><anchor id="id2"/>a<anchor id="id3"/></term>
- <listitem>
- <para>
- <anchor id="id4"/>b<anchor id="id5"/>
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
-</article>

Deleted: trunk/tools/quickbook/test/variablelist.quickbook
==============================================================================
--- trunk/tools/quickbook/test/variablelist.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,31 +0,0 @@
-[article Variable List Tests
-[quickbook 1.5]
-]
-
-[variablelist Empty
-]
-
-[variablelist One entry
- [[a][b]]
-]
-
-[variablelist One entry, multiple items
- [[a][b][c]]
-]
-
-[variablelist Several entries
- [[a][b]]
- [[a][b][c]]
- [[a][b][c][d]]
- [[a][b][c][d][e]]
- [[a][b]]
-]
-
-[#id1]
-[variablelist Variable List with anchors
- [
- [[#id2]a[#id3]]
- [[#id4]b[#id5]]
- ]
-]
-

Deleted: trunk/tools/quickbook/test/xinclude.gold
==============================================================================
--- trunk/tools/quickbook/test/xinclude.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,6 +0,0 @@
-<?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="include" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
- <title>Include</title>
- <xi:include href="../test/stub.xml" />
-</article>

Deleted: trunk/tools/quickbook/test/xinclude.quickbook
==============================================================================
--- trunk/tools/quickbook/test/xinclude.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,4 +0,0 @@
-[article Include]
-
-[xinclude stub.xml]
-

Deleted: trunk/tools/quickbook/test/xml-escape_1_2.gold
==============================================================================
--- trunk/tools/quickbook/test/xml-escape_1_2.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
-<library id="test_that__amp____lt__are_being_escaped_" name="Test that &amp;, &lt; are being escaped."
-dirname="test_that__amp____lt__are_being_escaped_" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <libraryinfo>
- <legalnotice id="test_that__amp____lt__are_being_escaped_.legal">
- <para>
- &amp; should be &amp;amp;, &lt; should &amp;lt;
- </para>
- </legalnotice>
- <librarypurpose>
- &amp; should be &amp;amp;, &lt; should &amp;lt;
- </librarypurpose>
- </libraryinfo>
- <title>Test that &amp;, &lt; are being escaped.</title>
- <section id="test_that__amp____lt__are_being_escaped_.escapes___explicitly_written_markup">
- <title>Escapes &amp; explicitly written markup</title>
- <itemizedlist>
- <listitem>
- <simpara>
- &amp; -&gt; &amp;amp;
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- &lt; -&gt; &amp;lt;
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- &gt; -&gt; &amp;gt;
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- &quot; -&gt; &amp;quot;
- </simpara>
- </listitem>
- </itemizedlist>
- </section>
-</library>

Deleted: trunk/tools/quickbook/test/xml-escape_1_2.quickbook
==============================================================================
--- trunk/tools/quickbook/test/xml-escape_1_2.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,14 +0,0 @@
-[library Test that &amp;, &lt; are being escaped.
- [quickbook 1.2]
- [purpose &amp; should be &amp;amp;, &lt; should &amp;lt;]
- [license &amp; should be &amp;amp;, &lt; should &amp;lt;]
-]
-
-[section Escapes & explicitly written markup]
-
-* & -> &amp;
-* < -> &lt;
-* > -> &gt;
-* " -> &quot;
-
-[endsect]
\ No newline at end of file

Deleted: trunk/tools/quickbook/test/xml-escape_1_5.gold
==============================================================================
--- trunk/tools/quickbook/test/xml-escape_1_5.gold 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
-<library id="test_that__amp____lt__are_being_escaped_" name="Test that &amp;, &lt; are being escaped."
-dirname="test_that__amp____lt__are_being_escaped_" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
- xmlns:xi="http://www.w3.org/2001/XInclude">
- <libraryinfo>
- <legalnotice id="test_that__amp____lt__are_being_escaped_.legal">
- <para>
- &amp; should be &amp;amp;, &lt; should &amp;lt;
- </para>
- </legalnotice>
- <librarypurpose>
- &amp; should be &amp;amp;, &lt; should &amp;lt;
- </librarypurpose>
- </libraryinfo>
- <title>Test that &amp;, &lt; are being escaped.</title>
- <section id="test_that__amp____lt__are_being_escaped_.escapes___explicitly_written_markup">
- <title><link linkend="test_that__amp____lt__are_being_escaped_.escapes___explicitly_written_markup">Escapes
- &amp; explicitly written markup</link></title>
- <itemizedlist>
- <listitem>
- <simpara>
- &amp; -&gt; &amp;amp;
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- &lt; -&gt; &amp;lt;
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- &gt; -&gt; &amp;gt;
- </simpara>
- </listitem>
- <listitem>
- <simpara>
- &quot; -&gt; &amp;quot;
- </simpara>
- </listitem>
- </itemizedlist>
- </section>
-</library>

Deleted: trunk/tools/quickbook/test/xml-escape_1_5.quickbook
==============================================================================
--- trunk/tools/quickbook/test/xml-escape_1_5.quickbook 2011-11-27 16:34:56 EST (Sun, 27 Nov 2011)
+++ (empty file)
@@ -1,14 +0,0 @@
-[library Test that &amp;, &lt; are being escaped.
- [quickbook 1.5]
- [purpose & should be &amp;, < should &lt;]
- [license & should be &amp;, < should &lt;]
-]
-
-[section Escapes & explicitly written markup]
-
-* & -> &amp;
-* < -> &lt;
-* > -> &gt;
-* " -> &quot;
-
-[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