$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r73445 - in branches/release/tools/quickbook: . doc src test test/doc-info test/unit
From: dnljms_at_[hidden]
Date: 2011-07-30 12:45:13
Author: danieljames
Date: 2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
New Revision: 73445
URL: http://svn.boost.org/trac/boost/changeset/73445
Log:
Quickbook: Merge from trunk.
- Add ids to more elements.
- Try to avoid generating duplicate ids.
- Simplify the grammar a little to avoid what I assume are optimization bugs in
  older versions of gcc.
Added:
   branches/release/tools/quickbook/src/id_generator.cpp
      - copied, changed from r73399, /trunk/tools/quickbook/src/id_generator.cpp
   branches/release/tools/quickbook/src/id_generator.hpp
      - copied unchanged from r73399, /trunk/tools/quickbook/src/id_generator.hpp
   branches/release/tools/quickbook/test/table_1_3.gold
      - copied, changed from r73298, /trunk/tools/quickbook/test/table_1_3.gold
   branches/release/tools/quickbook/test/table_1_3.quickbook
      - copied, changed from r73298, /trunk/tools/quickbook/test/table_1_3.quickbook
   branches/release/tools/quickbook/test/table_1_3.xml
      - copied unchanged from r73444, /trunk/tools/quickbook/test/table_1_3.xml
Properties modified: 
   branches/release/tools/quickbook/   (props changed)
   branches/release/tools/quickbook/doc/   (props changed)
   branches/release/tools/quickbook/src/   (props changed)
   branches/release/tools/quickbook/test/   (props changed)
Text files modified: 
   branches/release/tools/quickbook/Jamfile.v2                         |    10 ++                                      
   branches/release/tools/quickbook/src/Jamfile.v2                     |     1                                         
   branches/release/tools/quickbook/src/actions.cpp                    |   157 ++++++++++++++++++++++++++------------- 
   branches/release/tools/quickbook/src/actions_class.cpp              |     5 +                                       
   branches/release/tools/quickbook/src/actions_class.hpp              |     4                                         
   branches/release/tools/quickbook/src/block_element_grammar.cpp      |    21 ++---                                   
   branches/release/tools/quickbook/src/doc_info_actions.cpp           |     8 +                                       
   branches/release/tools/quickbook/src/fwd.hpp                        |     1                                         
   branches/release/tools/quickbook/src/id_generator.cpp               |   123 ++++++++++++++++--------------          
   branches/release/tools/quickbook/src/main_grammar.cpp               |    13 +--                                     
   branches/release/tools/quickbook/src/markups.cpp                    |     1                                         
   branches/release/tools/quickbook/src/phrase_element_grammar.cpp     |    40 +++++-----                              
   branches/release/tools/quickbook/src/post_process.hpp               |     2                                         
   branches/release/tools/quickbook/src/quickbook.cpp                  |    24 +++--                                   
   branches/release/tools/quickbook/src/template_stack.cpp             |     5                                         
   branches/release/tools/quickbook/src/template_stack.hpp             |    20 ++++                                    
   branches/release/tools/quickbook/src/utils.cpp                      |     6                                         
   branches/release/tools/quickbook/src/values.hpp                     |    40 +++++-----                              
   branches/release/tools/quickbook/test/Jamfile.v2                    |     1                                         
   branches/release/tools/quickbook/test/anchor.gold                   |    10 +-                                      
   branches/release/tools/quickbook/test/blocks.gold                   |    10 +-                                      
   branches/release/tools/quickbook/test/callouts.gold                 |    32 ++++----                                
   branches/release/tools/quickbook/test/code-block.gold               |     2                                         
   branches/release/tools/quickbook/test/doc-info/duplicates-1.1.gold  |     2                                         
   branches/release/tools/quickbook/test/doc-info/duplicates-1.5.gold  |     2                                         
   branches/release/tools/quickbook/test/doc-info/source-mode-1.4.gold |     2                                         
   branches/release/tools/quickbook/test/doc-info/source-mode-1.5.gold |     2                                         
   branches/release/tools/quickbook/test/doc-info/source-mode-1.6.gold |     2                                         
   branches/release/tools/quickbook/test/escape.gold                   |     9 ++                                      
   branches/release/tools/quickbook/test/escape.quickbook              |    13 +++                                     
   branches/release/tools/quickbook/test/heading.gold                  |     6                                         
   branches/release/tools/quickbook/test/heading_1_6.gold              |     6                                         
   branches/release/tools/quickbook/test/identifier_1_5.gold           |     2                                         
   branches/release/tools/quickbook/test/identifier_1_6.gold           |     2                                         
   branches/release/tools/quickbook/test/list_test.gold                |     2                                         
   branches/release/tools/quickbook/test/quickbook-manual.gold         |    66 ++++++++--------                        
   branches/release/tools/quickbook/test/table_1_3.gold                |   129 +++++++++++++++++++++++++++++++-        
   branches/release/tools/quickbook/test/table_1_3.quickbook           |    32 ++++++++                                
   branches/release/tools/quickbook/test/table_1_5.gold                |   115 +++++++++++++++++++++++++++++           
   branches/release/tools/quickbook/test/table_1_5.quickbook           |    32 ++++++++                                
   branches/release/tools/quickbook/test/template-section.gold         |     2                                         
   branches/release/tools/quickbook/test/unicode-escape.gold           |     2                                         
   branches/release/tools/quickbook/test/unit/Jamfile.v2               |     2                                         
   branches/release/tools/quickbook/test/utf-8-bom.gold                |     2                                         
   branches/release/tools/quickbook/test/utf-8.gold                    |     2                                         
   branches/release/tools/quickbook/test/xml-escape_1_2.gold           |     2                                         
   branches/release/tools/quickbook/test/xml-escape_1_5.gold           |     2                                         
   47 files changed, 692 insertions(+), 282 deletions(-)
Modified: branches/release/tools/quickbook/Jamfile.v2
==============================================================================
--- branches/release/tools/quickbook/Jamfile.v2	(original)
+++ branches/release/tools/quickbook/Jamfile.v2	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -33,3 +33,13 @@
     :
     release
     ;
+
+# Target for quickbook toolset's auto build.
+
+alias quickbook-auto
+    : quickbook
+    : release
+    ;
+
+explicit quickbook-auto
+    ;
Modified: branches/release/tools/quickbook/src/Jamfile.v2
==============================================================================
--- branches/release/tools/quickbook/src/Jamfile.v2	(original)
+++ branches/release/tools/quickbook/src/Jamfile.v2	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -28,6 +28,7 @@
     utils.cpp
     input_path.cpp
     values.cpp
+    id_generator.cpp
     post_process.cpp
     collector.cpp
     template_stack.cpp
Modified: branches/release/tools/quickbook/src/actions.cpp
==============================================================================
--- branches/release/tools/quickbook/src/actions.cpp	(original)
+++ branches/release/tools/quickbook/src/actions.cpp	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -29,6 +29,7 @@
 #include "input_path.hpp"
 #include "block_tags.hpp"
 #include "phrase_tags.hpp"
+#include "id_generator.hpp"
 
 namespace quickbook
 {
@@ -58,12 +59,23 @@
                 it != end; ++it)
             {
                 tgt << "<anchor id=\"";
-                detail::print_string(*it, tgt.get());
+                detail::print_string(
+                    actions.ids.add(*it, id_generator::explicit_id),
+                    tgt.get());
                 tgt << "\"/>";
             }
             
             actions.anchors.clear();
-        }    
+        }
+        
+        std::string add_anchor(quickbook::actions& actions,
+                std::string const& id,
+                id_generator::categories category = id_generator::explicit_id)
+        {
+            std::string placeholder = actions.ids.add(id, category);
+            actions.anchors.push_back(placeholder);
+            return placeholder;
+        }
     }
 
     void list_action(quickbook::actions&, value);
@@ -84,6 +96,7 @@
     void anchor_action(quickbook::actions&, value);
     void link_action(quickbook::actions&, value);
     void phrase_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);
@@ -161,8 +174,9 @@
         case phrase_tags::strikethrough:
         case phrase_tags::quote:
         case phrase_tags::replaceable:
-        case phrase_tags::footnote:
             return phrase_action(actions, v);
+        case phrase_tags::footnote:
+            return footnote_action(actions, v);
         case phrase_tags::escape:
             return raw_phrase_action(actions, v);
         case source_mode_tags::cpp:
@@ -258,6 +272,21 @@
         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(actions.doc_id + ".f", id_generator::numbered)
+            << "\"><para>"
+            << values.consume().get_boostbook()
+            << "</para></footnote>";
+        values.finish();
+    }
+
     void raw_phrase_action(quickbook::actions& actions, value phrase)
     {
         if (actions.suppress) return;
@@ -329,16 +358,22 @@
             level = heading_list.get_tag() - block_tags::heading1 + 1;
         }
 
-        std::string anchor;
         std::string linkend;
 
         if (!generic && qbk_version_n < 103) // version 1.2 and below
         {
-            anchor = actions.section_id + '.' +
-                detail::make_identifier(content.get_boostbook());
+            add_anchor(actions,
+                actions.section_id + '.' +
+                    detail::make_identifier(content.get_boostbook()),
+                id_generator::generated);
         }
         else
         {
+            id_generator::categories category =
+                !element_id.empty() ?
+                    id_generator::explicit_id :
+                    id_generator::generated;
+
             std::string id =
                 !element_id.empty() ?
                     element_id.get_quickbook() :
@@ -348,15 +383,20 @@
                             content.get_boostbook()
                     );
 
-            linkend = anchor =
-                fully_qualified_id(actions.doc_id, actions.qualified_section_id, id);
+            linkend = add_anchor(actions,
+                fully_qualified_id(actions.doc_id,
+                    actions.qualified_section_id, id),
+                category);
         }
 
