$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r84300 - in branches/release/tools/quickbook: . doc src test test/doc-info test/include test/python test/python/sub1 test/python/sub2 test/snippets test/unit test/versions
From: dnljms_at_[hidden]
Date: 2013-05-16 17:30:09
Author: danieljames
Date: 2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
New Revision: 84300
URL: http://svn.boost.org/trac/boost/changeset/84300
Log:
Merge quickbook to release.
Added:
   branches/release/tools/quickbook/test/doc-info/macros1-1_5.gold
      - copied unchanged from r84299, /trunk/tools/quickbook/test/doc-info/macros1-1_5.gold
   branches/release/tools/quickbook/test/doc-info/macros1-1_5.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/doc-info/macros1-1_5.quickbook
   branches/release/tools/quickbook/test/doc-info/macros1-1_6.gold
      - copied unchanged from r84299, /trunk/tools/quickbook/test/doc-info/macros1-1_6.gold
   branches/release/tools/quickbook/test/doc-info/macros1-1_6.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/doc-info/macros1-1_6.quickbook
   branches/release/tools/quickbook/test/doc-info/macros1-inc_1_6.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/doc-info/macros1-inc_1_6.quickbook
   branches/release/tools/quickbook/test/empty-inc.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/empty-inc.quickbook
   branches/release/tools/quickbook/test/include-inc-1_5.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/include-inc-1_5.quickbook
   branches/release/tools/quickbook/test/include-inc.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/include-inc.quickbook
   branches/release/tools/quickbook/test/include/compatibility-inc.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/include/compatibility-inc.quickbook
   branches/release/tools/quickbook/test/include/compatibility-inc_1_1.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/include/compatibility-inc_1_1.quickbook
   branches/release/tools/quickbook/test/include/compatibility-inc_1_5.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/include/compatibility-inc_1_5.quickbook
   branches/release/tools/quickbook/test/include/compatibility-inc_1_6.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/include/compatibility-inc_1_6.quickbook
   branches/release/tools/quickbook/test/include/in_section-inc1.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/include/in_section-inc1.quickbook
   branches/release/tools/quickbook/test/include/in_section-inc2.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/include/in_section-inc2.quickbook
   branches/release/tools/quickbook/test/include/include_id_unbalanced-inc1.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/include/include_id_unbalanced-inc1.quickbook
   branches/release/tools/quickbook/test/include/include_id_unbalanced-inc1a.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/include/include_id_unbalanced-inc1a.quickbook
   branches/release/tools/quickbook/test/include/include_id_unbalanced-inc2.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/include/include_id_unbalanced-inc2.quickbook
   branches/release/tools/quickbook/test/include/include_id_unbalanced-inc2a.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/include/include_id_unbalanced-inc2a.quickbook
   branches/release/tools/quickbook/test/include/nested_compatibility-inc-1_5.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/include/nested_compatibility-inc-1_5.quickbook
   branches/release/tools/quickbook/test/include/nested_compatibility-inc-1_6.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/include/nested_compatibility-inc-1_6.quickbook
   branches/release/tools/quickbook/test/include/source_mode-inc1.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/include/source_mode-inc1.quickbook
   branches/release/tools/quickbook/test/versions/invalid_macro-inc-1_1.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/versions/invalid_macro-inc-1_1.quickbook
   branches/release/tools/quickbook/test/versions/templates-inc-1_1.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/versions/templates-inc-1_1.quickbook
   branches/release/tools/quickbook/test/versions/templates-inc-1_4.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/versions/templates-inc-1_4.quickbook
   branches/release/tools/quickbook/test/versions/templates-inc-1_5.quickbook
      - copied unchanged from r84299, /trunk/tools/quickbook/test/versions/templates-inc-1_5.quickbook
Removed:
   branches/release/tools/quickbook/test/empty.qbk
   branches/release/tools/quickbook/test/include/compatibility-inc.qbk
   branches/release/tools/quickbook/test/include/compatibility-inc_1_1.qbk
   branches/release/tools/quickbook/test/include/compatibility-inc_1_5.qbk
   branches/release/tools/quickbook/test/include/compatibility-inc_1_6.qbk
   branches/release/tools/quickbook/test/include/in_section-include1.qbk
   branches/release/tools/quickbook/test/include/in_section-include2.qbk
   branches/release/tools/quickbook/test/include/include_id_unbalanced-inc1.qbk
   branches/release/tools/quickbook/test/include/include_id_unbalanced-inc1a.qbk
   branches/release/tools/quickbook/test/include/include_id_unbalanced-inc2.qbk
   branches/release/tools/quickbook/test/include/include_id_unbalanced-inc2a.qbk
   branches/release/tools/quickbook/test/include/nested_compatibility_inc-1_5.qbk
   branches/release/tools/quickbook/test/include/nested_compatibility_inc-1_6.qbk
   branches/release/tools/quickbook/test/include/source_mode-inc1.qbk
   branches/release/tools/quickbook/test/include_sub-1_5.qbk
   branches/release/tools/quickbook/test/include_sub.qbk
   branches/release/tools/quickbook/test/versions/invalid_macro-inc-1_1.qbk
   branches/release/tools/quickbook/test/versions/templates-1_1.qbk
   branches/release/tools/quickbook/test/versions/templates-1_4.qbk
   branches/release/tools/quickbook/test/versions/templates-1_5.qbk
Properties modified: 
   branches/release/tools/quickbook/   (props changed)
Text files modified: 
   branches/release/tools/quickbook/doc/1_6.qbk                                      |    25 ++++                                    
   branches/release/tools/quickbook/doc/change_log.qbk                               |    13 ++                                      
   branches/release/tools/quickbook/src/block_element_grammar.cpp                    |     5                                         
   branches/release/tools/quickbook/src/dependency_tracker.cpp                       |    65 +++++++++++--                           
   branches/release/tools/quickbook/src/dependency_tracker.hpp                       |     9 +                                       
   branches/release/tools/quickbook/src/doc_info_grammar.cpp                         |    20 +++                                     
   branches/release/tools/quickbook/src/files.cpp                                    |   192 ++++++++++++++++++++++++++++----------- 
   branches/release/tools/quickbook/src/grammar_impl.hpp                             |     1                                         
   branches/release/tools/quickbook/src/main_grammar.cpp                             |    90 +++++++++++++++++                       
   branches/release/tools/quickbook/src/quickbook.cpp                                |   134 ++++++++++++++++++++-------             
   branches/release/tools/quickbook/src/syntax_highlight.cpp                         |    54 ++++++----                              
   branches/release/tools/quickbook/test/code_cpp-1_5.gold                           |    15 ++                                      
   branches/release/tools/quickbook/test/code_cpp-1_5.quickbook                      |    12 ++                                      
   branches/release/tools/quickbook/test/doc-info/Jamfile.v2                         |     2                                         
   branches/release/tools/quickbook/test/include-1_5.quickbook                       |    14 +-                                      
   branches/release/tools/quickbook/test/include-1_6.quickbook                       |    10 +-                                      
   branches/release/tools/quickbook/test/include/compatibility-1_1.quickbook         |     8                                         
   branches/release/tools/quickbook/test/include/compatibility-1_5.quickbook         |     8                                         
   branches/release/tools/quickbook/test/include/compatibility-1_6.quickbook         |     8                                         
   branches/release/tools/quickbook/test/include/in_section-1_5.quickbook            |    12 +-                                      
   branches/release/tools/quickbook/test/include/in_section-1_6.quickbook            |    12 +-                                      
   branches/release/tools/quickbook/test/include/include_id_unbalanced-1_6.quickbook |     4                                         
   branches/release/tools/quickbook/test/include/nested_compatibility-1_5.quickbook  |     8                                         
   branches/release/tools/quickbook/test/include/nested_compatibility-1_6.quickbook  |     8                                         
   branches/release/tools/quickbook/test/include/source_mode-1_5.quickbook           |     2                                         
   branches/release/tools/quickbook/test/include/source_mode-1_6.quickbook           |     2                                         
   branches/release/tools/quickbook/test/include2-1_6.quickbook                      |     6                                         
   branches/release/tools/quickbook/test/include_win_path-1_6-fail.quickbook         |     2                                         
   branches/release/tools/quickbook/test/python/include_path.qbk                     |     8 +                                       
   branches/release/tools/quickbook/test/python/missing_relative.qbk                 |     8 +                                       
   branches/release/tools/quickbook/test/python/sub1/a.qbk                           |     8 +                                       
   branches/release/tools/quickbook/test/python/sub2/b.qbk                           |     8 +                                       
   branches/release/tools/quickbook/test/python/svg_missing.qbk                      |     8 +                                       
   branches/release/tools/quickbook/test/snippets/unbalanced_snippet1.cpp            |     2                                         
   branches/release/tools/quickbook/test/snippets/unbalanced_snippet2.cpp            |     2                                         
   branches/release/tools/quickbook/test/unit/source_map_test.cpp                    |    79 ++++++++++++++++                        
   branches/release/tools/quickbook/test/versions/invalid_macro-1_6.quickbook        |     4                                         
   branches/release/tools/quickbook/test/versions/versions-1_6.quickbook             |    12 +-                                      
   38 files changed, 679 insertions(+), 201 deletions(-)
Modified: branches/release/tools/quickbook/doc/1_6.qbk
==============================================================================
--- branches/release/tools/quickbook/doc/1_6.qbk	(original)
+++ branches/release/tools/quickbook/doc/1_6.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -70,6 +70,19 @@
 
 [endsect] [/docinfo]
 
+[section:doc-info-macros Macros in docinfo block]
+
+You can now expand macros in text fields in the docinfo block. In the top
+docinfo block only the predefined macros are available, but in nested documents
+macros defined in the parent document are also available.
+
+There's a small bug here - this leaks into older versions for the `license`
+and `purpose` fields, but since only the predefined macros are available, it's
+unlikely to break any existing documents. So I'd rather not complicate the code
+further by fixing that.
+
+[endsect]
+
 [section:scope Scoping templates and macros]
 
 A long standing quickbook bug is that macros are scoped by file, but templates
@@ -241,8 +254,13 @@
 so that they aren't wrapped in paragraph tags. The main use is
 for escaped docbook block tags, such as:
 
-    [template chapter[title] [block'''<chapter><title>'''[title]'''</title>''']]
-    [template chapterend [block'''</chapter>''']]
+    [template chapter[title]
+    [block'''<chapter><title>'''[title]'''</title>''']
+    ]
+
+    [template chapterend
+    [block'''</chapter>''']
+    ]
 
     [chapter An example chapter]
 
@@ -253,6 +271,9 @@
 Without the `block` element, the `chapter` and `chapterend` templates
 would be wrapped in paragraph tags.
 
+[note In this example, the template body has to start with a newline so that
+the template will be interpreted in block mode.]
+
 [endsect]
 
 [section:lists `ordered_list` and `itemized_list`]
Modified: branches/release/tools/quickbook/doc/change_log.qbk
==============================================================================
--- branches/release/tools/quickbook/doc/change_log.qbk	(original)
+++ branches/release/tools/quickbook/doc/change_log.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -279,6 +279,19 @@
 
 * When code blocks are indented using a mixture of tabs and spaces,
   convert indentation to spaces.
+* In the C++ systax highlighter, fix syntax highlighting for `#`, so that it's
+  used for preprocessor statements at the start of a line, and as a 'special'
+  character elsewhere
+  ([@https://svn.boost.org/trac/boost/ticket/8510 #8510],
+  [@https://svn.boost.org/trac/boost/ticket/8511 #8511]).
+* Add C++11 keywords to syntax highlighter
+  ([@https://svn.boost.org/trac/boost/ticket/8541 #8541]).
+* Hidden options for formatting of `--output-deps`. Not really for public use
+* yet.
+* 1.6 changes:
+  * Better template argument parsing, so that it understands things
+    like escaped markup.
+  * Support for using macros in the doc info block.
 * Internal changes:
   * Convert to use `boost::string_ref`.
   * Clean up the source map implementation (used to get the correct
Modified: branches/release/tools/quickbook/src/block_element_grammar.cpp
==============================================================================
--- branches/release/tools/quickbook/src/block_element_grammar.cpp	(original)
+++ branches/release/tools/quickbook/src/block_element_grammar.cpp	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -169,7 +169,10 @@
             ;
 
         local.template_body =
-           *(('[' >> local.template_body >> ']') | (cl::anychar_p - ']'))
+                qbk_ver(106u)
+            >>  *(~cl::eps_p(']') >> skip_entity)
+            |   qbk_ver(0,106u)
+            >>  *(('[' >> local.template_body >> ']') | (cl::anychar_p - ']'))
             >> cl::eps_p(space >> ']')
             >> space
             ;
Modified: branches/release/tools/quickbook/src/dependency_tracker.cpp
==============================================================================
--- branches/release/tools/quickbook/src/dependency_tracker.cpp	(original)
+++ branches/release/tools/quickbook/src/dependency_tracker.cpp	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -56,28 +56,69 @@
         return fs::canonical(p) / extra;
     }
 
-    bool dependency_tracker::add_dependency(fs::path const& f) {
-        bool found = fs::exists(fs::status(f));
-        dependencies[normalize_path(f)] |= found;
-        return found;
-    }
+    static char const* control_escapes[16] = {
+        "\\000", "\\001", "\\002", "\\003",
+        "\\004", "\\005", "\\006", "\\a",
+        "\\b",   "\\t",   "\\n",   "\\v",
+        "\\f",   "\\r",   "\\016", "\\017"
+    };
 
-    void dependency_tracker::write_dependencies(std::ostream& out)
+    static std::string escaped_path(std::string const& generic)
     {
-        BOOST_FOREACH(dependency_list::value_type const& d, dependencies)
+        std::string result;
+        result.reserve(generic.size());
+
+        BOOST_FOREACH(char c, generic)
         {
-            if (d.second) {
-                out << detail::path_to_generic(d.first) << std::endl;
+            if (c >= 0 && c < 16) {
+                result += control_escapes[(unsigned int) c];
+            }
+            else if (c == '\\') {
+                result += "\\\\";
+            }
+            else if (c == 127) {
+                result += "\\177";
+            }
+            else {
+                result += c;
             }
         }
+
+        return result;
     }
 
-    void dependency_tracker::write_checked_locations(std::ostream& out)
+    static std::string get_path(fs::path const& path,
+            dependency_tracker::flags f)
+    {
+        std::string generic = detail::path_to_generic(path);
+
+        if (f & dependency_tracker::escaped) {
+            generic = escaped_path(generic);
+        }
+
+        return generic;
+    }
+
+    bool dependency_tracker::add_dependency(fs::path const& f) {
+        bool found = fs::exists(fs::status(f));
+        dependencies[normalize_path(f)] |= found;
+        return found;
+    }
+
+    void dependency_tracker::write_dependencies(std::ostream& out,
+            flags f)
     {
         BOOST_FOREACH(dependency_list::value_type const& d, dependencies)
         {
-            out << (d.second ? "+ " : "- ")
-                << detail::path_to_generic(d.first) << std::endl;
+            if (f & checked) {
+                out << (d.second ? "+ " : "- ")
+                    << get_path(d.first, f) << std::endl;
+            }
+            else {
+                if (d.second) {
+                    out << get_path(d.first, f) << std::endl;
+                }
+            }
         }
     }
 }
Modified: branches/release/tools/quickbook/src/dependency_tracker.hpp
==============================================================================
--- branches/release/tools/quickbook/src/dependency_tracker.hpp	(original)
+++ branches/release/tools/quickbook/src/dependency_tracker.hpp	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -25,12 +25,17 @@
 
     public:
 
+        enum flags {
+            default_ = 0,
+            checked = 1,
+            escaped = 2
+        };
+
         // Call this before loading any file so that it will be included in the
         // list of dependencies. Returns true if file exists.
         bool add_dependency(fs::path const&);
 
-        void write_dependencies(std::ostream&);
-        void write_checked_locations(std::ostream&);
+        void write_dependencies(std::ostream&, flags = default_);
     };
 }
 
Modified: branches/release/tools/quickbook/src/doc_info_grammar.cpp
==============================================================================
--- branches/release/tools/quickbook/src/doc_info_grammar.cpp	(original)
+++ branches/release/tools/quickbook/src/doc_info_grammar.cpp	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -75,7 +75,7 @@
                         doc_authors, doc_author,
                         doc_copyright, doc_copyright_holder,
                         doc_source_mode, doc_biblioid, doc_compatibility_mode,
-                        quickbook_version, char_;
+                        quickbook_version, macro, char_;
         cl::uint_parser<int, 10, 4, 4> doc_copyright_year;
         cl::symbols<> doc_types;
         cl::symbols<value::tag_type> doc_info_attributes;
@@ -119,6 +119,7 @@
         // Actions
         error_action error(state);
         plain_char_action plain_char(state.phrase, state);
+        do_macro_action do_macro(state.phrase, state);
         scoped_parser<to_value_scoped_action> to_value(state);
         
         doc_info_details =
@@ -302,6 +303,21 @@
 
         local.attribute_rules[doc_info_attributes::biblioid] = &local.doc_biblioid;
 
-        local.char_ = escape | cl::anychar_p[plain_char];
+        local.char_ =
+                escape
+            |   local.macro
+            |   cl::anychar_p[plain_char];
+            ;
+
+        local.macro =
+            cl::eps_p
+            (   (   state.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
+            )
+            >>  state.macro                     [do_macro]
+            ;
     }
 }
Modified: branches/release/tools/quickbook/src/files.cpp
==============================================================================
--- branches/release/tools/quickbook/src/files.cpp	(original)
+++ branches/release/tools/quickbook/src/files.cpp	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -195,15 +195,13 @@
         std::string::size_type original_pos;
         std::string::size_type our_pos;
         section_types section_type;
-        int indentation;
 
         mapped_file_section(
                 std::string::size_type original_pos,
                 std::string::size_type our_pos,
-                section_types section_type = normal,
-                int indentation = 0) :
+                section_types section_type = normal) :
             original_pos(original_pos), our_pos(our_pos),
-            section_type(section_type), indentation(indentation) {}
+            section_type(section_type) {}
     };
 
     struct mapped_section_original_cmp
@@ -278,12 +276,11 @@
                 pos - original->source().begin(), source().size()));
         }
 