-        actions.anchors.push_back(anchor);
-        write_anchors(actions, actions.out);
-        
+        write_anchors(actions, actions.out);        
         write_bridgehead(actions.out, level,
-            content.get_boostbook(), anchor + "-heading", linkend);
+            content.get_boostbook(),
+            actions.ids.add(
+                fully_qualified_id(actions.doc_id,
+                    actions.qualified_section_id, "h"),
+                id_generator::numbered),
+            linkend);
     }
 
     void simple_phrase_action::operator()(char mark) const
@@ -558,7 +598,7 @@
         if(actions.suppress) return;
         
         value_consumer values = anchor;
-        actions.anchors.push_back(values.consume().get_quickbook());
+        add_anchor(actions, values.consume().get_quickbook());
         values.finish();
     }
 
@@ -1070,8 +1110,7 @@
             while (arg != args.end())
             {
                 if (!actions.templates.add(
-                        template_symbol(*tpl, empty_params, arg->content,
-                            arg->filename, &scope)))
+                        template_symbol(*tpl, empty_params, *arg, &scope)))
                 {
                     detail::outerr(actions.filename, pos.line)
                         << "Duplicate Symbol Found" << std::endl;
@@ -1096,7 +1135,8 @@
             //
             // Note: this is now done in the grammar.
 
-            if (escape)
+            // 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
@@ -1131,11 +1171,6 @@
         }
     }
 
-    namespace detail
-    {
-        int callout_id = 0;
-    }
-
     void do_template_action(quickbook::actions& actions, value template_list,
             file_position pos)
     {
@@ -1149,6 +1184,7 @@
 
         std::string identifier = values.consume(template_tags::identifier).get_quickbook();
 
+        std::vector<std::string> callout_ids;
         std::vector<template_body> args;
 
         BOOST_FOREACH(value arg, values)
@@ -1225,18 +1261,25 @@
 
                 for(unsigned int i = 0; i < size; ++i)
                 {
-                    std::string callout_id = actions.doc_id +
-                        boost::lexical_cast<std::string>(detail::callout_id + i);
+                    std::string callout_id1 =
+                        actions.ids.add(
+                            actions.doc_id + ".c",
+                            id_generator::numbered);
+                    std::string callout_id2 =
+                        actions.ids.add(
+                            actions.doc_id + ".c",
+                            id_generator::numbered);
 
                     std::string code;
-                    code += "'''";
-                    code += "<co id=\"" + callout_id + "co\" ";
-                    code += "linkends=\"" + callout_id + "\" />";
-                    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));
+                        actions.filename, template_body::raw_output));
+                    callout_ids.push_back(callout_id1);
+                    callout_ids.push_back(callout_id2);
                 }
             }
 
@@ -1294,10 +1337,11 @@
         {
             BOOST_ASSERT(phrase.empty());
             block += "<calloutlist>";
+            int i = 0;
             BOOST_FOREACH(value c, symbol->callouts)
             {
-                std::string callout_id = actions.doc_id +
-                    boost::lexical_cast<std::string>(detail::callout_id++);
+                std::string callout_id1 = callout_ids[i++];
+                std::string callout_id2 = callout_ids[i++];
 
                 std::string callout_value;
                 actions.push();
@@ -1319,8 +1363,8 @@
                     return;
                 }
                 
-                block += "<callout arearefs=\"" + callout_id + "co\" ";
-                block += "id=\"" + callout_id + "\">";
+                block += "<callout arearefs=\"" + callout_id1 + "\" ";
+                block += "id=\"" + callout_id2 + "\">";
                 block += callout_value;
                 block += "</callout>";
             }