-        void add_indented_mapped_file_section(boost::string_ref::const_iterator pos,
-                int indentation)
+        void add_indented_mapped_file_section(boost::string_ref::const_iterator pos)
         {
             mapped_sections.push_back(mapped_file_section(
                 pos - original->source().begin(), source().size(),
-                mapped_file_section::indented, indentation));
+                mapped_file_section::indented));
         }
 
         std::string::size_type to_original_pos(
@@ -293,10 +290,16 @@
             switch (section->section_type) {
                 case mapped_file_section::normal:
                     return pos - section->our_pos + section->original_pos;
+
                 case mapped_file_section::empty:
                     return section->original_pos;
+
                 case mapped_file_section::indented: {
+                    // Will contain the start of the current line.
                     boost::string_ref::size_type our_line = section->our_pos;
+
+                    // Will contain the number of lines in the block before
+                    // the current line.
                     unsigned newline_count = 0;
 
                     for(boost::string_ref::size_type i = section->our_pos;
@@ -307,10 +310,8 @@
                             ++newline_count;
                         }
                     }
-                    
-                    if (newline_count == 0)
-                        return pos - section->our_pos + section->original_pos;
 
+                    // The start of the line in the original source.
                     boost::string_ref::size_type original_line =
                         section->original_pos;
                     
@@ -319,18 +320,23 @@
                             --newline_count;
                         ++original_line;
                     }
-                    
-                    for(unsigned i = section->indentation; i > 0; --i) {
-                        if (original->source()[original_line] == '\n' ||
-                            original->source()[original_line] == '\0') break;
-                        assert(original->source()[original_line] == ' ' ||
-                            original->source()[original_line] == '\t');
-                        ++original_line;
-                    }
-                    
+
+                    // The start of line content (i.e. after indentation).
+                    our_line = skip_indentation(source(), our_line);
+
+                    // The position is in the middle of indentation, so
+                    // just return the start of the whitespace, which should
+                    // be good enough.
+                    if (our_line > pos) return original_line;
+
+                    original_line =
+                        skip_indentation(original->source(), original_line);
+
+                    // Confirm that we are actually in the same position.
                     assert(original->source()[original_line] ==
                         source()[our_line]);
 
+                    // Calculate the position
                     return original_line + (pos - our_line);
                 }
                 default:
@@ -353,6 +359,16 @@
         }
 
         virtual file_position position_of(boost::string_ref::const_iterator) const;
+
+    private:
+
+        static std::string::size_type skip_indentation(
+                boost::string_ref src, std::string::size_type i)
+        {
+            while (i != src.size() && (src[i] == ' ' || src[i] == '\t')) ++i;
+            return i;
+        }
+
     };
 
     namespace {
@@ -436,14 +452,14 @@
     
             data->new_file->mapped_sections.push_back(mapped_file_section(
                     x.data->new_file->to_original_pos(start, begin),
-                    size, start->section_type, start->indentation));
+                    size, start->section_type));
     
             for (++start; start != x.data->new_file->mapped_sections.end() &&
                     start->our_pos < end; ++start)
             {
                 data->new_file->mapped_sections.push_back(mapped_file_section(
                     start->original_pos, start->our_pos - begin + size,
-                    start->section_type, start->indentation));
+                    start->section_type));
             }
     
             data->new_file->source_.append(
@@ -452,68 +468,130 @@
         }
     }
 
+    boost::string_ref::size_type indentation_count(boost::string_ref x)
+    {
+        unsigned count = 0;
+
+        for(boost::string_ref::const_iterator begin = x.begin(), end = x.end();
+            begin != end; ++begin)
+        {
+            switch(*begin)
+            {
+            case ' ':
+                ++count;
+                break;
+            case '\t':
+                // hardcoded tab to 4 for now
+                count = count - (count % 4) + 4;
+                break;
+            default:
+                assert(false);
+            }
+        }
+
+        return count;
+    }
+
     void mapped_file_builder::unindent_and_add(boost::string_ref x)
     {
-        std::string program(x.begin(), x.end());
+        // I wanted to do everything using a string_ref, but unfortunately
+        // they don't have all the overloads used in here. So...
+        std::string const program(x.begin(), x.end());
 
         // Erase leading blank lines and newlines:
         std::string::size_type start = program.find_first_not_of(" \t\r\n");
         if (start == std::string::npos) return;
 
         start = program.find_last_of("\r\n", start);
-        if (start != std::string::npos)
-        {
-            ++start;
-            program.erase(0, start);
-        }
+        start = start == std::string::npos ? 0 : start + 1;
+
+        assert(start < program.size());
 
-        assert(program.size() != 0);
+        // Get the first line indentation
+        std::string::size_type indent = program.find_first_not_of(" \t", start) - start;
+        boost::string_ref::size_type full_indent = indentation_count(
+            boost::string_ref(&program[start], indent));
 
-        // 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)
+        std::string::size_type pos = start;
+
+        // Calculate the minimum indent from the rest of the lines
+        // Detecting a mix of spaces and tabs.
+        while (std::string::npos != (pos = program.find_first_of("\r\n", pos)))
         {
-            // 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;
+            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) break;
+
+            char ch = program[n];
+            if (ch == '\r' || ch == '\n') continue; // ignore empty lines
+
+            indent = (std::min)(indent, n-pos);
+            full_indent = (std::min)(full_indent, indentation_count(
+                boost::string_ref(&program[pos], n-pos)));
         }
 
-        // Calculate the minimum indent from the rest of the lines
-        do
+        // Detect if indentation is mixed.
+        bool mixed_indentation = false;
+        boost::string_ref first_indent(&program[start], indent);
+        pos = start;
+
+        while (std::string::npos != (pos = program.find_first_of("\r\n", pos)))
         {
             pos = program.find_first_not_of("\r\n", pos);
-            if (std::string::npos == pos)
-                break;
+            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);
+            if (n == std::string::npos || n-pos < indent) continue;
+
+            if (boost::string_ref(&program[pos], indent) != first_indent) {
+                mixed_indentation = true;
+                break;
             }
         }
-        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)))
-        {
+        std::string unindented_program;
+        std::string::size_type copy_start = start;
+        pos = start;
+
+        do {
             if (std::string::npos == (pos = program.find_first_not_of("\r\n", pos)))
-            {
                 break;
+
+            unindented_program.append(program.begin() + copy_start, program.begin() + pos);
+            copy_start = pos;
+
+            // Find the end of the indentation.
+            std::string::size_type next = program.find_first_not_of(" \t", pos);
+            if (next == std::string::npos) next = program.size();
+
+            if (mixed_indentation)
+            {
+                unsigned length = indentation_count(boost::string_ref(
+                    &program[pos], next - pos));
+
+                if (length > full_indent) {
+                    std::string new_indentation(length - full_indent, ' ');
+                    unindented_program.append(new_indentation);
+                }
+
+                copy_start = next;
+            }
+            else
+            {
+                copy_start = (std::min)(pos + indent, next);
             }
 
-            std::string::size_type next = program.find_first_of("\r\n", pos);
-            program.erase(pos, (std::min)(indent, next-pos));
-        }
+            pos = next;
+        } while (std::string::npos !=
+            (pos = program.find_first_of("\r\n", pos)));
+
+        unindented_program.append(program.begin() + copy_start, program.end());
 
-        data->new_file->add_indented_mapped_file_section(x.begin() + indent, indent);
-        data->new_file->source_.append(program);
+        data->new_file->add_indented_mapped_file_section(x.begin());
+        data->new_file->source_.append(unindented_program);
     }
 
     file_position mapped_file::position_of(boost::string_ref::const_iterator pos) const
Modified: branches/release/tools/quickbook/src/grammar_impl.hpp
==============================================================================
--- branches/release/tools/quickbook/src/grammar_impl.hpp	(original)
+++ branches/release/tools/quickbook/src/grammar_impl.hpp	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -77,6 +77,7 @@
         cl::rule<scanner> attribute_value_1_7;
         cl::rule<scanner> escape;
         cl::rule<scanner> raw_escape;
+        cl::rule<scanner> skip_entity;
 
         // Miscellaneous stuff
         cl::rule<scanner> hard_space;
Modified: branches/release/tools/quickbook/src/main_grammar.cpp
==============================================================================
--- branches/release/tools/quickbook/src/main_grammar.cpp	(original)
+++ branches/release/tools/quickbook/src/main_grammar.cpp	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -128,17 +128,19 @@
                         top_level, indent_check,
                         paragraph_separator,
                         code, code_line, blank_line, hr,
-                        inline_code,
+                        inline_code, skip_inline_code,
                         template_,
-                        code_block, macro,
+                        code_block, skip_code_block, macro,
                         template_args,
                         template_args_1_4, template_arg_1_4,
                         template_inner_arg_1_4, brackets_1_4,
                         template_args_1_5, template_arg_1_5, template_arg_1_5_content,
                         template_inner_arg_1_5, brackets_1_5,
+                        template_args_1_6, template_arg_1_6, template_arg_1_6_content,
                         break_,
                         command_line_macro_identifier,
-                        dummy_block, line_dummy_block, square_brackets
+                        dummy_block, line_dummy_block, square_brackets,
+                        skip_escape
                         ;
 
         struct simple_markup_closure
@@ -540,6 +542,17 @@
             |   cl::anychar_p               [plain_char]
             ;
 
+        skip_entity =
+                '['
+            >>  *(~cl::eps_p(']') >> skip_entity)
+            >>  !cl::ch_p(']')
+            |   local.skip_code_block
+            |   local.skip_inline_code
+            |   local.skip_escape
+            |   comment
+            |   (cl::anychar_p - '[' - ']')
+            ;
+
         local.square_brackets =
             (   cl::ch_p('[')           [plain_char]
             >>  paragraph_phrase
@@ -580,7 +593,8 @@
             ;
 
         local.template_args =
-                qbk_ver(105u) >> local.template_args_1_5
+                qbk_ver(106u) >> local.template_args_1_6
+            |   qbk_ver(105u, 106u) >> local.template_args_1_5
             |   qbk_ver(0, 105u) >> local.template_args_1_4
             ;
 
@@ -622,6 +636,19 @@
             '[' >> local.template_inner_arg_1_5 >> ']'
             ;
 
+        local.template_args_1_6 = local.template_arg_1_6 >> *(".." >> local.template_arg_1_6);
+
+        local.template_arg_1_6 =
+            (   cl::eps_p(*cl::blank_p >> cl::eol_p)
+            >>  local.template_arg_1_6_content  [state.values.entry(ph::arg1, ph::arg2, template_tags::block)]
+            |   local.template_arg_1_6_content  [state.values.entry(ph::arg1, ph::arg2, template_tags::phrase)]
+            )
+            ;
+
+        local.template_arg_1_6_content =
+            + ( ~cl::eps_p("..") >> skip_entity )
+            ;
+
         local.break_
             =   (   '['
                 >>  space
@@ -645,6 +672,48 @@
             ]                                   [element]
             ;
 
+        local.skip_inline_code =
+                '`'
+            >>  *(cl::anychar_p -
+                    (   '`'
+                    |   (cl::eol_p >> *cl::blank_p >> cl::eol_p)
+                                                // Make sure that we don't go
+                    )                           // past a single block
+                )
+            >>  !cl::ch_p('`')
+            ;
+
+        local.skip_code_block =
+                "```"
+            >>  ~cl::eps_p("`")
+            >>  (   !(  *(*cl::blank_p >> cl::eol_p)
+                    >>  (   *(  "````" >> *cl::ch_p('`')
+                            |   (   cl::anychar_p
+                                -   (*cl::space_p >> "```" >> ~cl::eps_p("`"))
+                                )
+                            )
+                            >>  !(*cl::blank_p >> cl::eol_p)
+                        )
+                    >>  (*cl::space_p >> "```")
+                    )
+                |   *cl::anychar_p
+                )
+            |   "``"
+            >>  ~cl::eps_p("`")
+            >>  (   (   *(*cl::blank_p >> cl::eol_p)
+                    >>  (   *(  "```" >> *cl::ch_p('`')
+                            |   (   cl::anychar_p
+                                -   (*cl::space_p >> "``" >> ~cl::eps_p("`"))
+                                )
+                            )
+                            >>  !(*cl::blank_p >> cl::eol_p)
+                        )
+                    >>  (*cl::space_p >> "``")
+                    )
+                |   *cl::anychar_p
+                )
+            ;
+
         local.code_block =
                 "```"
             >>  ~cl::eps_p("`")
@@ -746,6 +815,19 @@
                 ]
             ;
 
+        local.skip_escape =
+                cl::str_p("\\n")
+            |   cl::str_p("\\ ")
+            |   '\\' >> cl::punct_p
+            |   "\\u" >> cl::repeat_p(4) [cl::chset<>("0-9a-fA-F")]
+            |   "\\U" >> cl::repeat_p(8) [cl::chset<>("0-9a-fA-F")]
+            |   ("'''" >> !eol)
+            >>  (*(cl::anychar_p - "'''"))
+            >>  (   cl::str_p("'''")
+                |   cl::eps_p
+                )
+            ;
+
         raw_escape =
                 cl::str_p("\\n")                [error("Newlines invalid here.")]
             |   cl::str_p("\\ ")                // ignore an escaped space
Modified: branches/release/tools/quickbook/src/quickbook.cpp
==============================================================================
--- branches/release/tools/quickbook/src/quickbook.cpp	(original)
+++ branches/release/tools/quickbook/src/quickbook.cpp	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -24,6 +24,8 @@
 #include <boost/ref.hpp>
 #include <boost/version.hpp>
 #include <boost/foreach.hpp>
+#include <boost/algorithm/string/split.hpp>
+#include <boost/algorithm/string/classification.hpp>
 
 #include <stdexcept>
 #include <vector>
@@ -111,16 +113,29 @@
         }
     }
 