@@ -1417,15 +1461,26 @@
         std::string table_id;
         if(qbk_version_n >= 105) {
             if(!element_id.empty()) {
-                table_id = fully_qualified_id(actions.doc_id,
-                    actions.qualified_section_id, element_id);
+                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 = fully_qualified_id(actions.doc_id,
-                    actions.qualified_section_id,
-                    detail::make_identifier(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);
+        }
 
         // Emulating the old behaviour which used the width of the final
         // row for span_count.
@@ -1515,23 +1570,18 @@
         actions.qualified_section_id += actions.section_id;
         ++actions.section_level;
 
-        actions::string_list saved_anchors;
-        saved_anchors.swap(actions.anchors);
-
-        if (qbk_version_n < 103) // version 1.2 and below
-        {
-            actions.out << "\n<section id=\""
-                << actions.doc_id << "." << actions.section_id << "\">\n";
-        }
-        else // version 1.3 and above
-        {
-            actions.out << "\n<section id=\"" << actions.doc_id
-                << "." << actions.qualified_section_id << "\">\n";
-        }
+        // 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,
+            !element_id.empty() ?
+                id_generator::explicit_id :
+                id_generator::generated);
 
+        actions.out << "\n<section id=\"" << full_id << "\">\n";
         actions.out << "<title>";
-
-        actions.anchors.swap(saved_anchors);
         write_anchors(actions, actions.out);
 
         if (qbk_version_n < 103) // version 1.2 and below
@@ -1540,8 +1590,7 @@
         }
         else // version 1.3 and above
         {
-            actions.out << "<link linkend=\"" << actions.doc_id
-                << "." << actions.qualified_section_id << "\">"
+            actions.out << "<link linkend=\"" << full_id << "\">"
                 << content.get_boostbook()
                 << "</link>"
                 ;
Modified: branches/release/tools/quickbook/src/actions_class.cpp
==============================================================================
--- branches/release/tools/quickbook/src/actions_class.cpp	(original)
+++ branches/release/tools/quickbook/src/actions_class.cpp	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -19,7 +19,8 @@
 
 namespace quickbook
 {
-    actions::actions(fs::path const& filein_, fs::path const& xinclude_base_, string_stream& out_)
+    actions::actions(fs::path const& filein_, fs::path const& xinclude_base_,
+            string_stream& out_, id_generator& ids)
         : grammar_()
 
     // header info
@@ -62,6 +63,8 @@
         , no_eols(true)
         , suppress(false)
         , warned_about_breaks(false)
+        , context(0)
+        , ids(ids)
 
     // actions
         , element(*this)
Modified: branches/release/tools/quickbook/src/actions_class.hpp
==============================================================================
--- branches/release/tools/quickbook/src/actions_class.hpp	(original)
+++ branches/release/tools/quickbook/src/actions_class.hpp	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -24,7 +24,8 @@
 
     struct actions
     {
-        actions(fs::path const& filein_, fs::path const& xinclude_base, string_stream& out_);
+        actions(fs::path const& filein_, fs::path const& xinclude_base, string_stream& out_,
+                id_generator&);
 
     private:
         boost::scoped_ptr<quickbook_grammar> grammar_;
@@ -101,6 +102,7 @@
         bool                    suppress;
         bool                    warned_about_breaks;
         int                     context;
+        id_generator&           ids;
 
     // push/pop the states and the streams
         void copy_macros_for_write();
Modified: branches/release/tools/quickbook/src/block_element_grammar.cpp
==============================================================================
--- branches/release/tools/quickbook/src/block_element_grammar.cpp	(original)
+++ branches/release/tools/quickbook/src/block_element_grammar.cpp	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -34,7 +34,8 @@
                         xinclude, include,
                         template_, template_id, template_formal_arg,
                         template_body, identifier, import,
-                        element_id, element_id_1_5, element_id_1_6;
+                        element_id, element_id_1_5, element_id_1_6,
+                        same_line;
     };
 
     void quickbook_grammar::impl::init_block_elements()
@@ -44,7 +45,7 @@
 
         local.element_id =
             !(  ':'
-            >>  (   cl::if_p(qbk_since(105u)) [space]
+            >>  (   !(cl::eps_p(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]
                 )
@@ -52,16 +53,10 @@
             ;
         
         local.element_id_1_5 =
-                cl::if_p(qbk_since(105u)) [
-                    local.element_id
-                ]
-                ;
+                !(cl::eps_p(qbk_since(105u)) >> local.element_id);
 
         local.element_id_1_6 =
-                cl::if_p(qbk_since(106u)) [
-                    local.element_id
-                ]
-                ;
+                !(cl::eps_p(qbk_since(106u)) >> local.element_id);
 
         elements.add
             ("section", element_info(element_info::block, &local.begin_section, block_tags::begin_section))
@@ -208,10 +203,12 @@
             ("table", element_info(element_info::nested_block, &local.table, block_tags::table))
             ;
 
+        local.same_line = *cl::blank_p >> !(comment >> space);
+
         local.table =
-                (cl::eps_p(*cl::blank_p >> cl::eol_p) | space)
+                local.same_line
             >>  local.element_id_1_5
-            >>  (cl::eps_p(*cl::blank_p >> cl::eol_p) | space)
+            >>  local.same_line
             >>  (*(cl::anychar_p - eol))        [actions.values.entry(ph::arg1, ph::arg2, table_tags::title)]
             >>  (+eol)
             >>  *local.table_row
Modified: branches/release/tools/quickbook/src/doc_info_actions.cpp
==============================================================================
--- branches/release/tools/quickbook/src/doc_info_actions.cpp	(original)
+++ branches/release/tools/quickbook/src/doc_info_actions.cpp	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -17,6 +17,7 @@
 #include "input_path.hpp"
 #include "actions_class.hpp"
 #include "doc_info_tags.hpp"
+#include "id_generator.hpp"
 
 namespace quickbook
 {
@@ -232,7 +233,7 @@
             << "     \"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd\">\n"
             << '<' << actions.doc_type << "\n"
             << "    id=\""
-            << actions.doc_id
+            << actions.ids.add(actions.doc_id, id_generator::explicit_id)
             << "\"\n";
         
         if(!lang.empty())
@@ -325,7 +326,10 @@
 
         if (!license.empty())
         {
-            tmp << "    <legalnotice>\n"
+            tmp << "    <legalnotice id=\""
+                << actions.ids.add(actions.doc_id + ".legal",
+                    id_generator::generated)
+                << "\">\n"
                 << "      <para>\n"
                 << "        " << doc_info_output(license, 103) << "\n"
                 << "      </para>\n"
Modified: branches/release/tools/quickbook/src/fwd.hpp
==============================================================================
--- branches/release/tools/quickbook/src/fwd.hpp	(original)
+++ branches/release/tools/quickbook/src/fwd.hpp	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -18,6 +18,7 @@
     struct actions;
     struct quickbook_grammar;
     struct collector;
+    struct id_generator;
 
     typedef position_iterator<std::string::const_iterator> iterator;
 
Copied: branches/release/tools/quickbook/src/id_generator.cpp (from r73399, /trunk/tools/quickbook/src/id_generator.cpp)
==============================================================================
--- /trunk/tools/quickbook/src/id_generator.cpp	(original)
+++ branches/release/tools/quickbook/src/id_generator.cpp	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -180,8 +180,10 @@
         std::string escape_postfix;
         std::string processing_instruction_postfix;
         std::string comment_postfix;
+        std::string whitespace;
         std::string tag_end;
         std::string name_end;
+        std::string attribute_assign;
         std::vector<std::string> id_attributes;
         
         std::string replace(std::string const&, id_generator&);
@@ -205,12 +207,14 @@
     }
 
     xml_processor::xml_processor()
-        : escape_prefix("!--quickbook-escape-prefix-->")
-        , escape_postfix("!--quickbook-escape-postfix-->")
+        : escape_prefix("<!--quickbook-escape-prefix-->")
+        , escape_postfix("<!--quickbook-escape-postfix-->")
         , processing_instruction_postfix("?>")
         , comment_postfix("-->")
+        , whitespace(" \t\n\r")
         , tag_end(" \t\n\r>")
         , name_end("= \t\n\r>")
+        , attribute_assign("= \t\n\r")
     {
         static int const n_id_attributes = sizeof(id_attributes_)/sizeof(char const*);
         for (int i = 0; i != n_id_attributes; ++i)
@@ -226,110 +230,115 @@
         std::string result;
 
         typedef std::string::const_iterator iterator;
-        iterator pos = source.begin(), end = source.end();
-        iterator next = pos;
 
-        while (true) {
-            next = std::find(next, end, '<');
-            if (next == end) break;
+        // copied is the point up to which the source has been copied, or
+        // replaced, to result.
+        iterator copied = source.begin();
 
-            if (end - pos > escape_prefix.size() && std::equal(
-                    escape_prefix.begin(), escape_prefix.end(), pos))
+        iterator end = source.end();
+
+        for(iterator it = copied; it != end; it = std::find(it, end, '<'))
+        {
+            assert(copied <= it && it <= end);        
+
+            if (static_cast<std::size_t>(end - it) > escape_prefix.size() &&
+                    std::equal(escape_prefix.begin(), escape_prefix.end(), it))
             {
-                next = std::search(next + escape_prefix.size(), end,
+                it = std::search(it + escape_prefix.size(), end,
                     escape_postfix.begin(), escape_postfix.end());
 
-                if (next == end) break;
+                if (it == end) break;
 
-                next += escape_postfix.size();
+                it += escape_postfix.size();
                 continue;
             }
 
-            ++next;
-            if (next == end) break;
+            ++it;
+            if (it == end) break;
 
-            switch(*next)
+            switch(*it)
             {
             case '?':
-                next = std::search(next, end,
+                it = std::search(it, end,
                     processing_instruction_postfix.begin(),
                     processing_instruction_postfix.end());
-
-                if (next != end) next += processing_instruction_postfix.size();
                 break;
+
             case '!':
-                if (end - next > 3 && next[1] == '-' && next[2] == '-')
+                if (end - it > 3 && it[1] == '-' && it[2] == '-')
                 {
-                    next = std::search(next + 3, end,
-                        comment_postfix.begin(), comment_postfix.end());
-
-                    if (next != end) next += comment_postfix.size();
+                    it = std::search(it + 3, end,
+                        comment_postfix. begin(), comment_postfix.end());
+                    if (it != end) it += comment_postfix.size();
                 }
                 else
                 {
-                    next = std::find(next + 1, end, '>');
-                    if (next != end) ++next;
+                    it = std::find(it, end, '>');
                 }
                 break;
+
             default:
-                if (*next >= 'a' || *next <= 'z' ||
-                        *next >= 'A' || *next <= 'Z' ||
-                        *next == '_' || *next == ':')
+                if ((*it >= 'a' && *it <= 'z') ||
+                        (*it >= 'A' && *it <= 'Z') ||
+                        *it == '_' || *it == ':')
                 {
-                    next = std::find_first_of(
-                        next + 1, end, tag_end.begin(), tag_end.end());
+                    it = std::find_first_of(
+                        it + 1, end, tag_end.begin(), tag_end.end());
 
                     while (true) {
-                        while(next != end && (*next == ' ' || *next == '\t'))
-                            ++next;
+                        while(it != end &&
+                                std::find(whitespace.begin(),
+                                    whitespace.end(), *it)
+                                != whitespace.end())
+                            ++it;
                             
-                        iterator name_start = next;
+                        iterator name_start = it;
 
-                        next = std::find_first_of(
-                            next, end, name_end.begin(), name_end.end());
+                        it = std::find_first_of(
+                            it, end, name_end.begin(), name_end.end());
                         
-                        if (next == end || *next == '>') break;
+                        if (it == end || *it == '>') break;
 
-                        string_ref name(name_start, next);
-                        ++next;
+                        string_ref name(name_start, it);
+                        ++it;
 
-                        while (next != end &&
-                                std::find(name_end.begin(), name_end.end(), *next)
-                                != name_end.end())
-                            ++next;
+                        while (it != end &&
+                                std::find(attribute_assign.begin(),
+                                    attribute_assign.end(), *it)
+                                != attribute_assign.end())
+                            ++it;
 
-                        if (next == end || (*next != '"' && *next != '\'')) break;
+                        if (it == end || (*it != '"' && *it != '\'')) break;
 
-                        char delim = *next;
-                        ++next;
+                        char delim = *it;
+                        ++it;
 
-                        iterator value_start = next;
+                        iterator value_start = it;
 
-                        next = std::find(next, end, delim);
-                        string_ref value(value_start, next);
-                        if (next == end) break;
-                        ++next;
+                        it = std::find(it, end, delim);
+                        string_ref value(value_start, it);
+                        if (it == end) break;
+                        ++it;
 
-                        if (std::find(id_attributes.begin(),
-                                    id_attributes.end(), name)
+                        if (std::find(id_attributes.begin(), id_attributes.end(),
+                                    name)
                                 != id_attributes.end())
                         {
-                            result.append(pos, value.begin());
+                            result.append(copied, value.begin());
                             string_ref x = ids.get(value);
                             result.append(x.begin(), x.end());
-                            pos = value.end();
+                            copied = value.end();
                         }
                     }
                 }
                 else
                 {
-                    next = std::find(next + 1, end, '>');
-                    if (next != end) ++next;
+                    it = std::find(it, end, '>');
                 }
             }
         }
         
-        result.append(pos, source.end());
+        result.append(copied, source.end());
         return result;
     }
 }
Modified: branches/release/tools/quickbook/src/main_grammar.cpp
==============================================================================
--- branches/release/tools/quickbook/src/main_grammar.cpp	(original)
+++ branches/release/tools/quickbook/src/main_grammar.cpp	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -145,9 +145,7 @@
             actions.scoped_context(element_info::in_block)
             [   local.blocks
             >>  *(  local.element
-                >>  cl::if_p(local.is_block)
-                    [   !(+eol >> local.blocks)
-                    ]
+                >>  !(cl::eps_p(local.is_block) >> +eol >> local.blocks)
                 |   local.paragraph_separator >> local.blocks
                 |   common
                 |   cl::space_p                 [actions.space_char]
@@ -281,11 +279,10 @@
             ;
 
         local.template_args =
-            cl::if_p(qbk_since(105u)) [
-                local.template_args_1_5
-            ].else_p [
-                local.template_args_1_4
-            ]
+                cl::eps_p(qbk_since(105u))
+            >>  local.template_args_1_5
+            |   cl::eps_p(qbk_before(105u))
+            >>  local.template_args_1_4
             ;
 
         local.template_args_1_4 = local.template_arg_1_4 >> *(".." >> local.template_arg_1_4);
Modified: branches/release/tools/quickbook/src/markups.cpp
==============================================================================
--- branches/release/tools/quickbook/src/markups.cpp	(original)
+++ branches/release/tools/quickbook/src/markups.cpp	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -54,7 +54,6 @@
                 { phrase_tags::strikethrough, "<emphasis role=\"strikethrough\">", "</emphasis>" },
                 { phrase_tags::quote, "<quote>", "</quote>" },
                 { phrase_tags::replaceable, "<replaceable>", "</replaceable>" },
-                { phrase_tags::footnote, "<footnote><para>", "</para></footnote>" },
                 { phrase_tags::escape, "<!--quickbook-escape-prefix-->", "<!--quickbook-escape-postfix-->" },
                 { phrase_tags::break_mark, "<sbr/>\n", 0 }
             };
Modified: branches/release/tools/quickbook/src/phrase_element_grammar.cpp
==============================================================================
--- branches/release/tools/quickbook/src/phrase_element_grammar.cpp	(original)
+++ branches/release/tools/quickbook/src/phrase_element_grammar.cpp	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -51,28 +51,28 @@
             ;
 
         local.image =
-                blank
-            >>  cl::if_p(qbk_since(105u)) [
-                        (+(
-                            *cl::space_p
-                        >>  +(cl::anychar_p - (cl::space_p | phrase_end | '['))
-                        ))                      [actions.values.entry(ph::arg1, ph::arg2)]
-                    >>  hard_space
-                    >>  *actions.values.list()
-                        [   '['
-                        >>  (*(cl::alnum_p | '_')) 
-                                                [actions.values.entry(ph::arg1, ph::arg2)]
-                        >>  space
-                        >>  (*(cl::anychar_p - (phrase_end | '[')))
-                                                [actions.values.entry(ph::arg1, ph::arg2)]
-                        >>  ']'
-                        >>  space
-                        ]
-                ].else_p [
-                        (*(cl::anychar_p - phrase_end))
-                                                [actions.values.entry(ph::arg1, ph::arg2)]
+                cl::eps_p(qbk_since(105u))
+            >>  blank
+            >>  (+(
+                    *cl::space_p
+                >>  +(cl::anychar_p - (cl::space_p | phrase_end | '['))
+                ))                      [actions.values.entry(ph::arg1, ph::arg2)]
+            >>  hard_space
+            >>  *actions.values.list()
+                [   '['
+                >>  (*(cl::alnum_p | '_')) 
+                                        [actions.values.entry(ph::arg1, ph::arg2)]
+                >>  space
+                >>  (*(cl::anychar_p - (phrase_end | '[')))
+                                        [actions.values.entry(ph::arg1, ph::arg2)]
+                >>  ']'
+                >>  space
                 ]
             >>  cl::eps_p(']')
+            |   cl::eps_p(qbk_before(105u))
+            >>  blank
+            >>  (*(cl::anychar_p - phrase_end)) [actions.values.entry(ph::arg1, ph::arg2)]
+            >>  cl::eps_p(']')
             ;
             
         elements.add
Modified: branches/release/tools/quickbook/src/post_process.hpp
==============================================================================
--- branches/release/tools/quickbook/src/post_process.hpp	(original)
+++ branches/release/tools/quickbook/src/post_process.hpp	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -19,7 +19,7 @@
       , int indent = -1
       , int linewidth = -1);
 
-    class post_process_failure : public std::runtime_error
+    struct post_process_failure : public std::runtime_error
     {
     public:
         explicit post_process_failure(std::string const& error)
Modified: branches/release/tools/quickbook/src/quickbook.cpp
==============================================================================
--- branches/release/tools/quickbook/src/quickbook.cpp	(original)
+++ branches/release/tools/quickbook/src/quickbook.cpp	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -13,6 +13,7 @@
 #include "post_process.hpp"
 #include "utils.hpp"
 #include "input_path.hpp"
+#include "id_generator.hpp"
 #include <boost/program_options.hpp>
 #include <boost/filesystem/v3/path.hpp>
 #include <boost/filesystem/v3/operations.hpp>
@@ -112,12 +113,8 @@
     static int
     parse_document(
         fs::path const& filein_,
-        fs::path const& xinclude_base,
-            string_stream& out)
-    {
-        actions actor(filein_, xinclude_base, out);
-
-        set_macros(actor);
+        actions& actor)
+    {        
         bool r = parse_file(filein_, actor);
         if (actor.section_level != 0)
             detail::outwarn(filein_)
@@ -142,9 +139,14 @@
       , int linewidth
       , bool pretty_print)
     {
-        int result = 0;
         string_stream buffer;
-        result = parse_document(filein_, xinclude_base_, buffer);
+        id_generator ids;
+        actions actor(filein_, xinclude_base_, buffer, ids);
+        set_macros(actor);
+
+        int result = parse_document(filein_, actor);
+
+        std::string stage2 = ids.replace_placeholders(buffer.str());
 
         if (result == 0)
         {
@@ -154,7 +156,7 @@
             {
                 try
                 {
-                    fileout << post_process(buffer.str(), indent, linewidth);
+                    fileout << post_process(stage2, indent, linewidth);
                 }
                 catch (quickbook::post_process_failure&)
                 {
@@ -162,13 +164,13 @@
                     ::quickbook::detail::outerr()
                         << "Post Processing Failed."
                         << std::endl;
-                    fileout << buffer.str();
+                    fileout << stage2;
                     return 1;
                 }
             }
             else
             {
-                fileout << buffer.str();
+                fileout << stage2;
             }
         }
         return result;
Modified: branches/release/tools/quickbook/src/template_stack.cpp
==============================================================================
--- branches/release/tools/quickbook/src/template_stack.cpp	(original)
+++ branches/release/tools/quickbook/src/template_stack.cpp	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -18,10 +18,12 @@
 {
     template_body::template_body(
             value const& content,
-            fs::path const& filename
+            fs::path const& filename,
+            content_type type
         )
         : content(content)
         , filename(filename)
+        , type(type)
     {
         assert(content.get_tag() == template_tags::block ||
             content.get_tag() == template_tags::phrase);
@@ -32,7 +34,6 @@
         return content.get_tag() == template_tags::block;
     }
 
-
     template_stack::template_stack()
         : scope(template_stack::parser(*this))
         , scopes()
Modified: branches/release/tools/quickbook/src/template_stack.hpp
==============================================================================
--- branches/release/tools/quickbook/src/template_stack.hpp	(original)
+++ branches/release/tools/quickbook/src/template_stack.hpp	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -28,11 +28,18 @@
 
     struct template_body
     {
-        template_body(value const&, fs::path const&);
+        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;
@@ -42,6 +49,17 @@
         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)
Modified: branches/release/tools/quickbook/src/utils.cpp
==============================================================================
--- branches/release/tools/quickbook/src/utils.cpp	(original)
+++ branches/release/tools/quickbook/src/utils.cpp	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -139,7 +139,7 @@
     // Although, given how UTF-8 works, if we've read anything in, the files
     // probably broken.
 
-    template <class InputIterator, class OutputIterator>
+    template <typename InputIterator, typename OutputIterator>
     bool check_bom(InputIterator& begin, InputIterator end,
             OutputIterator out, char const* chars, int length)
     {
@@ -158,7 +158,7 @@
         return false;
     }
     
-    template <class InputIterator, class OutputIterator>
+    template <typename InputIterator, typename OutputIterator>
     std::string read_bom(InputIterator& begin, InputIterator end,
             OutputIterator out)
     {
@@ -189,7 +189,7 @@
     // Copy a string, converting mac and windows style newlines to unix
     // newlines.
 
-    template <class InputIterator, class OutputIterator>
+    template <typename InputIterator, typename OutputIterator>
     bool normalize(InputIterator begin, InputIterator end,
             OutputIterator out, fs::path const& filename)
     {
Modified: branches/release/tools/quickbook/src/values.hpp
==============================================================================
--- branches/release/tools/quickbook/src/values.hpp	(original)
+++ branches/release/tools/quickbook/src/values.hpp	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -22,17 +22,17 @@
 
 namespace quickbook
 {
-    class value;
-    class stored_value;
-    class value_builder;
-    class value_error;
+    struct value;
+    struct stored_value;
+    struct value_builder;
+    struct value_error;
 
     namespace detail
     {
         ////////////////////////////////////////////////////////////////////////
         // Node
     
-        class value_node
+        struct value_node
         {
         private:
             value_node(value_node const&);
@@ -81,10 +81,10 @@
         // This defines most of the public methods for value.
         // 'begin' and 'end' are defined with the iterators later.
     
-        class value_base
+        struct value_base
         {
         public:
-            class iterator;
+            struct iterator;
 
             typedef iterator const_iterator;
             typedef value_node::tag_type tag_type;
@@ -133,20 +133,20 @@
 
             // value_builder needs to access 'value_' to get the node
             // from a value.
-            friend class quickbook::value_builder;
-            friend class quickbook::stored_value;
+            friend struct quickbook::value_builder;
+            friend struct quickbook::stored_value;
         };
         
         ////////////////////////////////////////////////////////////////////////
         // Reference and proxy values for use in iterators
 
-        class value_ref : public value_base
+        struct value_ref : public value_base
         {
         public:
             explicit value_ref(value_node* base) : value_base(base) {}
         };
         
-        class value_proxy : public value_base
+        struct value_proxy : public value_base
         {
         public:
             explicit value_proxy(value_node* base) : value_base(base) {}
@@ -157,7 +157,7 @@
         ////////////////////////////////////////////////////////////////////////
         // Iterators
 
-        class value_base::iterator
+        struct value_base::iterator
             : public boost::forward_iterator_helper<
                 iterator, value, int, value_proxy, value_ref>
         {
@@ -186,7 +186,7 @@
         ////////////////////////////////////////////////////////////////////////
         // Reference counting for values
 
-        class value_counted : public value_base
+        struct value_counted : public value_base
         {
             value_counted& operator=(value_counted const&);
         protected:
@@ -203,7 +203,7 @@
         // Values are immutable, so this class is used to build a list of
         // value nodes before constructing the value.
 
-        class value_list_builder {
+        struct value_list_builder {
             value_list_builder(value_list_builder const&);
             value_list_builder& operator=(value_list_builder const&);
         public:
@@ -226,7 +226,7 @@
     //
     // Most of the methods are in value_base.
 
-    class value : public detail::value_counted
+    struct value : public detail::value_counted
     {
     public:
         value();
@@ -237,7 +237,7 @@
         void swap(value& x) { detail::value_counted::swap(x); }
     };
     
-    class stored_value : public detail::value_counted
+    struct stored_value : public detail::value_counted
     {
     public:
         stored_value();
@@ -269,7 +269,7 @@
     //
     // Used to incrementally build a valueeter tree.
 
-    class value_builder {
+    struct value_builder {
     public:
         value_builder();
         void swap(value_builder& b);
@@ -299,7 +299,7 @@
     // Value Error
     //
     
-    class value_error : public std::logic_error
+    struct value_error : public std::logic_error
     {
     public:
         explicit value_error(std::string const&);
@@ -310,9 +310,9 @@
     //
     // Convenience class for unpacking value values.
 
-    class value_consumer {
+    struct value_consumer {
     public:
-        class iterator
+        struct iterator
             : public boost::input_iterator_helper<iterator,
                 boost::iterator_value<value::iterator>::type,
                 boost::iterator_difference<value::iterator>::type,
Modified: branches/release/tools/quickbook/test/Jamfile.v2
==============================================================================
--- branches/release/tools/quickbook/test/Jamfile.v2	(original)
+++ branches/release/tools/quickbook/test/Jamfile.v2	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -52,6 +52,7 @@
     [ 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 ]
Modified: branches/release/tools/quickbook/test/anchor.gold
==============================================================================
--- branches/release/tools/quickbook/test/anchor.gold	(original)
+++ branches/release/tools/quickbook/test/anchor.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -10,25 +10,25 @@
       want to make sure they appear in the correct place. <anchor id="a3"/>
     </para>
     <anchor id="anchor_test.anchors.this_heading_shouldn_t_pick_up_the_previous_anchor"/>
-    <bridgehead renderas="sect3" id="anchor_test.anchors.this_heading_shouldn_t_pick_up_the_previous_anchor-heading">
+    <bridgehead renderas="sect3" id="anchor_test.anchors.h0">
       <link linkend="anchor_test.anchors.this_heading_shouldn_t_pick_up_the_previous_anchor">This
       heading shouldn't pick up the previous anchor</link>
     </bridgehead>
     <anchor id="a4"/><anchor id="anchor_test.anchors.this_heading_should_pick_up_the_previous_anchor"/>
-    <bridgehead renderas="sect3" id="anchor_test.anchors.this_heading_should_pick_up_the_previous_anchor-heading">
+    <bridgehead renderas="sect3" id="anchor_test.anchors.h1">
       <link linkend="anchor_test.anchors.this_heading_should_pick_up_the_previous_anchor">This
       heading should pick up the previous anchor</link>
     </bridgehead>
     <anchor id="a5"/><anchor id="anchor_test.anchors.and_this_one"/>
-    <bridgehead renderas="sect3" id="anchor_test.anchors.and_this_one-heading">
+    <bridgehead renderas="sect3" id="anchor_test.anchors.h2">
       <link linkend="anchor_test.anchors.and_this_one">And this one</link>
     </bridgehead>
     <anchor id="a6"/><anchor id="anchor_test.anchors.also_this_one"/>
-    <bridgehead renderas="sect3" id="anchor_test.anchors.also_this_one-heading">
+    <bridgehead renderas="sect3" id="anchor_test.anchors.h3">
       <link linkend="anchor_test.anchors.also_this_one">Also this one</link>
     </bridgehead>
     <anchor id="a7"/><anchor id="anchors.finally_this"/>
-    <bridgehead renderas="sect3" id="anchors.finally_this-heading">
+    <bridgehead renderas="sect3" id="anchor_test.anchors.h4">
       Finally this
     </bridgehead>
     <anchor id="a8"/>
Modified: branches/release/tools/quickbook/test/blocks.gold
==============================================================================
--- branches/release/tools/quickbook/test/blocks.gold	(original)
+++ branches/release/tools/quickbook/test/blocks.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -3,7 +3,7 @@
 <article id="various_blocks" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
  xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>Various blocks</title> <anchor id="various_blocks.blockquotes"/>
-  <bridgehead renderas="sect2" id="various_blocks.blockquotes-heading">
+  <bridgehead renderas="sect2" id="various_blocks.h0">
     <link linkend="various_blocks.blockquotes">Blockquotes</link>
   </bridgehead>
   <para>
@@ -26,7 +26,7 @@
     </para>
   </blockquote>
   <anchor id="various_blocks.admonitions"/>
-  <bridgehead renderas="sect2" id="various_blocks.admonitions-heading">
+  <bridgehead renderas="sect2" id="various_blocks.h1">
     <link linkend="various_blocks.admonitions">Admonitions</link>
   </bridgehead>
   <warning>
@@ -63,7 +63,7 @@
     </para>
   </warning>
   <anchor id="various_blocks.blurb"/>
-  <bridgehead renderas="sect2" id="various_blocks.blurb-heading">
+  <bridgehead renderas="sect2" id="various_blocks.h2">
     <link linkend="various_blocks.blurb">Blurb</link>
   </bridgehead>
   <sidebar role="blurb">
@@ -71,12 +71,12 @@
     Blurb
   </para>
   </sidebar> <anchor id="various_blocks.inline_blocks"/>
-  <bridgehead renderas="sect2" id="various_blocks.inline_blocks-heading">
+  <bridgehead renderas="sect2" id="various_blocks.h3">
     <link linkend="various_blocks.inline_blocks">Inline blocks</link>
   </bridgehead>
   <blockquote>
     <para>
-      Blockquote containing a footnote<footnote>
+      Blockquote containing a footnote<footnote id="various_blocks.f0">
       <para>
         Here it is!
       </para>
Modified: branches/release/tools/quickbook/test/callouts.gold
==============================================================================
--- branches/release/tools/quickbook/test/callouts.gold	(original)
+++ branches/release/tools/quickbook/test/callouts.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -12,13 +12,13 @@
   <para>
     
 <programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
-  <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special"><></phrase> <phrase role="identifier">dist</phrase><phrase role="special">(</phrase><phrase role="number">1</phrase><phrase role="special">,</phrase> <phrase role="number">6</phrase><phrase role="special">);</phrase> <!--quickbook-escape-prefix--><co id="callout_tests0co" linkends="callout_tests0" /><!--quickbook-escape-postfix-->
+  <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special"><></phrase> <phrase role="identifier">dist</phrase><phrase role="special">(</phrase><phrase role="number">1</phrase><phrase role="special">,</phrase> <phrase role="number">6</phrase><phrase role="special">);</phrase> <co id="callout_tests.c0" linkends="callout_tests.c1" />
 <phrase role="special">}</phrase>
 
 </programlisting>
   </para>
   <calloutlist>
-    <callout arearefs="callout_tests0co" id="callout_tests0">
+    <callout arearefs="callout_tests.c0" id="callout_tests.c1">
       <para>
         create a uniform_int distribution
       </para>
@@ -30,13 +30,13 @@
   <para>
     
 <programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
-  <!--quickbook-escape-prefix--><co id="callout_tests1co" linkends="callout_tests1" /><!--quickbook-escape-postfix--><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special"><></phrase> <phrase role="special">></phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
+  <co id="callout_tests.c2" linkends="callout_tests.c3" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special"><></phrase> <phrase role="special">></phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
 <phrase role="special">}</phrase>
 
 </programlisting>
   </para>
   <calloutlist>
-    <callout arearefs="callout_tests1co" id="callout_tests1">
+    <callout arearefs="callout_tests.c2" id="callout_tests.c3">
       <important>
         <para>
           test
@@ -50,13 +50,13 @@
   <para>
     
 <programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
-  <!--quickbook-escape-prefix--><co id="callout_tests2co" linkends="callout_tests2" /><!--quickbook-escape-postfix--><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special"><></phrase> <phrase role="special">></phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
+  <co id="callout_tests.c4" linkends="callout_tests.c5" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special"><></phrase> <phrase role="special">></phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
 <phrase role="special">}</phrase>
 
 </programlisting>
   </para>
   <calloutlist>
-    <callout arearefs="callout_tests2co" id="callout_tests2">
+    <callout arearefs="callout_tests.c4" id="callout_tests.c5">
       <important>
         <para>
           test
@@ -70,13 +70,13 @@
   <para>
     
 <programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
-  <!--quickbook-escape-prefix--><co id="callout_tests3co" linkends="callout_tests3" /><!--quickbook-escape-postfix--><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special"><></phrase> <phrase role="special">></phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
+  <co id="callout_tests.c6" linkends="callout_tests.c7" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special"><></phrase> <phrase role="special">></phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
 <phrase role="special">}</phrase>
 
 </programlisting>
   </para>
   <calloutlist>
-    <callout arearefs="callout_tests3co" id="callout_tests3">
+    <callout arearefs="callout_tests.c6" id="callout_tests.c7">
       <important>
         <para>
           test
@@ -90,24 +90,24 @@
   <para>
     
 <programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
-  <!--quickbook-escape-prefix--><co id="callout_tests4co" linkends="callout_tests4" /><!--quickbook-escape-postfix--><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special"><></phrase> <phrase role="special">></phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
-<!--quickbook-escape-prefix--><co id="callout_tests5co" linkends="callout_tests5" /><!--quickbook-escape-postfix--><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special"><></phrase> <phrase role="identifier">dist</phrase><phrase role="special">(</phrase><phrase role="number">1</phrase><phrase role="special">,</phrase> <phrase role="number">6</phrase><phrase role="special">);</phrase> <!--quickbook-escape-prefix--><co id="callout_tests6co" linkends="callout_tests6" /><!--quickbook-escape-postfix-->
+  <co id="callout_tests.c8" linkends="callout_tests.c9" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special"><></phrase> <phrase role="special">></phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
+<co id="callout_tests.c10" linkends="callout_tests.c11" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special"><></phrase> <phrase role="identifier">dist</phrase><phrase role="special">(</phrase><phrase role="number">1</phrase><phrase role="special">,</phrase> <phrase role="number">6</phrase><phrase role="special">);</phrase> <co id="callout_tests.c12" linkends="callout_tests.c13" />
 <phrase role="special">}</phrase>
 
 </programlisting>
   </para>
   <calloutlist>
-    <callout arearefs="callout_tests4co" id="callout_tests4">
+    <callout arearefs="callout_tests.c8" id="callout_tests.c9">
       <para>
         callout 1
       </para>
     </callout>
-    <callout arearefs="callout_tests5co" id="callout_tests5">
+    <callout arearefs="callout_tests.c10" id="callout_tests.c11">
       <para>
         callout 2
       </para>
     </callout>
-    <callout arearefs="callout_tests6co" id="callout_tests6">
+    <callout arearefs="callout_tests.c12" id="callout_tests.c13">
       <para>
         create a uniform_int distribution
       </para>
@@ -115,16 +115,16 @@
   </calloutlist>
   <para>
     
-<programlisting><!--quickbook-escape-prefix--><co id="callout_tests7co" linkends="callout_tests7" /><!--quickbook-escape-postfix--><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special"><></phrase> <phrase role="identifier">dist</phrase><phrase role="special">(</phrase><phrase role="number">1</phrase><phrase role="special">,</phrase> <phrase role="number">6</phrase><phrase role="special">);</phrase> <!--quickbook-escape-prefix--><co id="callout_tests8co" linkends="callout_tests8" /><!--quickbook-escape-postfix-->
+<programlisting><co id="callout_tests.c14" linkends="callout_tests.c15" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special"><></phrase> <phrase role="identifier">dist</phrase><phrase role="special">(</phrase><phrase role="number">1</phrase><phrase role="special">,</phrase> <phrase role="number">6</phrase><phrase role="special">);</phrase> <co id="callout_tests.c16" linkends="callout_tests.c17" />
 </programlisting>
   </para>
   <calloutlist>
-    <callout arearefs="callout_tests7co" id="callout_tests7">
+    <callout arearefs="callout_tests.c14" id="callout_tests.c15">
       <para>
         callout 2
       </para>
     </callout>
-    <callout arearefs="callout_tests8co" id="callout_tests8">
+    <callout arearefs="callout_tests.c16" id="callout_tests.c17">
       <para>
         create a uniform_int distribution
       </para>
Modified: branches/release/tools/quickbook/test/code-block.gold
==============================================================================
--- branches/release/tools/quickbook/test/code-block.gold	(original)
+++ branches/release/tools/quickbook/test/code-block.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -27,7 +27,7 @@
     Paragraph.
   </para>
   <anchor id="indented_code_blocks.code_blocks_separated_by_comment"/>
-  <bridgehead renderas="sect2" id="indented_code_blocks.code_blocks_separated_by_comment-heading">
+  <bridgehead renderas="sect2" id="indented_code_blocks.h0">
     <link linkend="indented_code_blocks.code_blocks_separated_by_comment">Code blocks
     separated by comment</link>
   </bridgehead>
Modified: branches/release/tools/quickbook/test/doc-info/duplicates-1.1.gold
==============================================================================
--- branches/release/tools/quickbook/test/doc-info/duplicates-1.1.gold	(original)
+++ branches/release/tools/quickbook/test/doc-info/duplicates-1.1.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -17,7 +17,7 @@
     <copyright>
       <year>1963</year> <holder>Jane Doe</holder>
     </copyright>
-    <legalnotice>
+    <legalnotice id="thing2.legal">
       <para>
         Public Domain
       </para>
Modified: branches/release/tools/quickbook/test/doc-info/duplicates-1.5.gold
==============================================================================
--- branches/release/tools/quickbook/test/doc-info/duplicates-1.5.gold	(original)
+++ branches/release/tools/quickbook/test/doc-info/duplicates-1.5.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -17,7 +17,7 @@
     <copyright>
       <year>1963</year> <holder>Jane Doe</holder>
     </copyright>
-    <legalnotice>
+    <legalnotice id="thing2.legal">
       <para>
         Public Domain
       </para>
Modified: branches/release/tools/quickbook/test/doc-info/source-mode-1.4.gold
==============================================================================
--- branches/release/tools/quickbook/test/doc-info/source-mode-1.4.gold	(original)
+++ branches/release/tools/quickbook/test/doc-info/source-mode-1.4.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -3,7 +3,7 @@
 <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>
+    <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>
Modified: branches/release/tools/quickbook/test/doc-info/source-mode-1.5.gold
==============================================================================
--- branches/release/tools/quickbook/test/doc-info/source-mode-1.5.gold	(original)
+++ branches/release/tools/quickbook/test/doc-info/source-mode-1.5.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -3,7 +3,7 @@
 <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>
+    <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>
Modified: branches/release/tools/quickbook/test/doc-info/source-mode-1.6.gold
==============================================================================
--- branches/release/tools/quickbook/test/doc-info/source-mode-1.6.gold	(original)
+++ branches/release/tools/quickbook/test/doc-info/source-mode-1.6.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -3,7 +3,7 @@
 <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>
+    <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>
Modified: branches/release/tools/quickbook/test/escape.gold
==============================================================================
--- branches/release/tools/quickbook/test/escape.gold	(original)
+++ branches/release/tools/quickbook/test/escape.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -13,5 +13,14 @@
     <para>
       These should be properly encoded: > < "
     </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>
Modified: branches/release/tools/quickbook/test/escape.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/escape.quickbook	(original)
+++ branches/release/tools/quickbook/test/escape.quickbook	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -11,5 +11,18 @@
 
 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]
 
Modified: branches/release/tools/quickbook/test/heading.gold
==============================================================================
--- branches/release/tools/quickbook/test/heading.gold	(original)
+++ branches/release/tools/quickbook/test/heading.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -2,21 +2,21 @@
 <!DOCTYPE article PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
 <article id="header" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>Header</title> <anchor id="header.header_test"/>
-  <bridgehead renderas="sect2" id="header.header_test-heading">
+  <bridgehead renderas="sect2" id="header.h0">
     <link linkend="header.header_test">Header Test</link>
   </bridgehead>
   <para>
     Testing headers without sections.
   </para>
   <anchor id="header._not_an_id"/>
-  <bridgehead renderas="sect2" id="header._not_an_id-heading">
+  <bridgehead renderas="sect2" id="header.h1">
     <link linkend="header._not_an_id">:Not an Id</link>
   </bridgehead>
   <para>
     Paragraph.
   </para>
   <anchor id="header._not_an_id_again"/>
-  <bridgehead renderas="sect3" id="header._not_an_id_again-heading">
+  <bridgehead renderas="sect3" id="header.h2">
     <link linkend="header._not_an_id_again">:Not an Id again</link>
   </bridgehead>
   <para>
Modified: branches/release/tools/quickbook/test/heading_1_6.gold
==============================================================================
--- branches/release/tools/quickbook/test/heading_1_6.gold	(original)
+++ branches/release/tools/quickbook/test/heading_1_6.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -2,21 +2,21 @@
 <!DOCTYPE article PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
 <article id="header" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>Header</title> <anchor id="header.header_test"/>
-  <bridgehead renderas="sect2" id="header.header_test-heading">
+  <bridgehead renderas="sect2" id="header.h0">
     <link linkend="header.header_test">Header Test</link>
   </bridgehead>
   <para>
     Paragraph.
   </para>
   <anchor id="header.heading_id"/>
-  <bridgehead renderas="sect2" id="header.heading_id-heading">
+  <bridgehead renderas="sect2" id="header.h1">
     <link linkend="header.heading_id">Heading with an id</link>
   </bridgehead>
   <para>
     Paragraph.
   </para>
   <anchor id="header.heading_id2"/>
-  <bridgehead renderas="sect3" id="header.heading_id2-heading">
+  <bridgehead renderas="sect3" id="header.h2">
     <link linkend="header.heading_id2">Heading with an id</link>
   </bridgehead>
   <para>
Modified: branches/release/tools/quickbook/test/identifier_1_5.gold
==============================================================================
--- branches/release/tools/quickbook/test/identifier_1_5.gold	(original)
+++ branches/release/tools/quickbook/test/identifier_1_5.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -3,7 +3,7 @@
 <article id="identifiers_in_quickbook_1_5" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
  xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>Identifiers in quickbook 1.5</title> <anchor id="identifiers_in_quickbook_1_5.test_heading_with__code__phrase_role__identifier__code__phrase___code_"/>
-  <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_5.test_heading_with__code__phrase_role__identifier__code__phrase___code_-heading">
+  <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_5.h0">
     <link linkend="identifiers_in_quickbook_1_5.test_heading_with__code__phrase_role__identifier__code__phrase___code_">Test
     heading with <code><phrase role="identifier">code</phrase></code></link>
   </bridgehead>
Modified: branches/release/tools/quickbook/test/identifier_1_6.gold
==============================================================================
--- branches/release/tools/quickbook/test/identifier_1_6.gold	(original)
+++ branches/release/tools/quickbook/test/identifier_1_6.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -3,7 +3,7 @@
 <article id="identifiers_in_quickbook_1_6" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
  xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>Identifiers in quickbook 1.6</title> <anchor id="identifiers_in_quickbook_1_6.test_heading_with__code_"/>
-  <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.test_heading_with__code_-heading">
+  <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h0">
     <link linkend="identifiers_in_quickbook_1_6.test_heading_with__code_">Test heading
     with <code><phrase role="identifier">code</phrase></code></link>
   </bridgehead>
Modified: branches/release/tools/quickbook/test/list_test.gold
==============================================================================
--- branches/release/tools/quickbook/test/list_test.gold	(original)
+++ branches/release/tools/quickbook/test/list_test.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -231,7 +231,7 @@
     </listitem>
     <listitem>
       <simpara>
-        <footnote>
+        <footnote id="list_test.f0">
         <para>
           Footnote
         </para>
Modified: branches/release/tools/quickbook/test/quickbook-manual.gold
==============================================================================
--- branches/release/tools/quickbook/test/quickbook-manual.gold	(original)
+++ branches/release/tools/quickbook/test/quickbook-manual.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -15,7 +15,7 @@
       <year>2002</year> <year>2004</year> <year>2006</year> <holder>Joel de Guzman,
       Eric Niebler</holder>
     </copyright>
-    <legalnotice>
+    <legalnotice id="quickbook.legal">
       <para>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at <ulink url="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt>)
@@ -104,7 +104,7 @@
   <section id="quickbook.change_log">
     <title><link linkend="quickbook.change_log">Change Log</link></title> <anchor
     id="quickbook.change_log.version_1_3"/>
-    <bridgehead renderas="sect3" id="quickbook.change_log.version_1_3-heading">
+    <bridgehead renderas="sect3" id="quickbook.change_log.h0">
       <link linkend="quickbook.change_log.version_1_3">Version 1.3</link>
     </bridgehead>
     <itemizedlist>
@@ -404,7 +404,7 @@
         </para>
         <para>
           Unlike QuickBook's standard formatting scheme, the rules for simpler alternatives
-          are much stricter<footnote>
+          are much stricter<footnote id="quickbook.f0">
           <para>
             Thanks to David Barrett, author of <ulink url="http://quinthar.com/qwikiwiki/index.php?page=Home">Qwiki</ulink>,
             for sharing these samples and teaching me these obscure formatting rules.
@@ -459,7 +459,7 @@
             </simpara>
           </listitem>
         </itemizedlist>
-        <table frame="all">
+        <table frame="all" id="quickbook.syntax.phrase.simple_formatting.t0">
           <title>More Formatting Samples</title>
           <tgroup cols="2">
             <thead>
@@ -779,7 +779,7 @@
           A C++ comment <code><phrase role="comment">// looks like this</phrase></code>
           whereas a Python comment <code><phrase role="comment">#looks like this</phrase></code>.
         </para>
-        <table frame="all">
+        <table frame="all" id="quickbook.syntax.phrase.source_mode.t0">
           <title>Supported Source Modes</title>
           <tgroup cols="2">
             <thead>
@@ -1030,7 +1030,7 @@
 <programlisting><!--quickbook-escape-prefix-->[footnote A sample footnote]
 <!--quickbook-escape-postfix--></programlisting>
         <para>
-          will generate this<footnote>
+          will generate this<footnote id="quickbook.f1">
           <para>
             A sample footnote
           </para>
@@ -1707,27 +1707,27 @@
 [h6 Heading 6]
 <!--quickbook-escape-postfix--></programlisting>
         <anchor id="quickbook.syntax.block.headings.heading_1"/>
-        <bridgehead renderas="sect1" id="quickbook.syntax.block.headings.heading_1-heading">
+        <bridgehead renderas="sect1" id="quickbook.syntax.block.headings.h0">
           <link linkend="quickbook.syntax.block.headings.heading_1">Heading 1</link>
         </bridgehead>
         <anchor id="quickbook.syntax.block.headings.heading_2"/>
-        <bridgehead renderas="sect2" id="quickbook.syntax.block.headings.heading_2-heading">
+        <bridgehead renderas="sect2" id="quickbook.syntax.block.headings.h1">
           <link linkend="quickbook.syntax.block.headings.heading_2">Heading 2</link>
         </bridgehead>
         <anchor id="quickbook.syntax.block.headings.heading_3"/>
-        <bridgehead renderas="sect3" id="quickbook.syntax.block.headings.heading_3-heading">
+        <bridgehead renderas="sect3" id="quickbook.syntax.block.headings.h2">
           <link linkend="quickbook.syntax.block.headings.heading_3">Heading 3</link>
         </bridgehead>
         <anchor id="quickbook.syntax.block.headings.heading_4"/>
-        <bridgehead renderas="sect4" id="quickbook.syntax.block.headings.heading_4-heading">
+        <bridgehead renderas="sect4" id="quickbook.syntax.block.headings.h3">
           <link linkend="quickbook.syntax.block.headings.heading_4">Heading 4</link>
         </bridgehead>
         <anchor id="quickbook.syntax.block.headings.heading_5"/>
-        <bridgehead renderas="sect5" id="quickbook.syntax.block.headings.heading_5-heading">
+        <bridgehead renderas="sect5" id="quickbook.syntax.block.headings.h4">
           <link linkend="quickbook.syntax.block.headings.heading_5">Heading 5</link>
         </bridgehead>
         <anchor id="quickbook.syntax.block.headings.heading_6"/>
-        <bridgehead renderas="sect6" id="quickbook.syntax.block.headings.heading_6-heading">
+        <bridgehead renderas="sect6" id="quickbook.syntax.block.headings.h5">
           <link linkend="quickbook.syntax.block.headings.heading_6">Heading 6</link>
         </bridgehead>
         <para>
@@ -1873,7 +1873,7 @@
         <para>
           Quickbook has some predefined macros that you can already use.
         </para>
-        <table frame="all">
+        <table frame="all" id="quickbook.syntax.block.predefined_macros.t0">
           <title>Predefined Macros</title>
           <tgroup cols="3">
             <thead>
@@ -1972,7 +1972,7 @@
 ]
 <!--quickbook-escape-postfix--></programlisting>
         <anchor id="quickbook.syntax.block.templates.template_identifier"/>
-        <bridgehead renderas="sect5" id="quickbook.syntax.block.templates.template_identifier-heading">
+        <bridgehead renderas="sect5" id="quickbook.syntax.block.templates.h0">
           <link linkend="quickbook.syntax.block.templates.template_identifier">Template
           Identifier</link>
         </bridgehead>
@@ -1994,7 +1994,7 @@
           </listitem>
         </itemizedlist>
         <anchor id="quickbook.syntax.block.templates.formal_template_arguments"/>
-        <bridgehead renderas="sect5" id="quickbook.syntax.block.templates.formal_template_arguments-heading">
+        <bridgehead renderas="sect5" id="quickbook.syntax.block.templates.h1">
           <link linkend="quickbook.syntax.block.templates.formal_template_arguments">Formal
           Template Arguments</link>
         </bridgehead>
@@ -2014,7 +2014,7 @@
           of the template call.
         </para>
         <anchor id="quickbook.syntax.block.templates.template_body"/>
-        <bridgehead renderas="sect5" id="quickbook.syntax.block.templates.template_body-heading">
+        <bridgehead renderas="sect5" id="quickbook.syntax.block.templates.h2">
           <link linkend="quickbook.syntax.block.templates.template_body">Template
           Body</link>
         </bridgehead>
@@ -2041,7 +2041,7 @@
           block level elements are not allowed in phrase templates.
         </para>
         <anchor id="quickbook.syntax.block.templates.template_expansion"/>
-        <bridgehead renderas="sect5" id="quickbook.syntax.block.templates.template_expansion-heading">
+        <bridgehead renderas="sect5" id="quickbook.syntax.block.templates.h3">
           <link linkend="quickbook.syntax.block.templates.template_expansion">Template
           Expansion</link>
         </bridgehead>
@@ -2084,7 +2084,7 @@
           by the close parenthesis.
         </para>
         <anchor id="quickbook.syntax.block.templates.nullary_templates"/>
-        <bridgehead renderas="sect5" id="quickbook.syntax.block.templates.nullary_templates-heading">
+        <bridgehead renderas="sect5" id="quickbook.syntax.block.templates.h4">
           <link linkend="quickbook.syntax.block.templates.nullary_templates">Nullary
           Templates</link>
         </bridgehead>
@@ -2177,7 +2177,7 @@
           brackets, though.
         </para>
         <anchor id="quickbook.syntax.block.templates.simple_arguments"/>
-        <bridgehead renderas="sect5" id="quickbook.syntax.block.templates.simple_arguments-heading">
+        <bridgehead renderas="sect5" id="quickbook.syntax.block.templates.h5">
           <link linkend="quickbook.syntax.block.templates.simple_arguments">Simple
           Arguments</link>
         </bridgehead>
@@ -2252,7 +2252,7 @@
           what do you think man?
         </para>
         <anchor id="quickbook.syntax.block.templates.punctuation_templates"/>
-        <bridgehead renderas="sect5" id="quickbook.syntax.block.templates.punctuation_templates-heading">
+        <bridgehead renderas="sect5" id="quickbook.syntax.block.templates.h6">
           <link linkend="quickbook.syntax.block.templates.punctuation_templates">Punctuation
           Templates</link>
         </bridgehead>
@@ -2330,7 +2330,7 @@
         <para>
           will generate:
         </para>
-        <table frame="all">
+        <table frame="all" id="quickbook.syntax.block.tables.t0">
           <title>A Simple Table</title>
           <tgroup cols="3">
             <thead>
@@ -2439,7 +2439,7 @@
         <para>
           and thus:
         </para>
-        <table frame="all">
+        <table frame="all" id="quickbook.syntax.block.tables.t1">
           <title>Table with fat cells</title>
           <tgroup cols="2">
             <thead>
@@ -2513,7 +2513,7 @@
     ]
 ]
 <!--quickbook-escape-postfix--></programlisting>
-        <table frame="all">
+        <table frame="all" id="quickbook.syntax.block.tables.t2">
           <title>Table with code</title>
           <tgroup cols="2">
             <thead>
@@ -2656,7 +2656,7 @@
           QuickBook's import facility provides a nice solution.
         </para>
         <anchor id="quickbook.syntax.block.import.example"/>
-        <bridgehead renderas="sect5" id="quickbook.syntax.block.import.example-heading">
+        <bridgehead renderas="sect5" id="quickbook.syntax.block.import.h0">
           <link linkend="quickbook.syntax.block.import.example">Example</link>
         </bridgehead>
         <para>
@@ -2734,7 +2734,7 @@
           Some trailing text here
         </para>
         <anchor id="quickbook.syntax.block.import.code_snippet_markup"/>
-        <bridgehead renderas="sect5" id="quickbook.syntax.block.import.code_snippet_markup-heading">
+        <bridgehead renderas="sect5" id="quickbook.syntax.block.import.h1">
           <link linkend="quickbook.syntax.block.import.code_snippet_markup">Code
           Snippet Markup</link>
         </bridgehead>
@@ -2756,7 +2756,7 @@
           This too will not be visible in quickbook.
         </para>
         <anchor id="quickbook.syntax.block.import.special_comments"/>
-        <bridgehead renderas="sect5" id="quickbook.syntax.block.import.special_comments-heading">
+        <bridgehead renderas="sect5" id="quickbook.syntax.block.import.h2">
           <link linkend="quickbook.syntax.block.import.special_comments">Special
           Comments</link>
         </bridgehead>
@@ -2779,7 +2779,7 @@
           initial slash-star-tick and the final star-slash shall be ignored.
         </para>
         <anchor id="quickbook.syntax.block.import.callouts"/>
-        <bridgehead renderas="sect5" id="quickbook.syntax.block.import.callouts-heading">
+        <bridgehead renderas="sect5" id="quickbook.syntax.block.import.h3">
           <link linkend="quickbook.syntax.block.import.callouts">Callouts</link>
         </bridgehead>
         <para>
@@ -2796,20 +2796,20 @@
         </para>
         <para>
           
-<programlisting><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">string</phrase> <phrase role="identifier">foo_bar</phrase><phrase role="special">()</phrase> <!--quickbook-escape-prefix--><co id="quickbook0co" linkends="quickbook0" /><!--quickbook-escape-postfix-->
+<programlisting><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">string</phrase> <phrase role="identifier">foo_bar</phrase><phrase role="special">()</phrase> <co id="quickbook.c0" linkends="quickbook.c1" />
 <phrase role="special">{</phrase>
-    <phrase role="keyword">return</phrase> <phrase role="string">"foo-bar"</phrase><phrase role="special">;</phrase> <!--quickbook-escape-prefix--><co id="quickbook1co" linkends="quickbook1" /><!--quickbook-escape-postfix-->
+    <phrase role="keyword">return</phrase> <phrase role="string">"foo-bar"</phrase><phrase role="special">;</phrase> <co id="quickbook.c2" linkends="quickbook.c3" />
 <phrase role="special">}</phrase>
 </programlisting>
         </para>
         <calloutlist>
-          <callout arearefs="quickbook0co" id="quickbook0">
+          <callout arearefs="quickbook.c0" id="quickbook.c1">
             <para>
               The <emphasis>Mythical</emphasis> FooBar. See <ulink url="http://en.wikipedia.org/wiki/Foobar">Foobar
               for details</ulink>
             </para>
           </callout>
-          <callout arearefs="quickbook1co" id="quickbook1">
+          <callout arearefs="quickbook.c2" id="quickbook.c3">
             <para>
               return 'em, foo-bar man!
             </para>
@@ -3147,7 +3147,7 @@
   <section id="quickbook.faq">
     <title><link linkend="quickbook.faq">Frequently Asked Questions</link></title>
     <anchor id="quickbook.faq.can_i_use_quickbook_for_non_boost_documentation_"/>
-    <bridgehead renderas="sect3" id="quickbook.faq.can_i_use_quickbook_for_non_boost_documentation_-heading">
+    <bridgehead renderas="sect3" id="quickbook.faq.h0">
       <link linkend="quickbook.faq.can_i_use_quickbook_for_non_boost_documentation_">Can
       I use QuickBook for non-Boost documentation?</link>
     </bridgehead>
@@ -3191,7 +3191,7 @@
     <para>
       [cpp]
     </para>
-    <table frame="all">
+    <table frame="all" id="quickbook.ref.t0">
       <title>Syntax Compendium</title>
       <tgroup cols="3">
         <thead>
Copied: branches/release/tools/quickbook/test/table_1_3.gold (from r73298, /trunk/tools/quickbook/test/table_1_3.gold)
==============================================================================
--- /trunk/tools/quickbook/test/table_1_3.gold	(original)
+++ branches/release/tools/quickbook/test/table_1_3.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -47,9 +47,124 @@
       </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.t1">
+    <table frame="all" id="table_1_3.section1.t0">
       <title>A & B</title>
       <tgroup cols="2">
         <thead>
@@ -82,14 +197,14 @@
         </tbody>
       </tgroup>
     </table>
-    <table frame="all" id="table_1_3.t2">
+    <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.t3">
+    <table frame="all" id="table_1_3.section1.t2">
       <title>Table with an empty cell</title>
       <tgroup cols="1">
         <tbody>
@@ -103,7 +218,7 @@
         </tbody>
       </tgroup>
     </table>
-    <table frame="all" id="table_1_3.t4">
+    <table frame="all" id="table_1_3.section1.t3">
       <title>Indentation</title>
       <tgroup cols="2">
         <thead>
@@ -142,7 +257,7 @@
         </tbody>
       </tgroup>
     </table>
-    <table frame="all" id="table_1_3.t6">
+    <table frame="all" id="table_1_3.section1.t4">
       <title>Nested Tables</title>
       <tgroup cols="1">
         <thead>
@@ -162,7 +277,7 @@
         <tbody>
           <row>
             <entry>
-              <table frame="all" id="table_1_3.t5">
+              <table frame="all" id="table_1_3.section1.t5">
                 <title>Inner Table</title>
                 <tgroup cols="2">
                   <thead>
@@ -208,7 +323,7 @@
       </tgroup>
     </table>
     <anchor id="id1"/>
-    <table frame="all" id="table_1_3.t7">
+    <table frame="all" id="table_1_3.section1.t6">
       <title>Table with anchors</title>
       <tgroup cols="1">
         <thead>
Copied: branches/release/tools/quickbook/test/table_1_3.quickbook (from r73298, /trunk/tools/quickbook/test/table_1_3.quickbook)
==============================================================================
--- /trunk/tools/quickbook/test/table_1_3.quickbook	(original)
+++ branches/release/tools/quickbook/test/table_1_3.quickbook	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -13,6 +13,38 @@
     [[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
Modified: branches/release/tools/quickbook/test/table_1_5.gold
==============================================================================
--- branches/release/tools/quickbook/test/table_1_5.gold	(original)
+++ branches/release/tools/quickbook/test/table_1_5.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -115,6 +115,121 @@
       </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">
Modified: branches/release/tools/quickbook/test/table_1_5.quickbook
==============================================================================
--- branches/release/tools/quickbook/test/table_1_5.quickbook	(original)
+++ branches/release/tools/quickbook/test/table_1_5.quickbook	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -28,6 +28,38 @@
     [[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
Modified: branches/release/tools/quickbook/test/template-section.gold
==============================================================================
--- branches/release/tools/quickbook/test/template-section.gold	(original)
+++ branches/release/tools/quickbook/test/template-section.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -12,7 +12,7 @@
       Hello.
     </para>
     <anchor id="section_in_a_template.test.just_to_test_id_generation"/>
-    <bridgehead renderas="sect3" id="section_in_a_template.test.just_to_test_id_generation-heading">
+    <bridgehead renderas="sect3" id="section_in_a_template.test.h0">
       <link linkend="section_in_a_template.test.just_to_test_id_generation">Just
       to test id generation</link>
     </bridgehead>
Modified: branches/release/tools/quickbook/test/unicode-escape.gold
==============================================================================
--- branches/release/tools/quickbook/test/unicode-escape.gold	(original)
+++ branches/release/tools/quickbook/test/unicode-escape.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -2,7 +2,7 @@
 <!DOCTYPE article PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
 <article id="utf_8_test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>UTF-8 test</title> <anchor id="utf_8_test.i__xf1_t__xeb_rn__xe2_ti__xf4_n__xe0_liz__xe6_ti__xf8_n"/>
-  <bridgehead renderas="sect2" id="utf_8_test.i__xf1_t__xeb_rn__xe2_ti__xf4_n__xe0_liz__xe6_ti__xf8_n-heading">
+  <bridgehead renderas="sect2" id="utf_8_test.h0">
     <link linkend="utf_8_test.i__xf1_t__xeb_rn__xe2_ti__xf4_n__xe0_liz__xe6_ti__xf8_n">Iñtërnâtiônàlizætiøn</link>
   </bridgehead>
   <itemizedlist>
Modified: branches/release/tools/quickbook/test/unit/Jamfile.v2
==============================================================================
--- branches/release/tools/quickbook/test/unit/Jamfile.v2	(original)
+++ branches/release/tools/quickbook/test/unit/Jamfile.v2	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -13,5 +13,5 @@
     ;
 
 run values_test.cpp ../../src/values.cpp ;
-run post_process_test.cpp ../../src/post_process.cpp ;
+run post_process_test.cpp ../../src/post_process.cpp ../../src/id_generator.cpp ;
 run iterator_tests.cpp ../../src/values.cpp ;
Modified: branches/release/tools/quickbook/test/utf-8-bom.gold
==============================================================================
--- branches/release/tools/quickbook/test/utf-8-bom.gold	(original)
+++ branches/release/tools/quickbook/test/utf-8-bom.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -2,7 +2,7 @@
 <!DOCTYPE article PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
 <article id="utf_8_test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>UTF-8 test</title> <anchor id="utf_8_test.i__t__rn__ti__n__liz__ti__n"/>
-  <bridgehead renderas="sect2" id="utf_8_test.i__t__rn__ti__n__liz__ti__n-heading">
+  <bridgehead renderas="sect2" id="utf_8_test.h0">
     <link linkend="utf_8_test.i__t__rn__ti__n__liz__ti__n">Iñtërnâtiônàlizætiøn</link>
   </bridgehead>
   <itemizedlist>
Modified: branches/release/tools/quickbook/test/utf-8.gold
==============================================================================
--- branches/release/tools/quickbook/test/utf-8.gold	(original)
+++ branches/release/tools/quickbook/test/utf-8.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -2,7 +2,7 @@
 <!DOCTYPE article PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
 <article id="utf_8_test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>UTF-8 test</title> <anchor id="utf_8_test.i__t__rn__ti__n__liz__ti__n"/>
-  <bridgehead renderas="sect2" id="utf_8_test.i__t__rn__ti__n__liz__ti__n-heading">
+  <bridgehead renderas="sect2" id="utf_8_test.h0">
     <link linkend="utf_8_test.i__t__rn__ti__n__liz__ti__n">Iñtërnâtiônàlizætiøn</link>
   </bridgehead>
   <itemizedlist>
Modified: branches/release/tools/quickbook/test/xml-escape_1_2.gold
==============================================================================
--- branches/release/tools/quickbook/test/xml-escape_1_2.gold	(original)
+++ branches/release/tools/quickbook/test/xml-escape_1_2.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -4,7 +4,7 @@
 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>
+    <legalnotice id="test_that__amp____lt__are_being_escaped_.legal">
       <para>
         & should be &amp;, < should &lt;
       </para>
Modified: branches/release/tools/quickbook/test/xml-escape_1_5.gold
==============================================================================
--- branches/release/tools/quickbook/test/xml-escape_1_5.gold	(original)
+++ branches/release/tools/quickbook/test/xml-escape_1_5.gold	2011-07-30 12:45:08 EDT (Sat, 30 Jul 2011)
@@ -4,7 +4,7 @@
 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>
+    <legalnotice id="test_that__amp____lt__are_being_escaped_.legal">
       <para>
         & should be &amp;, < should &lt;
       </para>