+    struct parse_document_options
+    {
+        parse_document_options() :
+            indent(-1),
+            linewidth(-1),
+            pretty_print(true),
+            deps_out_flags(quickbook::dependency_tracker::default_)
+        {}
+
+        int indent;
+        int linewidth;
+        bool pretty_print;
+        fs::path deps_out;
+        quickbook::dependency_tracker::flags deps_out_flags;
+        fs::path locations_out;
+        fs::path xinclude_base;
+    };
+
     static int
     parse_document(
         fs::path const& filein_
       , fs::path const& fileout_
-      , fs::path const& deps_out_
-      , fs::path const& locations_out_
-      , fs::path const& xinclude_base_
-      , int indent
-      , int linewidth
-      , bool pretty_print)
+      , parse_document_options const& options_)
     {
         string_stream buffer;
         id_manager ids;
@@ -128,7 +143,7 @@
         int result = 0;
 
         try {
-            quickbook::state state(filein_, xinclude_base_, buffer, ids);
+            quickbook::state state(filein_, options_.xinclude_base, buffer, ids);
             set_macros(state);
 
             if (state.error_count == 0) {
@@ -145,16 +160,18 @@
 
             result = state.error_count ? 1 : 0;
 
-            if (!deps_out_.empty())
+            if (!options_.deps_out.empty())
             {
-                fs::ofstream out(deps_out_);
-                state.dependencies.write_dependencies(out);
+                fs::ofstream out(options_.deps_out);
+                state.dependencies.write_dependencies(out,
+                        options_.deps_out_flags);
             }
 
-            if (!locations_out_.empty())
+            if (!options_.locations_out.empty())
             {
-                fs::ofstream out(locations_out_);
-                state.dependencies.write_checked_locations(out);
+                fs::ofstream out(options_.locations_out);
+                state.dependencies.write_dependencies(out,
+                        dependency_tracker::checked);
             }
         }
         catch (load_error& e) {
@@ -177,11 +194,12 @@
                 return 1;
             }
 
-            if (pretty_print)
+            if (options_.pretty_print)
             {
                 try
                 {
-                    fileout << post_process(stage2, indent, linewidth);
+                    fileout << post_process(stage2, options_.indent,
+                        options_.linewidth);
                 }
                 catch (quickbook::post_process_failure&)
                 {
@@ -243,6 +261,8 @@
         quickbook::detail::initialise_output();
         quickbook::detail::initialise_markups();
 
+        // Declare the program options
+
         options_description desc("Allowed options");
         options_description hidden("Hidden options");
         options_description all("All options");
@@ -277,10 +297,15 @@
             ("xinclude-base", PO_VALUE<input_string>(),
                 "Generate xincludes as if generating for this target "
                 "directory.")
+            ("output-deps-format", PO_VALUE<input_string>(),
+             "Comma separated list of formatting options for output-deps, "
+             "options are: escaped, checked")
             ("output-checked-locations", PO_VALUE<input_string>(),
              "Writes a file listing all the file locations that were "
              "checked, starting with '+' if they were found, or '-' "
-             "if they weren't.")
+             "if they weren't.\n"
+             "This is deprecated, use 'output-deps-format=checked' to "
+             "write the deps file in this format.")
         ;
 
         all.add(desc).add(hidden);
@@ -288,10 +313,9 @@
         positional_options_description p;
         p.add("input-file", -1);
 
+        // Read option from the command line
+
         variables_map vm;
-        int indent = -1;
-        int linewidth = -1;
-        bool pretty_print = true;
 
 #if QUICKBOOK_WIDE_PATHS
         quickbook::ignore_variable(&argc);
@@ -321,6 +345,9 @@
 
         notify(vm);
 
+        // Process the command line options
+
+        quickbook::parse_document_options parse_document_options;
         bool expect_errors = vm.count("expect-errors");
         int error_count = 0;
 
@@ -352,15 +379,15 @@
             quickbook::ms_errors = true;
 
         if (vm.count("no-pretty-print"))
-            pretty_print = false;
+            parse_document_options.pretty_print = false;
 
         quickbook::self_linked_headers = !vm.count("no-self-link-headers");
 
         if (vm.count("indent"))
-            indent = vm["indent"].as<int>();
+            parse_document_options.indent = vm["indent"].as<int>();
 
         if (vm.count("linewidth"))
-            linewidth = vm["linewidth"].as<int>();
+            parse_document_options.linewidth = vm["linewidth"].as<int>();
 
         if (vm.count("debug"))
         {
@@ -410,22 +437,56 @@
             fs::path filein = quickbook::detail::input_to_path(
                 vm["input-file"].as<input_string>());
             fs::path fileout;
-            fs::path deps_out;
-            fs::path locations_out;
 
             bool default_output = true;
 
             if (vm.count("output-deps"))
             {
-                deps_out = quickbook::detail::input_to_path(
-                    vm["output-deps"].as<input_string>());
+                parse_document_options.deps_out =
+                    quickbook::detail::input_to_path(
+                        vm["output-deps"].as<input_string>());
                 default_output = false;
             }
 
+            if (vm.count("output-deps-format"))
+            {
+                std::string format_flags =
+                    quickbook::detail::input_to_utf8(
+                        vm["output-deps-format"].as<input_string>());
+
+                std::vector<std::string> flag_names;
+                boost::algorithm::split(flag_names, format_flags,
+                        boost::algorithm::is_any_of(", "),
+                        boost::algorithm::token_compress_on);
+
+                unsigned flags = 0;
+
+                BOOST_FOREACH(std::string const& flag, flag_names) {
+                    if (flag == "checked") {
+                        flags |= quickbook::dependency_tracker::checked;
+                    }
+                    else if (flag == "escaped") {
+                        flags |= quickbook::dependency_tracker::escaped;
+                    }
+                    else if (!flag.empty()) {
+                        quickbook::detail::outerr()
+                            << "Unknown dependency format flag: "
+                            << flag
+                            <<std::endl;
+
+                        ++error_count;
+                    }
+                }
+
+                parse_document_options.deps_out_flags =
+                    quickbook::dependency_tracker::flags(flags);
+            }
+
             if (vm.count("output-checked-locations"))
             {
-                locations_out = quickbook::detail::input_to_path(
-                    vm["output-checked-locations"].as<input_string>());
+                parse_document_options.locations_out =
+                    quickbook::detail::input_to_path(
+                        vm["output-checked-locations"].as<input_string>());
                 default_output = false;
             }
 
@@ -440,20 +501,20 @@
                 fileout.replace_extension(".xml");
             }
 
-            fs::path xinclude_base;
             if (vm.count("xinclude-base"))
             {
-                xinclude_base = quickbook::detail::input_to_path(
-                    vm["xinclude-base"].as<input_string>());
+                parse_document_options.xinclude_base =
+                    quickbook::detail::input_to_path(
+                        vm["xinclude-base"].as<input_string>());
             }
             else
             {
-                xinclude_base = fileout.parent_path();
-                if (xinclude_base.empty())
-                    xinclude_base = ".";
+                parse_document_options.xinclude_base = fileout.parent_path();
+                if (parse_document_options.xinclude_base.empty())
+                    parse_document_options.xinclude_base = ".";
             }
 
-            if (!fs::is_directory(xinclude_base))
+            if (!fs::is_directory(parse_document_options.xinclude_base))
             {
                 quickbook::detail::outerr()
                     << (vm.count("xinclude-base") ?
@@ -480,8 +541,7 @@
 
             if (!error_count)
                 error_count += quickbook::parse_document(
-                        filein, fileout, deps_out, locations_out,
-                        xinclude_base, indent, linewidth, pretty_print);
+                        filein, fileout, parse_document_options);
 
             if (expect_errors)
             {
Modified: branches/release/tools/quickbook/src/syntax_highlight.cpp
==============================================================================
--- branches/release/tools/quickbook/src/syntax_highlight.cpp	(original)
+++ branches/release/tools/quickbook/src/syntax_highlight.cpp	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -205,20 +205,23 @@
         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",
+                    =   "alignas", "alignof", "and_eq", "and", "asm", "auto",
+                        "bitand", "bitor", "bool", "break", "case", "catch",
+                        "char", "char16_t", "char32_t", "class", "compl",
+                        "const", "const_cast", "constexpr", "continue",
+                        "decltype", "default", "delete", "do", "double",
+                        "dynamic_cast",  "else", "enum", "explicit", "export",
+                        "extern", "false", "float", "for", "friend", "goto",
+                        "if", "inline", "int", "long", "mutable", "namespace",
+                        "new", "noexcept", "not_eq", "not", "nullptr",
+                        "operator", "or_eq", "or", "private", "protected",
+                        "public", "register", "reinterpret_cast", "return",
+                        "short", "signed", "sizeof", "static", "static_assert",
                         "static_cast", "struct", "switch", "template", "this",
-                        "throw", "true", "try", "typedef", "typeid",
-                        "typename", "union", "unsigned", "using", "virtual",
-                        "void", "volatile", "wchar_t", "while", "xor_eq", "xor"
+                        "thread_local", "throw", "true", "try", "typedef",
+                        "typeid", "typename", "union", "unsigned", "using",
+                        "virtual", "void", "volatile", "wchar_t", "while",
+                        "xor_eq", "xor"
                     ;
 
             python
@@ -270,12 +273,21 @@
                     do_macro(self.actions, &syntax_highlight_actions::do_macro);
                 error_action error(self.actions.state);
 
-                program
-                    =
-                    *(  (+cl::space_p)                  [plain_char]
+                program =
+                    *(  (*cl::space_p)                  [plain_char]
+                    >>  (line_start | rest_of_line)
+                    >>  *rest_of_line
+                    )
+                    ;
+
+                line_start =
+                        preprocessor                    [span("preprocessor")]
+                    ;
+                
+                rest_of_line = 
+                        (+cl::blank_p)                  [plain_char]
                     |   macro
                     |   escape
-                    |   preprocessor                    [span("preprocessor")]
                     |   cl::eps_p(ph::var(self.actions.support_callouts))
                     >>  (   line_callout                [callout]
                         |   inline_callout              [callout]
@@ -287,8 +299,8 @@
                     |   string_                         [span("string")]
                     |   char_                           [span("char")]
                     |   number                          [span("number")]
-                    |   u8_codepoint_p                  [unexpected_char]
-                    )
+                    |   ~cl::eps_p(cl::eol_p)
+                    >>  u8_codepoint_p                  [unexpected_char]
                     ;
 
                 macro =
@@ -359,7 +371,7 @@
                     ;   // make sure we recognize whole words only
 
                 special
-                    =   +cl::chset_p("~!%^&*()+={[}]:;,<.>?/|\\-")
+                    =   +cl::chset_p("~!%^&*()+={[}]:;,<.>?/|\\#-")
                     ;
 
                 string_char = ('\\' >> u8_codepoint_p) | (cl::anychar_p - '\\');
@@ -387,7 +399,7 @@
             }
 
             cl::rule<Scanner>
-                            program, macro, preprocessor,
+                            program, line_start, rest_of_line, macro, preprocessor,
                             inline_callout, line_callout, comment,
                             special, string_, 
                             char_, number, identifier, keyword, escape,
Modified: branches/release/tools/quickbook/test/code_cpp-1_5.gold
==============================================================================
--- branches/release/tools/quickbook/test/code_cpp-1_5.gold	(original)
+++ branches/release/tools/quickbook/test/code_cpp-1_5.gold	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -3,7 +3,11 @@
 <article id="c___code_blocks" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
  xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>C++ Code Blocks</title>
-<programlisting><phrase role="comment">// No escape</phrase>
+<programlisting><phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">some_header</phrase><phrase role="special">></phrase>
+    <phrase role="preprocessor">#include</phrase> <phrase role="string">"another_header.hpp"</phrase>
+<phrase role="preprocessor">#   define</phrase> <phrase role="identifier">A_MACRO</phrase> <phrase role="identifier">value</phrase>
+<phrase role="preprocessor">#define</phrase> <phrase role="identifier">stringize</phrase><phrase role="special">(</phrase><phrase role="identifier">hello</phrase><phrase role="special">)</phrase> <phrase role="special">#</phrase><phrase role="identifier">hello</phrase>
+<phrase role="comment">// No escape</phrase>
 <phrase role="comment">/* No escape */</phrase>
 <phrase role="comment">/* No escape
  * with newlines
@@ -13,6 +17,7 @@
 <phrase role="comment">/* Multiple escapes: <emphasis>italic</emphasis>
  * <emphasis role="underline">underline</emphasis><emphasis role="bold">bold</emphasis>
  */</phrase>
+<phrase role="comment">/* Token pasting: */</phrase> <phrase role="identifier">a</phrase><phrase role="special">##</phrase><phrase role="identifier">b</phrase>
 </programlisting>
   <para>
     A badly formed comment:
@@ -24,4 +29,12 @@
   </para>
 <programlisting><phrase role="comment">/* Oh dear <emphasis role="bold">bold</emphasis>
 </phrase></programlisting>
+  <para>
+    Just some code:
+  </para>
+<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">main</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
+    <phrase role="keyword">constexpr</phrase> <phrase role="keyword">char32_t</phrase> <phrase role="identifier">x</phrase> <phrase role="special">=</phrase> <phrase role="char">'a'</phrase><phrase role="special">;</phrase>
+    <phrase role="keyword">const</phrase> <phrase role="keyword">auto</phrase> <phrase role="identifier">y</phrase> <phrase role="special">=</phrase> <phrase role="identifier">x</phrase> <phrase role="special">-</phrase> <phrase role="char">' '</phrase><phrase role="special">;</phrase>
+<phrase role="special">}</phrase>
+</programlisting>
 </article>
Modified: branches/release/tools/quickbook/test/code_cpp-1_5.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/code_cpp-1_5.quickbook	(original)
+++ branches/release/tools/quickbook/test/code_cpp-1_5.quickbook	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -2,6 +2,10 @@
 [quickbook 1.5]
 ]
 
+    #include <some_header>
+        #include "another_header.hpp"
+    #   define A_MACRO value
+    #define stringize(hello) #hello
     // No escape
     /* No escape */
     /* No escape
@@ -12,6 +16,7 @@
     /* Multiple escapes: ``/italic/``
      * ``_underline_````*bold*``
      */
+    /* Token pasting: */ a##b
 
 A badly formed comment:
 
@@ -20,3 +25,10 @@
 A badly formed comment with an escape:
 
     /* Oh dear ``*bold*``
+
+Just some code:
+
+    int main() {
+        constexpr char32_t x = 'a';
+        const auto y = x - ' ';
+    }
Modified: branches/release/tools/quickbook/test/doc-info/Jamfile.v2
==============================================================================
--- branches/release/tools/quickbook/test/doc-info/Jamfile.v2	(original)
+++ branches/release/tools/quickbook/test/doc-info/Jamfile.v2	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -20,6 +20,8 @@
     [ quickbook-test escaped_attributes2-1_7 ]
     [ quickbook-test duplicates-1.1 ]
     [ quickbook-test duplicates-1.5 ]
+    [ quickbook-test macros1-1_5 ]
+    [ quickbook-test macros1-1_6 ]
     [ quickbook-test source-mode-1.4 ]
     [ quickbook-test source-mode-1.5 ]
     [ quickbook-test source-mode-1.6 ]
Deleted: branches/release/tools/quickbook/test/empty.qbk
==============================================================================
Modified: branches/release/tools/quickbook/test/include-1_5.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/include-1_5.quickbook	(original)
+++ branches/release/tools/quickbook/test/include-1_5.quickbook	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -3,15 +3,15 @@
     [id include-test]
 ]
 
-[include include_sub-1_5.qbk]
-[include .\include_sub.qbk]
-[include:foo include_sub.qbk]
-[include empty.qbk]
+[include include-inc-1_5.quickbook]
+[include .\include-inc.quickbook]
+[include:foo include-inc.quickbook]
+[include empty-inc.quickbook]
 
 [def __defined__]
 
-[? __undefined__ [include:foo1 include_sub.qbk] ]
-[? __undefined__ [include:foo1 not_a_file.qbk] ]
+[? __undefined__ [include:foo1 include-inc.quickbook] ]
+[? __undefined__ [include:foo1 not_a_file.quickbook] ]
 [? __defined__
-  Just trying including in a conditional macro. [include:foo2 include_sub.qbk]
+  Just trying including in a conditional macro. [include:foo2 include-inc.quickbook]
   With some text around it.]
Modified: branches/release/tools/quickbook/test/include-1_6.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/include-1_6.quickbook	(original)
+++ branches/release/tools/quickbook/test/include-1_6.quickbook	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -3,13 +3,13 @@
     [id include-test]
 ]
 
-[include include_sub.qbk]
-[include:foo include_sub.qbk]
+[include include-inc.quickbook]
+[include:foo include-inc.quickbook]
 
 [def __defined__]
 
-[? __undefined__ [include:foo1 include_sub.qbk] ]
-[? __undefined__ [include:foo1 not-a-file.qbk] ]
+[? __undefined__ [include:foo1 include-inc.quickbook] ]
+[? __undefined__ [include:foo1 not-a-file.quickbook] ]
 [? __defined__
-  Just trying including in a conditional macro. [include:foo2 include_sub.qbk]
+  Just trying including in a conditional macro. [include:foo2 include-inc.quickbook]
   With some text around it.]
Modified: branches/release/tools/quickbook/test/include/compatibility-1_1.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/include/compatibility-1_1.quickbook	(original)
+++ branches/release/tools/quickbook/test/include/compatibility-1_1.quickbook	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -5,14 +5,14 @@
 ]
 
 [section:collision Outer]
-[include compatibility-inc.qbk]
+[include compatibility-inc.quickbook]
 [endsect]
 [section:collision Include compatibility 1.1]
-[include compatibility-inc_1_1.qbk]
+[include compatibility-inc_1_1.quickbook]
 [endsect]
 [section:collision Include compatibility 1.5]
-[include compatibility-inc_1_5.qbk]
+[include compatibility-inc_1_5.quickbook]
 [endsect]
 [section:collision Include compatibility 1.6]
-[include compatibility-inc_1_6.qbk]
+[include compatibility-inc_1_6.quickbook]
 [endsect]
Modified: branches/release/tools/quickbook/test/include/compatibility-1_5.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/include/compatibility-1_5.quickbook	(original)
+++ branches/release/tools/quickbook/test/include/compatibility-1_5.quickbook	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -5,14 +5,14 @@
 ]
 
 [section:collision Outer]
-[include compatibility-inc.qbk]
+[include compatibility-inc.quickbook]
 [endsect]
 [section:collision Include compatibility 1.1]
-[include compatibility-inc_1_1.qbk]
+[include compatibility-inc_1_1.quickbook]
 [endsect]
 [section:collision Include compatibility 1.5]
-[include compatibility-inc_1_5.qbk]
+[include compatibility-inc_1_5.quickbook]
 [endsect]
 [section:collision Include compatibility 1.6]
-[include compatibility-inc_1_6.qbk]
+[include compatibility-inc_1_6.quickbook]
 [endsect]
Modified: branches/release/tools/quickbook/test/include/compatibility-1_6.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/include/compatibility-1_6.quickbook	(original)
+++ branches/release/tools/quickbook/test/include/compatibility-1_6.quickbook	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -4,14 +4,14 @@
 ]
 
 [section:collision Outer]
-[include compatibility-inc.qbk]
+[include compatibility-inc.quickbook]
 [endsect]
 [section:collision Include compatibility 1.1]
-[include compatibility-inc_1_1.qbk]
+[include compatibility-inc_1_1.quickbook]
 [endsect]
 [section:collision Include compatibility 1.5]
-[include compatibility-inc_1_5.qbk]
+[include compatibility-inc_1_5.quickbook]
 [endsect]
 [section:collision Include compatibility 1.6]
-[include compatibility-inc_1_6.qbk]
+[include compatibility-inc_1_6.quickbook]
 [endsect]
Deleted: branches/release/tools/quickbook/test/include/compatibility-inc.qbk
==============================================================================
--- branches/release/tools/quickbook/test/include/compatibility-inc.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (empty file)
@@ -1,31 +0,0 @@
-[section Inner]
-
-[heading Header]
-
-[h1 Heading1]
-
-[heading:x1 Header with id]
-
-[h1:x2 Heading1 with id]
-
-[table
-[[]][[]]
-]
-
-[table:withid
-[[]][[]]
-]
-
-[table With Title
-[[]][[]]
-]
-
-[table:x Id and Title
-[[]][[]]
-]
-
-
-[endsect]
-
-[section:x Inner with id]
-[endsect]
Deleted: branches/release/tools/quickbook/test/include/compatibility-inc_1_1.qbk
==============================================================================
--- branches/release/tools/quickbook/test/include/compatibility-inc_1_1.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (empty file)
@@ -1,33 +0,0 @@
-[compatibility-mode 1.1]
-
-[section Inner]
-
-[heading Header]
-
-[h1 Heading1]
-
-[heading:x1 Header with id]
-
-[h1:x2 Heading1 with id]
-
-[table
-[[]][[]]
-]
-
-[table:withid
-[[]][[]]
-]
-
-[table With Title
-[[]][[]]
-]
-
-[table:x Id and Title
-[[]][[]]
-]
-
-
-[endsect]
-
-[section:x Inner with id]
-[endsect]
Deleted: branches/release/tools/quickbook/test/include/compatibility-inc_1_5.qbk
==============================================================================
--- branches/release/tools/quickbook/test/include/compatibility-inc_1_5.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (empty file)
@@ -1,33 +0,0 @@
-[compatibility-mode 1.5]
-
-[section Inner]
-
-[heading Header]
-
-[h1 Heading1]
-
-[heading:x1 Header with id]
-
-[h1:x2 Heading1 with id]
-
-[table
-[[]][[]]
-]
-
-[table:withid
-[[]][[]]
-]
-
-[table With Title
-[[]][[]]
-]
-
-[table:x Id and Title
-[[]][[]]
-]
-
-
-[endsect]
-
-[section:x Inner with id]
-[endsect]
Deleted: branches/release/tools/quickbook/test/include/compatibility-inc_1_6.qbk
==============================================================================
--- branches/release/tools/quickbook/test/include/compatibility-inc_1_6.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (empty file)
@@ -1,33 +0,0 @@
-[compatibility-mode 1.6]
-
-[section Inner]
-
-[heading Header]
-
-[h1 Heading1]
-
-[heading:x1 Header with id]
-
-[h1:x2 Heading1 with id]
-
-[table
-[[]][[]]
-]
-
-[table:withid
-[[]][[]]
-]
-
-[table With Title
-[[]][[]]
-]
-
-[table:x Id and Title
-[[]][[]]
-]
-
-
-[endsect]
-
-[section:x Inner with id]
-[endsect]
Modified: branches/release/tools/quickbook/test/include/in_section-1_5.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/include/in_section-1_5.quickbook	(original)
+++ branches/release/tools/quickbook/test/include/in_section-1_5.quickbook	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -3,14 +3,14 @@
 ]
 
 [section:container Container]
-[include in_section-include1.qbk]
-[include in_section-include2.qbk]
+[include in_section-inc1.quickbook]
+[include in_section-inc2.quickbook]
 [endsect]
 
-[include in_section-include1.qbk]
-[include in_section-include2.qbk]
+[include in_section-inc1.quickbook]
+[include in_section-inc2.quickbook]
 
 [section:container2 Container2]
-[include in_section-include1.qbk]
-[include in_section-include2.qbk]
+[include in_section-inc1.quickbook]
+[include in_section-inc2.quickbook]
 [endsect]
Modified: branches/release/tools/quickbook/test/include/in_section-1_6.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/include/in_section-1_6.quickbook	(original)
+++ branches/release/tools/quickbook/test/include/in_section-1_6.quickbook	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -3,14 +3,14 @@
 ]
 
 [section:container Container]
-[include in_section-include1.qbk]
-[include in_section-include2.qbk]
+[include in_section-inc1.quickbook]
+[include in_section-inc2.quickbook]
 [endsect]
 
-[include in_section-include1.qbk]
-[include in_section-include2.qbk]
+[include in_section-inc1.quickbook]
+[include in_section-inc2.quickbook]
 
 [section:container2 Container2]
-[include in_section-include1.qbk]
-[include in_section-include2.qbk]
+[include in_section-inc1.quickbook]
+[include in_section-inc2.quickbook]
 [endsect]
Deleted: branches/release/tools/quickbook/test/include/in_section-include1.qbk
==============================================================================
--- branches/release/tools/quickbook/test/include/in_section-include1.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (empty file)
@@ -1,11 +0,0 @@
-[article Include in section include 1
-[quickbook 1.6]
-]
-
-[h1 Test1]
-
-[section:inner]
-
-[h1 Test2]
-
-[endsect]
\ No newline at end of file
Deleted: branches/release/tools/quickbook/test/include/in_section-include2.qbk
==============================================================================
--- branches/release/tools/quickbook/test/include/in_section-include2.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (empty file)
@@ -1,12 +0,0 @@
-[article Include in section include 2
-[quickbook 1.6]
-[id section_include]
-]
-
-[h1 Test1]
-
-[section:inner]
-
-[h1 Test2]
-
-[endsect]
\ No newline at end of file
Modified: branches/release/tools/quickbook/test/include/include_id_unbalanced-1_6.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/include/include_id_unbalanced-1_6.quickbook	(original)
+++ branches/release/tools/quickbook/test/include/include_id_unbalanced-1_6.quickbook	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -5,7 +5,7 @@
 
 [/ Sections start in included files ]
 
-[include:include1 include_id_unbalanced-inc1.qbk]
+[include:include1 include_id_unbalanced-inc1.quickbook]
 [heading:x1 X1]
 [endsect]
 [heading:x2 X2]
@@ -16,4 +16,4 @@
 [heading:x1 X1]
 [section:sect2 Section 2]
 [heading:x2 X2]
-[include:include2 include_id_unbalanced-inc2.qbk]
+[include:include2 include_id_unbalanced-inc2.quickbook]
Deleted: branches/release/tools/quickbook/test/include/include_id_unbalanced-inc1.qbk
==============================================================================
--- branches/release/tools/quickbook/test/include/include_id_unbalanced-inc1.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (empty file)
@@ -1,4 +0,0 @@
-[section:inc1 Include 1]
-[heading:inc1_1 Heading 1]
-[include:include1a include_id_unbalanced-inc1a.qbk]
-[heading:inc1_2 Heading 2]
Deleted: branches/release/tools/quickbook/test/include/include_id_unbalanced-inc1a.qbk
==============================================================================
--- branches/release/tools/quickbook/test/include/include_id_unbalanced-inc1a.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (empty file)
@@ -1,3 +0,0 @@
-[heading:inc1a_1 Heading 1]
-[section:inc1a Include 1a]
-[heading:inc1a_2 Heading 2]
Deleted: branches/release/tools/quickbook/test/include/include_id_unbalanced-inc2.qbk
==============================================================================
--- branches/release/tools/quickbook/test/include/include_id_unbalanced-inc2.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (empty file)
@@ -1,5 +0,0 @@
-[heading:inc2_1 Heading 1]
-[endsect]
-[heading:inc2_2 Heading 2]
-[include:include2a include_id_unbalanced-inc2a.qbk]
-[heading:inc2_3 Heading 3]
Deleted: branches/release/tools/quickbook/test/include/include_id_unbalanced-inc2a.qbk
==============================================================================
--- branches/release/tools/quickbook/test/include/include_id_unbalanced-inc2a.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (empty file)
@@ -1,3 +0,0 @@
-[heading:inc2a_1 Heading 1]
-[endsect]
-[heading:inc2a_2 Heading 2]
Modified: branches/release/tools/quickbook/test/include/nested_compatibility-1_5.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/include/nested_compatibility-1_5.quickbook	(original)
+++ branches/release/tools/quickbook/test/include/nested_compatibility-1_5.quickbook	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -2,11 +2,11 @@
 [article Nested Compatibility Test]
 
 [section Duplicate Name]
-[include nested_compatibility_inc-1_5.qbk]
-[include nested_compatibility_inc-1_6.qbk]
+[include nested_compatibility-inc-1_5.quickbook]
+[include nested_compatibility-inc-1_6.quickbook]
 [endsect]
 
 [section Duplicate Name]
-[include nested_compatibility_inc-1_5.qbk]
-[include nested_compatibility_inc-1_6.qbk]
+[include nested_compatibility-inc-1_5.quickbook]
+[include nested_compatibility-inc-1_6.quickbook]
 [endsect]
Modified: branches/release/tools/quickbook/test/include/nested_compatibility-1_6.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/include/nested_compatibility-1_6.quickbook	(original)
+++ branches/release/tools/quickbook/test/include/nested_compatibility-1_6.quickbook	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -2,11 +2,11 @@
 [article Nested Compatibility Test]
 
 [section Duplicate Name]
-[include nested_compatibility_inc-1_5.qbk]
-[include nested_compatibility_inc-1_6.qbk]
+[include nested_compatibility-inc-1_5.quickbook]
+[include nested_compatibility-inc-1_6.quickbook]
 [endsect]
 
 [section Duplicate Name]
-[include nested_compatibility_inc-1_5.qbk]
-[include nested_compatibility_inc-1_6.qbk]
+[include nested_compatibility-inc-1_5.quickbook]
+[include nested_compatibility-inc-1_6.quickbook]
 [endsect]
Deleted: branches/release/tools/quickbook/test/include/nested_compatibility_inc-1_5.qbk
==============================================================================
--- branches/release/tools/quickbook/test/include/nested_compatibility_inc-1_5.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (empty file)
@@ -1,5 +0,0 @@
-[compatibility-mode 1.5]
-
-[section:nested Nested Section 1.5]
-[heading Nested Heading 1.5]
-[endsect]
Deleted: branches/release/tools/quickbook/test/include/nested_compatibility_inc-1_6.qbk
==============================================================================
--- branches/release/tools/quickbook/test/include/nested_compatibility_inc-1_6.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (empty file)
@@ -1,5 +0,0 @@
-[compatibility-mode 1.6]
-
-[section:nested Nested Section 1.6]
-[heading Nested Heading 1.6]
-[endsect]
Modified: branches/release/tools/quickbook/test/include/source_mode-1_5.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/include/source_mode-1_5.quickbook	(original)
+++ branches/release/tools/quickbook/test/include/source_mode-1_5.quickbook	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -1,3 +1,3 @@
 [article Souce Mode Include [source-mode teletype][quickbook 1.5]]
 
-[include source_mode-inc1.qbk]
\ No newline at end of file
+[include source_mode-inc1.quickbook]
\ No newline at end of file
Modified: branches/release/tools/quickbook/test/include/source_mode-1_6.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/include/source_mode-1_6.quickbook	(original)
+++ branches/release/tools/quickbook/test/include/source_mode-1_6.quickbook	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -1,4 +1,4 @@
 [source-mode teletype][quickbook 1.6]
 [article Souce Mode Include]
 
-[include source_mode-inc1.qbk]
\ No newline at end of file
+[include source_mode-inc1.quickbook]
\ No newline at end of file
Deleted: branches/release/tools/quickbook/test/include/source_mode-inc1.qbk
==============================================================================
--- branches/release/tools/quickbook/test/include/source_mode-inc1.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (empty file)
@@ -1,3 +0,0 @@
-[article Source include with no source-mode]
-
-    void main() {}
\ No newline at end of file
Modified: branches/release/tools/quickbook/test/include2-1_6.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/include2-1_6.quickbook	(original)
+++ branches/release/tools/quickbook/test/include2-1_6.quickbook	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -3,6 +3,6 @@
     [id include-test]
 ]
 
-[include include_sub-1_5.qbk]
-[include include_sub.qbk]
-[include:foo include_sub.qbk]
+[include include-inc-1_5.quickbook]
+[include include-inc.quickbook]
+[include:foo include-inc.quickbook]
Deleted: branches/release/tools/quickbook/test/include_sub-1_5.qbk
==============================================================================
--- branches/release/tools/quickbook/test/include_sub-1_5.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (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: branches/release/tools/quickbook/test/include_sub.qbk
==============================================================================
--- branches/release/tools/quickbook/test/include_sub.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (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: branches/release/tools/quickbook/test/include_win_path-1_6-fail.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/include_win_path-1_6-fail.quickbook	(original)
+++ branches/release/tools/quickbook/test/include_win_path-1_6-fail.quickbook	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -2,4 +2,4 @@
 [quickbook 1.6]
 ]
 
-[include .\empty.qbk]
+[include .\empty-inc.quickbook]
Modified: branches/release/tools/quickbook/test/python/include_path.qbk
==============================================================================
--- branches/release/tools/quickbook/test/python/include_path.qbk	(original)
+++ branches/release/tools/quickbook/test/python/include_path.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -1,3 +1,11 @@
+[/
+    Copyright 2012-2013 Daniel James
+
+    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 1.5]
 [article Include Path]
 [include a.qbk]
Modified: branches/release/tools/quickbook/test/python/missing_relative.qbk
==============================================================================
--- branches/release/tools/quickbook/test/python/missing_relative.qbk	(original)
+++ branches/release/tools/quickbook/test/python/missing_relative.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -1,3 +1,11 @@
+[/
+    Copyright 2012-2013 Daniel James
+
+    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 1.5]
 [article Missing Relative]
 
Modified: branches/release/tools/quickbook/test/python/sub1/a.qbk
==============================================================================
--- branches/release/tools/quickbook/test/python/sub1/a.qbk	(original)
+++ branches/release/tools/quickbook/test/python/sub1/a.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -1 +1,9 @@
+[/
+    Copyright 2012-2013 Daniel James
+
+    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)
+]
+
 a
Modified: branches/release/tools/quickbook/test/python/sub2/b.qbk
==============================================================================
--- branches/release/tools/quickbook/test/python/sub2/b.qbk	(original)
+++ branches/release/tools/quickbook/test/python/sub2/b.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -1 +1,9 @@
+[/
+    Copyright 2012-2013 Daniel James
+
+    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)
+]
+
 b
Modified: branches/release/tools/quickbook/test/python/svg_missing.qbk
==============================================================================
--- branches/release/tools/quickbook/test/python/svg_missing.qbk	(original)
+++ branches/release/tools/quickbook/test/python/svg_missing.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -1,3 +1,11 @@
+[/
+    Copyright 2012-2013 Daniel James
+
+    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)
+]
+
 [article Dependencies for missing svg]
 
 [$missing.svg]
Modified: branches/release/tools/quickbook/test/snippets/unbalanced_snippet1.cpp
==============================================================================
--- branches/release/tools/quickbook/test/snippets/unbalanced_snippet1.cpp	(original)
+++ branches/release/tools/quickbook/test/snippets/unbalanced_snippet1.cpp	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -1,3 +1,3 @@
 //[unclosed
 
-int main() {}
\ No newline at end of file
+int main() {}
Modified: branches/release/tools/quickbook/test/snippets/unbalanced_snippet2.cpp
==============================================================================
--- branches/release/tools/quickbook/test/snippets/unbalanced_snippet2.cpp	(original)
+++ branches/release/tools/quickbook/test/snippets/unbalanced_snippet2.cpp	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -1 +1 @@
-//]
\ No newline at end of file
+//]
Modified: branches/release/tools/quickbook/test/unit/source_map_test.cpp
==============================================================================
--- branches/release/tools/quickbook/test/unit/source_map_test.cpp	(original)
+++ branches/release/tools/quickbook/test/unit/source_map_test.cpp	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -303,14 +303,93 @@
         BOOST_TEST_EQ(f1->source(),
             boost::string_ref("Code line1\n\nCode line2"));
     }
+}
+
+void indented_map_trailing_blanks_test()
+{
+    quickbook::mapped_file_builder builder;
+
+    {
+        boost::string_ref source("\n\n   Code line1\n  ");
+        quickbook::file_ptr fake_file = new quickbook::file(
+            "(fake file)", source, 105u);
+        builder.start(fake_file);
+        builder.unindent_and_add(fake_file->source());
+        quickbook::file_ptr f1 = builder.release();
+        BOOST_TEST_EQ(f1->source(),
+            boost::string_ref("Code line1\n"));
+    }
+
+    {
+        boost::string_ref source("    \n  \n   Code line1\n    ");
+        quickbook::file_ptr fake_file = new quickbook::file(
+            "(fake file)", source, 105u);
+        builder.start(fake_file);
+        builder.unindent_and_add(fake_file->source());
+        quickbook::file_ptr f1 = builder.release();
+        BOOST_TEST_EQ(f1->source(),
+            boost::string_ref("Code line1\n "));
+    }
+
+    {
+        boost::string_ref source("   Code line1\n \n   Code line2\n  ");
+        quickbook::file_ptr fake_file = new quickbook::file(
+            "(fake file)", source, 105u);
+        builder.start(fake_file);
+        builder.unindent_and_add(fake_file->source());
+        quickbook::file_ptr f1 = builder.release();
+        BOOST_TEST_EQ(f1->source(),
+            boost::string_ref("Code line1\n\nCode line2\n"));
+    }
 
 }
 
+void indented_map_mixed_test()
+{
+    quickbook::mapped_file_builder builder;
+
+    {
+        boost::string_ref source("\tCode line 1\n    Code line 2\n\t    Code line 3\n    \tCode line 4");
+        quickbook::file_ptr fake_file = new quickbook::file(
+            "(fake file)", source, 105u);
+        builder.start(fake_file);
+        builder.unindent_and_add(fake_file->source());
+        quickbook::file_ptr f1 = builder.release();
+        BOOST_TEST_EQ(f1->source(),
+            boost::string_ref("Code line 1\nCode line 2\n    Code line 3\n    Code line 4"));
+    }
+
+    {
+        boost::string_ref source("  Code line 1\n\tCode line 2");
+        quickbook::file_ptr fake_file = new quickbook::file(
+            "(fake file)", source, 105u);
+        builder.start(fake_file);
+        builder.unindent_and_add(fake_file->source());
+        quickbook::file_ptr f1 = builder.release();
+        BOOST_TEST_EQ(f1->source(),
+            boost::string_ref("Code line 1\n  Code line 2"));
+    }
+
+    {
+        boost::string_ref source("  Code line 1\n  \tCode line 2");
+        quickbook::file_ptr fake_file = new quickbook::file(
+            "(fake file)", source, 105u);
+        builder.start(fake_file);
+        builder.unindent_and_add(fake_file->source());
+        quickbook::file_ptr f1 = builder.release();
+        BOOST_TEST_EQ(f1->source(),
+            boost::string_ref("Code line 1\n\tCode line 2"));
+    }
+}
+
+
 int main()
 {
     simple_map_tests();
     indented_map_tests();
     indented_map_tests2();
     indented_map_leading_blanks_test();
+    indented_map_trailing_blanks_test();
+    indented_map_mixed_test();
     return boost::report_errors();
 }
Modified: branches/release/tools/quickbook/test/versions/invalid_macro-1_6.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/versions/invalid_macro-1_6.quickbook	(original)
+++ branches/release/tools/quickbook/test/versions/invalid_macro-1_6.quickbook	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -4,11 +4,11 @@
 
 Import:
 
-[import invalid_macro-inc-1_1.qbk]
+[import invalid_macro-inc-1_1.quickbook]
 
 * __valid__
 * __invalid\macro__
 
 Include:
 
-[include invalid_macro-inc-1_1.qbk]
+[include invalid_macro-inc-1_1.quickbook]
Deleted: branches/release/tools/quickbook/test/versions/invalid_macro-inc-1_1.qbk
==============================================================================
--- branches/release/tools/quickbook/test/versions/invalid_macro-inc-1_1.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (empty file)
@@ -1,7 +0,0 @@
-[quickbook 1.1]
-
-[def __valid__ okay]
-[def __invalid\macro__ bad]
-
-* __valid__
-* __invalid\macro__
Deleted: branches/release/tools/quickbook/test/versions/templates-1_1.qbk
==============================================================================
--- branches/release/tools/quickbook/test/versions/templates-1_1.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (empty file)
@@ -1,15 +0,0 @@
-[article 1.1 Templates
-[quickbook 1.1]
-]
-
-[template section_1_1[]
-[section In a 1.1 template]
-Some text
-[endsect]
-]
-
-[section 1.1 Document]
-[section_1_1]
-[section_1_4]
-[section_1_5]
-[endsect]
Deleted: branches/release/tools/quickbook/test/versions/templates-1_4.qbk
==============================================================================
--- branches/release/tools/quickbook/test/versions/templates-1_4.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (empty file)
@@ -1,20 +0,0 @@
-[article 1.4 Templates
-[quickbook 1.4]
-]
-
-[template section_1_4[]
-[section In a 1.4 template]
-Some text
-[endsect]
-]
-
-[section 1.4 Document]
-[section_1_1]
-[section_1_4]
-[section_1_5]
-[endsect]
-
-[/ Odd test for calling 1.4 -> 1.5 -> 1.4 template]
-
-[template skip_1_5[a] [skip_1_5_2 wrong]]
-[template skip_1_5_3[] [a]]
Deleted: branches/release/tools/quickbook/test/versions/templates-1_5.qbk
==============================================================================
--- branches/release/tools/quickbook/test/versions/templates-1_5.qbk	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
+++ (empty file)
@@ -1,19 +0,0 @@
-[article 1.5 Templates
-[quickbook 1.5]
-]
-
-[template section_1_5[]
-[section In a 1.5 template]
-Some text
-[endsect]
-]
-
-[section 1.5 Document]
-[section_1_1]
-[section_1_4]
-[section_1_5]
-[endsect]
-
-[/ Odd test for calling 1.4 -> 1.5 -> 1.4 template]
-
-[template skip_1_5_2[a] [skip_1_5_3]]
Modified: branches/release/tools/quickbook/test/versions/versions-1_6.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/versions/versions-1_6.quickbook	(original)
+++ branches/release/tools/quickbook/test/versions/versions-1_6.quickbook	2013-05-16 17:30:01 EDT (Thu, 16 May 2013)
@@ -1,9 +1,9 @@
 [quickbook 1.6]
 [article Mixed version tests]
 
-[import templates-1_1.qbk]
-[import templates-1_4.qbk]
-[import templates-1_5.qbk]
+[import templates-inc-1_1.quickbook]
+[import templates-inc-1_4.quickbook]
+[import templates-inc-1_5.quickbook]
 
 [/ This test calls a 1.4 template -> 1.5 template -> 1.4 template.
    The name lookup in the 1.4 template should skip the 1.5 template
@@ -21,6 +21,6 @@
 
 [/ For comparison]
 
-[include templates-1_1.qbk]
-[include templates-1_4.qbk]
-[include templates-1_5.qbk]
+[include templates-inc-1_1.quickbook]
+[include templates-inc-1_4.quickbook]
+[include templates-inc-1_5.quickbook]