Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75251 - in branches/quickbook-dev/tools/quickbook: src test test/doc-info test/include test/unit
From: dnljms_at_[hidden]
Date: 2011-11-02 03:49:25


Author: danieljames
Date: 2011-11-02 03:49:22 EDT (Wed, 02 Nov 2011)
New Revision: 75251
URL: http://svn.boost.org/trac/boost/changeset/75251

Log:
Quickbook: New version of id_manager. Fixes #1221.

This encapsulates more in the id and section handling code. Fixes a few
edge cases and separates implementation of the new and old section
handling code. Always normalizes and truncates generated ids in quickbook
1.6.
Added:
   branches/quickbook-dev/tools/quickbook/src/id_manager.cpp (contents, props changed)
   branches/quickbook-dev/tools/quickbook/src/id_manager.hpp (contents, props changed)
Removed:
   branches/quickbook-dev/tools/quickbook/src/id_generator.cpp
   branches/quickbook-dev/tools/quickbook/src/id_generator.hpp
Text files modified:
   branches/quickbook-dev/tools/quickbook/src/Jamfile.v2 | 2
   branches/quickbook-dev/tools/quickbook/src/actions.cpp | 67 ++++-----
   branches/quickbook-dev/tools/quickbook/src/actions_class.cpp | 8
   branches/quickbook-dev/tools/quickbook/src/actions_class.hpp | 6
   branches/quickbook-dev/tools/quickbook/src/actions_state.hpp | 3
   branches/quickbook-dev/tools/quickbook/src/doc_info_actions.cpp | 123 ++++++-----------
   branches/quickbook-dev/tools/quickbook/src/fwd.hpp | 2
   branches/quickbook-dev/tools/quickbook/src/quickbook.cpp | 16 --
   branches/quickbook-dev/tools/quickbook/test/doc-info/escape-1.6.gold | 4
   branches/quickbook-dev/tools/quickbook/test/doc-info/source-mode-1.6.gold | 4
   branches/quickbook-dev/tools/quickbook/test/heading-1_6.gold | 38 ++--
   branches/quickbook-dev/tools/quickbook/test/identifier-1_6.gold | 268 ++++++++++++++++++++--------------------
   branches/quickbook-dev/tools/quickbook/test/include/in_section-1_6.gold | 52 +++---
   branches/quickbook-dev/tools/quickbook/test/unit/Jamfile.v2 | 2
   14 files changed, 270 insertions(+), 325 deletions(-)

Modified: branches/quickbook-dev/tools/quickbook/src/Jamfile.v2
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/Jamfile.v2 (original)
+++ branches/quickbook-dev/tools/quickbook/src/Jamfile.v2 2011-11-02 03:49:22 EDT (Wed, 02 Nov 2011)
@@ -28,7 +28,7 @@
     utils.cpp
     input_path.cpp
     values.cpp
- id_generator.cpp
+ id_manager.cpp
     post_process.cpp
     collector.cpp
     template_stack.cpp

Modified: branches/quickbook-dev/tools/quickbook/src/actions.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions.cpp 2011-11-02 03:49:22 EDT (Wed, 02 Nov 2011)
@@ -30,7 +30,7 @@
 #include "input_path.hpp"
 #include "block_tags.hpp"
 #include "phrase_tags.hpp"
-#include "id_generator.hpp"
+#include "id_manager.hpp"
 
 namespace quickbook
 {
@@ -57,9 +57,9 @@
         
         std::string add_anchor(quickbook::actions& actions,
                 std::string const& id,
- id_generator::categories category = id_generator::explicit_id)
+ id_category::categories category = id_category::explicit_id)
         {
- std::string placeholder = actions.ids.add(id, category);
+ std::string placeholder = actions.ids.add_anchor(id, category);
             actions.anchors.push_back(placeholder);
             return placeholder;
         }
@@ -260,8 +260,7 @@
         value_consumer values = phrase;
         actions.phrase
             << "<footnote id=\""
- << actions.section->fully_qualified_id(
- actions.ids, "f", id_generator::numbered)
+ << actions.ids.add_id("f", id_category::numbered)
             << "\"><para>"
             << values.consume().get_boostbook()
             << "</para></footnote>";
@@ -303,8 +302,7 @@
             {
                 actions.out << "<bridgehead renderas=\"sect" << level << "\"";
                 actions.out << " id=\"";
- actions.out << actions.section->fully_qualified_id(
- actions.ids, "h", id_generator::numbered);
+ actions.out << actions.ids.add_id("h", id_category::numbered);
                 actions.out << "\">";
                 actions.out << "<phrase id=\"" << id << "\"/>";
                 actions.out << "<link linkend=\"" << id << "\">";
@@ -336,10 +334,9 @@
 
         if (generic)
         {
- level = actions.section->level + 2;
- // section.level is zero-based. We need to use a
- // one-based heading which is one greater
- // than the current. Thus: section.level + 2.
+ level = actions.ids.section_level() + 1;
+ // We need to use a heading which is one greater
+ // than the current.
             if (level > 6 ) // The max is h6, clip it if it goes
                 level = 6; // further than that
         }
@@ -352,19 +349,22 @@
 
         if (!generic && qbk_version_n < 103) // version 1.2 and below
         {
- std::string anchor = actions.section->old_style_id(
- actions.ids, detail::make_identifier(content.get_boostbook()),
- id_generator::generated_heading);
+ // This generates the old id style if both the interpreting
+ // version and the generation version are less then 103u.
+
+ std::string anchor = actions.ids.old_style_id(
+ detail::make_identifier(content.get_boostbook()),
+ id_category::generated_heading);
 
             write_bridgehead(actions, level,
                 content.get_boostbook(), anchor, false);
         }
         else
         {
- id_generator::categories category =
+ id_category::categories category =
                 !element_id.empty() ?
- id_generator::explicit_id :
- id_generator::generated_heading;
+ id_category::explicit_id :
+ id_category::generated_heading;
 
             std::string id =
                 !element_id.empty() ?
@@ -375,8 +375,7 @@
                             content.get_boostbook()
                     );
 
- std::string anchor = actions.section->fully_qualified_id(
- actions.ids, id, category);
+ std::string anchor = actions.ids.add_id(id, category);
 
             write_bridgehead(actions, level,
                 content.get_boostbook(), anchor, true);
@@ -1182,7 +1181,7 @@
 
             // Store the current section level so that we can ensure that
             // [section] and [endsect] tags in the template are balanced.
- actions.section->min_level = actions.section->level;
+ actions.min_section_level = actions.ids.section_level();
 
             // Quickbook 1.4-: When expanding the tempalte continue to use the
             // current scope (the dynamic scope).
@@ -1220,7 +1219,7 @@
                 return;
             }
 
- if (actions.section->level != actions.section->min_level)
+ if (actions.ids.section_level() != actions.min_section_level)
             {
                 detail::outerr(actions.filename, pos.line)
                     << "Mismatched sections in template "
@@ -1259,10 +1258,8 @@
 
         for(unsigned int i = 0; i < size; ++i)
         {
- std::string callout_id1 = actions.section->fully_qualified_id(
- actions.ids, callout_base, id_generator::numbered);
- std::string callout_id2 = actions.section->fully_qualified_id(
- actions.ids, callout_base, id_generator::numbered);
+ std::string callout_id1 = actions.ids.add_id(callout_base, id_category::numbered);
+ std::string callout_id2 = actions.ids.add_id(callout_base, id_category::numbered);
 
             std::string code;
             code += "<co id=\"" + callout_id1 + "\" ";
@@ -1453,18 +1450,15 @@
         std::string table_id;
         if(qbk_version_n >= 105) {
             if(!element_id.empty()) {
- table_id = actions.section->fully_qualified_id(
- actions.ids, element_id, id_generator::explicit_id);
+ table_id = actions.ids.add_id(element_id, id_category::explicit_id);
             }
             else if(has_title) {
- table_id = actions.section->fully_qualified_id(
- actions.ids, detail::make_identifier(title), id_generator::generated);
+ table_id = actions.ids.add_id(detail::make_identifier(title), id_category::generated);
             }
         }
         else if (has_title)
         {
- table_id = actions.section->fully_qualified_id(
- actions.ids, "t", id_generator::numbered);
+ table_id = actions.ids.add_id("t", id_category::numbered);
         }
 
         // Emulating the old behaviour which used the width of the final
@@ -1541,14 +1535,13 @@
         value content = values.consume();
         values.finish();
 
- std::string full_id = actions.section->begin_section(
- actions.ids, qbk_version_n,
+ std::string full_id = actions.ids.begin_section(
             !element_id.empty() ?
                 element_id.get_quickbook() :
                 detail::make_identifier(content.get_quickbook()),
             !element_id.empty() ?
- id_generator::explicit_id :
- id_generator::generated_section);
+ id_category::explicit_id :
+ id_category::generated_section);
 
         actions.out << "\n<section id=\"" << full_id << "\">\n";
         actions.out << "<title>";
@@ -1574,7 +1567,7 @@
     {
         write_anchors(actions, actions.out);
 
- if (actions.section->level <= actions.section->min_level)
+ if (actions.ids.section_level() <= actions.min_section_level)
         {
             detail::outerr(actions.filename, pos.line)
                 << "Mismatched [endsect] near column " << pos.column << ".\n";
@@ -1584,7 +1577,7 @@
         }
 
         actions.out << "</section>";
- actions.section->end_section();
+ actions.ids.end_section();
     }
     
     void element_id_warning_action::operator()(iterator first, iterator) const

Modified: branches/quickbook-dev/tools/quickbook/src/actions_class.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions_class.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions_class.cpp 2011-11-02 03:49:22 EDT (Wed, 02 Nov 2011)
@@ -21,7 +21,7 @@
 namespace quickbook
 {
     actions::actions(fs::path const& filein_, fs::path const& xinclude_base_,
- string_stream& out_, id_generator& ids)
+ string_stream& out_, id_manager& ids)
         : grammar_()
 
         , doc_title_qbk()
@@ -44,7 +44,7 @@
         , filename_relative(filein_.filename())
 
         , template_depth(0)
- , section(0)
+ , min_section_level(1)
 
         , out(out_)
         , phrase()
@@ -132,13 +132,13 @@
     template_state::template_state(actions& a)
         : file_state(a, file_state::scope_all)
         , template_depth(a.template_depth)
- , section(*a.section)
+ , min_section_level(a.min_section_level)
     {
     }
 
     template_state::~template_state()
     {
         boost::swap(a.template_depth, template_depth);
- boost::swap(*a.section, section);
+ boost::swap(a.min_section_level, min_section_level);
     }
 }

Modified: branches/quickbook-dev/tools/quickbook/src/actions_class.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions_class.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions_class.hpp 2011-11-02 03:49:22 EDT (Wed, 02 Nov 2011)
@@ -24,7 +24,7 @@
     struct actions
     {
         actions(fs::path const& filein_, fs::path const& xinclude_base, string_stream& out_,
- id_generator&);
+ id_manager&);
 
     private:
         boost::scoped_ptr<quickbook_grammar> grammar_;
@@ -48,7 +48,7 @@
         bool warned_about_breaks;
         int context;
         bool conditional;
- id_generator& ids;
+ id_manager& ids;
 
     // state saved for files and templates.
         bool imported;
@@ -62,7 +62,7 @@
 
     // state saved for templates.
         int template_depth;
- section_info* section;
+ int min_section_level;
 
     // output state - scoped by templates and grammar
         collector out; // main output stream

Modified: branches/quickbook-dev/tools/quickbook/src/actions_state.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions_state.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions_state.hpp 2011-11-02 03:49:22 EDT (Wed, 02 Nov 2011)
@@ -11,7 +11,6 @@
 #define BOOST_SPIRIT_ACTIONS_STATE_HPP
 
 #include "actions_class.hpp"
-#include "id_generator.hpp"
 
 namespace quickbook
 {
@@ -53,7 +52,7 @@
         ~template_state();
 
         int template_depth;
- section_info section;
+ int min_section_level;
     };
 }
 

Modified: branches/quickbook-dev/tools/quickbook/src/doc_info_actions.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/doc_info_actions.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/doc_info_actions.cpp 2011-11-02 03:49:22 EDT (Wed, 02 Nov 2011)
@@ -17,7 +17,7 @@
 #include "input_path.hpp"
 #include "actions_class.hpp"
 #include "doc_info_tags.hpp"
-#include "id_generator.hpp"
+#include "id_manager.hpp"
 
 namespace quickbook
 {
@@ -128,54 +128,18 @@
                 ;
         }
 
- std::string id_placeholder;
-
- // Note: this is the version number of the parent document.
- if (qbk_version_n >= 106)
- {
- if (!include_doc_id.empty())
- id_placeholder = actions.section->set_doc_id(actions.ids,
- include_doc_id.get_quickbook(), id_generator::explicit_id);
- else if (!id.empty())
- id_placeholder = actions.section->set_doc_id(actions.ids,
- id.get_quickbook(), id_generator::explicit_id);
- else if (docinfo_type)
- id_placeholder = actions.section->set_doc_id(actions.ids,
- detail::make_identifier(actions.doc_title_qbk),
- id_generator::generated_doc);
- else
- assert(!actions.section->doc_id.empty());
- }
- else
- {
- if (!id.empty())
- id_placeholder = actions.section->set_doc_id(actions.ids,
- id.get_quickbook(), id_generator::explicit_id);
- else if (!include_doc_id.empty())
- id_placeholder = actions.section->set_doc_id(actions.ids,
- include_doc_id.get_quickbook(), id_generator::explicit_id);
- else
- id_placeholder = actions.section->set_doc_id(actions.ids,
- detail::make_identifier(actions.doc_title_qbk),
- id_generator::generated_doc);
- }
-
- // if we're ignoring the document info, we're done.
+ // if we're ignoring the document info, just start the file
+ // and we're done.
 
         if (!docinfo_type)
         {
+ actions.ids.start_file(
+ include_doc_id.empty() ? "" : include_doc_id.get_quickbook(),
+ id.empty() ? "" : id.get_quickbook(),
+ actions.doc_title_qbk);
+
             return;
         }
-
- // Make sure we really did have a document info block.
-
- assert(doc_title.check() && !actions.doc_type.empty() &&
- !id_placeholder.empty());
-
- // Save the section level so it can be checked at the end of the
- // document.
-
- actions.section->min_level = actions.section->level;
 
         // Quickbook version
 
@@ -183,23 +147,13 @@
 
         if (qbk_version.empty())
         {
- // Always reset quickbook version if we're not ignoring the docinfo.
- // This is so that the file is interpreted as if it was standalone.
- if (docinfo_type)
- {
- // hard code quickbook version to v1.1
- qbk_major_version = 1;
- qbk_minor_version = 1;
- qbk_version_n = 101;
- detail::outwarn(actions.filename,1)
- << "Quickbook version undefined. "
- "Version 1.1 is assumed" << std::endl;
- }
- else
- {
- qbk_major_version = qbk_version_n / 100;
- qbk_minor_version = qbk_version_n % 100;
- }
+ // hard code quickbook version to v1.1
+ qbk_major_version = 1;
+ qbk_minor_version = 1;
+ qbk_version_n = 101;
+ detail::outwarn(actions.filename,1)
+ << "Quickbook version undefined. "
+ "Version 1.1 is assumed" << std::endl;
         }
         else
         {
@@ -211,7 +165,6 @@
             qbk_version_n = ((unsigned) qbk_major_version * 100) +
                 (unsigned) qbk_minor_version;
         }
-
 
         if (qbk_version_n == 106)
         {
@@ -230,6 +183,25 @@
             ++actions.error_count;
         }
 
+ id_manager::start_file_info start_file_info =
+ actions.ids.start_file_with_docinfo(
+ qbk_version_n,
+ include_doc_id.empty() ? "" : include_doc_id.get_quickbook(),
+ id.empty() ? "" : id.get_quickbook(),
+ actions.doc_title_qbk);
+
+ // if we're ignoring the document info, we're done.
+
+ if (!docinfo_type)
+ {
+ return;
+ }
+
+ // Make sure we really did have a document info block.
+
+ assert(doc_title.check() && !actions.doc_type.empty() &&
+ !start_file_info.doc_id.empty());
+
         // Set defaults for dirname + last_revision
 
         if (dirname.empty() && actions.doc_type == "library") {
@@ -237,7 +209,7 @@
                 dirname = id;
             }
             else {
- dirname = qbk_bbk_value(actions.section->doc_id,
+ dirname = qbk_bbk_value(start_file_info.doc_id,
                     doc_info_attributes::dirname);
             }
         }
@@ -298,7 +270,7 @@
 
         out << '<' << actions.doc_type << "\n"
             << " id=\""
- << id_placeholder
+ << start_file_info.placeholder
             << "\"\n";
 
         if(!lang.empty())
@@ -392,8 +364,7 @@
         if (!license.empty())
         {
             tmp << " <legalnotice id=\""
- << actions.section->fully_qualified_id(actions.ids, "legal",
- id_generator::generated)
+ << actions.ids.add_id("legal", id_category::generated)
                 << "\">\n"
                 << " <para>\n"
                 << " " << doc_info_output(license, 103) << "\n"
@@ -460,29 +431,23 @@
     
     void post(collector& out, quickbook::actions& actions, docinfo_types docinfo_type)
     {
- // if we're ignoring the document info, do nothing.
- if (!docinfo_type)
- {
- return;
- }
-
- assert(!actions.doc_type.empty());
+ // We've finished generating our output. Here's what we'll do
+ // *after* everything else.
 
         // Close any open sections.
- if (actions.section->level > 0) {
+ if (docinfo_type && actions.ids.section_level() > 1) {
             detail::outwarn(actions.filename)
                 << "Missing [endsect] detected at end of file."
                 << std::endl;
 
- while(actions.section->level > 0) {
+ while(actions.ids.section_level() > 1) {
                 out << "</section>";
- actions.section->end_section();
+ actions.ids.end_section();
             }
         }
 
- // We've finished generating our output. Here's what we'll do
- // *after* everything else.
- out << "\n</" << actions.doc_type << ">\n\n";
+ actions.ids.end_file();
+ if (docinfo_type) out << "\n</" << actions.doc_type << ">\n\n";
     }
 
     static void write_document_title(collector& out, value const& title, value const& version)

Modified: branches/quickbook-dev/tools/quickbook/src/fwd.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/fwd.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/fwd.hpp 2011-11-02 03:49:22 EDT (Wed, 02 Nov 2011)
@@ -18,7 +18,7 @@
     struct actions;
     struct quickbook_grammar;
     struct collector;
- struct id_generator;
+ struct id_manager;
     struct section_info;
 
     typedef position_iterator<std::string::const_iterator> iterator;

Deleted: branches/quickbook-dev/tools/quickbook/src/id_generator.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/id_generator.cpp 2011-11-02 03:49:22 EDT (Wed, 02 Nov 2011)
+++ (empty file)
@@ -1,599 +0,0 @@
-/*=============================================================================
- Copyright (c) 2011 Daniel James
-
- Use, modification and distribution is subject to the Boost Software
- License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt)
-=============================================================================*/
-
-#include "id_generator.hpp"
-#include "markups.hpp"
-#include "phrase_tags.hpp"
-#include <cctype>
-#include <boost/lexical_cast.hpp>
-#include <algorithm>
-#include <vector>
-
-namespace quickbook
-{
- // string_ref
-
- struct string_ref
- {
- public:
- typedef std::string::const_iterator iterator;
-
- private:
- iterator begin_, end_;
-
- public:
- string_ref() : begin_(), end_() {}
-
- explicit string_ref(iterator b, iterator e)
- : begin_(b), end_(e) {}
-
- explicit string_ref(std::string const& x)
- : begin_(x.begin()), end_(x.end()) {}
-
- iterator begin() const { return begin_; }
- iterator end() const { return end_; }
-
- std::size_t size() const
- {
- return static_cast<std::size_t>(end_ - begin_);
- }
- };
-
- bool operator==(string_ref const& x, string_ref const& y);
- bool operator<(string_ref const& x, string_ref const& y);
-
- inline bool operator==(string_ref const& x, std::string const& y)
- {
- return x == string_ref(y);
- }
-
- inline bool operator==(std::string const& x, string_ref const& y)
- {
- return string_ref(x) == y;
- }
-
- inline bool operator<(string_ref const& x, std::string const& y)
- {
- return x < string_ref(y);
- }
-
- inline bool operator<(std::string const& x, string_ref const& y)
- {
- return string_ref(x) < y;
- }
-
- bool operator==(string_ref const& x, string_ref const& y)
- {
- return x.size() == y.size() &&
- std::equal(x.begin(), x.end(), y.begin());
- }
-
- bool operator<(string_ref const& x, string_ref const& y)
- {
- return std::lexicographical_compare(
- x.begin(), x.end(), y.begin(), y.end());
- }
-
- //
- // id_generator
- //
-
- static const std::size_t max_size = 32;
-
- namespace
- {
- std::string normalize_id(std::string const& id)
- {
- std::string result;
-
- std::string::const_iterator it = id.begin();
- while (it != id.end()) {
- if (*it == '_') {
- do {
- ++it;
- } while(it != id.end() && *it == '_');
-
- if (it != id.end()) result += '_';
- }
- else {
- result += *it;
- ++it;
- }
- }
-
- return result;
- }
- }
-
- id_generator::id_generator()
- {
- }
-
- id_generator::~id_generator()
- {
- }
-
- id_generator::placeholder id_generator::add_placeholder(
- std::string const& value,
- id_generator::categories category)
- {
- std::string result;
-
- id_data& data = ids.emplace(boost::unordered::piecewise_construct,
- boost::make_tuple(value),
- boost::make_tuple(value, category)).first->second;
-
- // Doesn't check if explicit ids collide, could probably be a warning.
- if (category == explicit_id)
- {
- data.category = category;
- data.used = true;
- }
- else
- {
- if (category < data.category) data.category = category;
- }
-
- placeholder p(placeholders.size());
- placeholders.push_back(placeholder_id(category, &data));
-
- return p;
- }
-
- std::string id_generator::add(
- std::string const& value,
- id_generator::categories category)
- {
- std::string result;
-
- id_data& data = ids.emplace(boost::unordered::piecewise_construct,
- boost::make_tuple(value),
- boost::make_tuple(value, category)).first->second;
-
- // Doesn't check if explicit ids collide, could probably be a warning.
- if (category == explicit_id)
- {
- data.category = category;
- data.used = true;
- result = value;
- }
- else
- {
- if (category < data.category) data.category = category;
- placeholder p(placeholders.size());
- result = p.to_string();
- placeholders.push_back(placeholder_id(category, &data));
- }
-
- return result;
- }
-
- string_ref id_generator::get(string_ref value)
- {
- // If this isn't a placeholder id.
- if (value.size() <= 1 || *value.begin() != '$')
- return value;
-
- placeholder_id* placeholder = &placeholders.at(
- boost::lexical_cast<int>(std::string(
- value.begin() + 1, value.end())));
-
- if (placeholder->final_id.empty())
- {
- if (placeholder->category < id_generator::numbered &&
- !placeholder->data->used &&
- placeholder->data->category == placeholder->category)
- {
- placeholder->data->used = true;
- placeholder->final_id = placeholder->data->name;
- }
- else
- {
- generate_id(placeholder);
- }
- }
-
- return string_ref(placeholder->final_id);
- }
-
- void id_generator::generate_id(placeholder_id* placeholder)
- {
- id_data* data = placeholder->data;
-
- if (!data->generation_data)
- {
- std::string const& name = data->name;
-
- std::size_t seperator = name.rfind('.') + 1;
- data->generation_data.reset(new id_generation_data(
- std::string(name, 0, seperator),
- normalize_id(std::string(name, seperator))
- ));
-
- try_potential_id(placeholder);
- }
-
- while(!try_counted_id(placeholder)) {};
- }
-
- bool id_generator::try_potential_id(placeholder_id* placeholder)
- {
- placeholder->final_id =
- placeholder->data->generation_data->parent +
- placeholder->data->generation_data->base;
-
- // Be careful here as it's quite likely that final_id is the
- // same as the original id, so this will just find the original
- // data.
- //
- // Not caring too much about 'category' and 'used', would want to if
- // still creating ids.
- std::pair<boost::unordered_map<std::string, id_data>::iterator, bool>
- insert = ids.emplace(boost::unordered::piecewise_construct,
- boost::make_tuple(placeholder->final_id),
- boost::make_tuple(placeholder->final_id,
- placeholder->category, true));
-
- if (insert.first->second.generation_data)
- {
- placeholder->data->generation_data =
- insert.first->second.generation_data;
- }
- else
- {
- insert.first->second.generation_data =
- placeholder->data->generation_data;
- }
-
- return insert.second;
- }
-
- bool id_generator::try_counted_id(placeholder_id* placeholder)
- {
- std::string name =
- placeholder->data->generation_data->base +
- (placeholder->data->generation_data->needs_underscore ? "_" : "") +
- boost::lexical_cast<std::string>(
- placeholder->data->generation_data->count);
-
- if (name.length() > max_size)
- {
- std::size_t new_end =
- placeholder->data->generation_data->base.length() -
- (name.length() - max_size);
-
- while (new_end > 0 &&
- std::isdigit(placeholder->data->generation_data->base[new_end - 1]))
- --new_end;
-
- placeholder->data->generation_data->base.erase(new_end);
- placeholder->data->generation_data->new_base_value();
-
- // Return result of try_potential_id to use the truncated id
- // without a number.
- try_potential_id(placeholder);
- return false;
- }
-
- placeholder->final_id =
- placeholder->data->generation_data->parent + name;
-
- std::pair<boost::unordered_map<std::string, id_data>::iterator, bool>
- insert = ids.emplace(boost::unordered::piecewise_construct,
- boost::make_tuple(placeholder->final_id),
- boost::make_tuple(placeholder->final_id,
- placeholder->category, true));
-
- ++placeholder->data->generation_data->count;
-
- return insert.second;
- }
-
- id_generator::placeholder_id::placeholder_id(
- id_generator::categories category, id_data* data)
- : category(category),
- data(data),
- final_id()
- {
- if (category == explicit_id)
- final_id = data->name;
- }
-
- void id_generator::id_generation_data::new_base_value() {
- count = 0;
- needs_underscore = !base.empty() &&
- std::isdigit(base[base.length() - 1]);
- }
-
- std::string id_generator::placeholder::to_string() const {
- // '$' can't appear in quickbook ids, so use it indicate a
- // placeholder id.
- return "$" + boost::lexical_cast<std::string>(index);
- }
-
- // Very simple xml subset parser which replaces id values.
- //
- // I originally tried to integrate this into the post processor
- // but that proved tricky. Alternatively it could use a proper
- // xml parser, but I want this to be able to survive badly
- // marked up escapes.
-
- struct xml_processor
- {
- xml_processor();
-
- std::string escape_prefix;
- 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&);
- };
-
- std::string id_generator::replace_placeholders(std::string const& source)
- {
- xml_processor processor;
- return processor.replace(source, *this);
- }
-
- namespace
- {
- char const* id_attributes_[] =
- {
- "id",
- "linkend",
- "linkends",
- "arearefs"
- };
- }
-
- xml_processor::xml_processor()
- : 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)
- {
- id_attributes.push_back(id_attributes_[i]);
- }
-
- std::sort(id_attributes.begin(), id_attributes.end());
- }
-
- std::string xml_processor::replace(std::string const& source, id_generator& ids)
- {
- std::string result;
-
- typedef std::string::const_iterator iterator;
-
- // copied is the point up to which the source has been copied, or
- // replaced, to result.
- iterator copied = source.begin();
-
- 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))
- {
- it = std::search(it + escape_prefix.size(), end,
- escape_postfix.begin(), escape_postfix.end());
-
- if (it == end) break;
-
- it += escape_postfix.size();
- continue;
- }
-
- ++it;
- if (it == end) break;
-
- switch(*it)
- {
- case '?':
- it = std::search(it, end,
- processing_instruction_postfix.begin(),
- processing_instruction_postfix.end());
- break;
-
- case '!':
- if (end - it > 3 && it[1] == '-' && it[2] == '-')
- {
- it = std::search(it + 3, end,
- comment_postfix. begin(), comment_postfix.end());
- if (it != end) it += comment_postfix.size();
- }
- else
- {
- it = std::find(it, end, '>');
- }
- break;
-
- default:
- if ((*it >= 'a' && *it <= 'z') ||
- (*it >= 'A' && *it <= 'Z') ||
- *it == '_' || *it == ':')
- {
- it = std::find_first_of(
- it + 1, end, tag_end.begin(), tag_end.end());
-
- for (;;) {
- while(it != end &&
- std::find(whitespace.begin(),
- whitespace.end(), *it)
- != whitespace.end())
- ++it;
-
- iterator name_start = it;
-
- it = std::find_first_of(
- it, end, name_end.begin(), name_end.end());
-
- if (it == end || *it == '>') break;
-
- string_ref name(name_start, it);
- ++it;
-
- while (it != end &&
- std::find(attribute_assign.begin(),
- attribute_assign.end(), *it)
- != attribute_assign.end())
- ++it;
-
- if (it == end || (*it != '"' && *it != '\'')) break;
-
- char delim = *it;
- ++it;
-
- iterator value_start = it;
-
- 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)
- != id_attributes.end())
- {
- result.append(copied, value.begin());
- string_ref x = ids.get(value);
- result.append(x.begin(), x.end());
- copied = value.end();
- }
- }
- }
- else
- {
- it = std::find(it, end, '>');
- }
- }
- }
-
- result.append(copied, source.end());
- return result;
- }
-
- // section_info
-
- section_info::section_info()
- : level(0), min_level(0), doc_id(), id(), qualified_id() {}
-
- std::string section_info::set_doc_id(
- id_generator& ids,
- std::string const& new_doc_id,
- id_generator::categories category)
- {
- doc_id = new_doc_id;
- parent_placeholder = ids.add_placeholder(new_doc_id, category);
- return parent_placeholder.to_string();
- }
-
- std::string section_info::old_style_id(
- id_generator& ids,
- std::string const& id_part,
- id_generator::categories category)
- {
- return ids.add(id + '.' + id_part, category);
- }
-
- std::string section_info::fully_qualified_id(
- id_generator& ids,
- std::string const& id_part,
- id_generator::categories category)
- {
- std::string id = doc_id;
- if(!id.empty() && !qualified_id.empty()) id += '.';
- id += qualified_id;
- if(!id.empty() && !id_part.empty()) id += '.';
- id += id_part;
- return ids.add(id, category);
- }
-
- std::string section_info::begin_section(
- id_generator& ids,
- unsigned qbk_version_n,
- std::string const& id_part,
- id_generator::categories category)
- {
- id = id_part;
-
- if (level != 0)
- qualified_id += '.';
- else
- BOOST_ASSERT(qualified_id.empty());
-
- qualified_id += id;
- ++level;
-
- // TODO: This could be awkward if there's a clash, possibly
- // needs another category, between explicit and generated.
- std::string full_id = ids.add(
- qbk_version_n < 103 ?
- doc_id + "." + id :
- doc_id + "." + qualified_id,
- category);
-
- return full_id;
- }
-
- void section_info::end_section()
- {
- --level;
-
- if (level == 0)
- {
- qualified_id.clear();
- }
- else
- {
- std::string::size_type const n =
- qualified_id.find_last_of('.');
- qualified_id.erase(n, std::string::npos);
- }
- }
-
- void section_info::clear_section()
- {
- level = 0;
- min_level = 0;
- id.clear();
- qualified_id.clear();
- }
-
- void section_info::copy_section(section_info const& x)
- {
- level = x.level;
- min_level = x.min_level;
- id = x.id;
- qualified_id = x.qualified_id;
- }
-
- void swap(section_info& a, section_info& b)
- {
- boost::swap(a.level, b.level);
- boost::swap(a.min_level, b.min_level);
- boost::swap(a.doc_id, b.doc_id);
- boost::swap(a.id, b.id);
- boost::swap(a.qualified_id, b.qualified_id);
- }
-}

Deleted: branches/quickbook-dev/tools/quickbook/src/id_generator.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/id_generator.hpp 2011-11-02 03:49:22 EDT (Wed, 02 Nov 2011)
+++ (empty file)
@@ -1,157 +0,0 @@
-/*=============================================================================
- Copyright (c) 2011 Daniel James
-
- Use, modification and distribution is subject to the Boost Software
- License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt)
-=============================================================================*/
-
-#if !defined(BOOST_QUICKBOOK_ID_GENERATOR_HPP)
-#define BOOST_QUICKBOOK_ID_GENERATOR_HPP
-
-#include "fwd.hpp"
-#include <boost/unordered/unordered_map.hpp>
-#include <boost/shared_ptr.hpp>
-#include <deque>
-#include <string>
-
-namespace quickbook
-{
- struct string_ref;
-
- struct id_generator
- {
- public:
-
- enum categories
- {
- explicit_id = 0, // Explicitly given by user
- generated_doc, // Generated ids for document.
- generated_section, // Generated ids for sections.
- generated_heading, // Generated ids for headings.
- generated, // Generated ids for other elements.
- numbered, // Just used to avoid random docbook ids
- default_category
- };
-
- private:
-
- struct placeholder_id;
- struct id_data;
- struct id_generation_data;
-
- struct placeholder_id
- {
- placeholder_id(id_generator::categories, id_data*);
-
- id_generator::categories category;
- id_data* data;
- std::string final_id;
-
- };
-
- struct id_data
- {
- id_data(std::string const& name,
- id_generator::categories category,
- bool used = false)
- : name(name),
- category(category),
- used(used),
- generation_data() {}
-
- std::string name;
- id_generator::categories category;
- bool used;
- boost::shared_ptr<id_generation_data> generation_data;
- };
-
- struct id_generation_data
- {
- id_generation_data(std::string const& parent, std::string const& base)
- : parent(parent),
- base(base),
- needs_underscore(false),
- count(0)
- {
- new_base_value();
- }
-
- void new_base_value();
-
- std::string parent;
- std::string base;
- bool needs_underscore;
- int count;
- };
-
- boost::unordered_map<std::string, id_data> ids;
- std::deque<placeholder_id> placeholders;
-
- public:
- struct placeholder
- {
- private:
- int index;
- public:
- placeholder(int index = -1) : index(index) {}
- std::string to_string() const;
- bool check() const { return index != -1; }
- };
-
- id_generator();
- ~id_generator();
-
- placeholder add_placeholder(std::string const& id, categories priority);
- std::string add(std::string const& id, categories priority);
-
- std::string replace_placeholders(std::string const&);
- string_ref get(string_ref placeholder);
-
- private:
- id_generator(id_generator const&);
- id_generator& operator=(id_generator const&);
-
- void generate_id(placeholder_id*);
- bool try_potential_id(placeholder_id*);
- bool try_counted_id(placeholder_id*);
- };
-
- struct section_info
- {
- section_info();
-
- std::string set_doc_id(
- id_generator&,
- std::string const&,
- id_generator::categories);
- std::string old_style_id(
- id_generator&,
- std::string const&,
- id_generator::categories);
- std::string fully_qualified_id(
- id_generator&,
- std::string const&,
- id_generator::categories);
- std::string begin_section(
- id_generator&,
- unsigned qbk_version_n,
- std::string const&,
- id_generator::categories);
- void end_section();
- void clear_section();
- void copy_section(section_info const&);
-
- int level;
- int min_level;
- std::string doc_id;
- std::string id;
- std::string qualified_id;
- id_generator::placeholder
- parent_placeholder;
- };
-
- void swap(section_info&, section_info&);
-}
-
-#endif

Added: branches/quickbook-dev/tools/quickbook/src/id_manager.cpp
==============================================================================
--- (empty file)
+++ branches/quickbook-dev/tools/quickbook/src/id_manager.cpp 2011-11-02 03:49:22 EDT (Wed, 02 Nov 2011)
@@ -0,0 +1,1207 @@
+/*=============================================================================
+ Copyright (c) 2011 Daniel James
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+#include "id_manager.hpp"
+#include "utils.hpp"
+#include <boost/shared_ptr.hpp>
+#include <boost/unordered_map.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/range/algorithm.hpp>
+#include <boost/foreach.hpp>
+#include <deque>
+#include <vector>
+
+namespace quickbook
+{
+ //
+ // Forward declarations
+ //
+
+ struct string_ref;
+ struct id_placeholder;
+ struct id_data;
+ std::string process_ids(id_state&, std::string const&);
+
+ static const std::size_t max_size = 32;
+
+ //
+ // string_ref
+ //
+
+ struct string_ref
+ {
+ public:
+ typedef std::string::const_iterator iterator;
+
+ private:
+ iterator begin_, end_;
+
+ public:
+ string_ref() : begin_(), end_() {}
+
+ explicit string_ref(iterator b, iterator e)
+ : begin_(b), end_(e) {}
+
+ explicit string_ref(std::string const& x)
+ : begin_(x.begin()), end_(x.end()) {}
+
+ iterator begin() const { return begin_; }
+ iterator end() const { return end_; }
+
+ std::size_t size() const
+ {
+ return static_cast<std::size_t>(end_ - begin_);
+ }
+
+ std::string to_string() const
+ {
+ return std::string(begin_, end_);
+ }
+ };
+
+ bool operator==(string_ref const& x, string_ref const& y);
+ bool operator<(string_ref const& x, string_ref const& y);
+
+ inline bool operator==(string_ref const& x, std::string const& y)
+ {
+ return x == string_ref(y);
+ }
+
+ inline bool operator==(std::string const& x, string_ref const& y)
+ {
+ return string_ref(x) == y;
+ }
+
+ inline bool operator<(string_ref const& x, std::string const& y)
+ {
+ return x < string_ref(y);
+ }
+
+ inline bool operator<(std::string const& x, string_ref const& y)
+ {
+ return string_ref(x) < y;
+ }
+
+ bool operator==(string_ref const& x, string_ref const& y)
+ {
+ return x.size() == y.size() &&
+ std::equal(x.begin(), x.end(), y.begin());
+ }
+
+ bool operator<(string_ref const& x, string_ref const& y)
+ {
+ return std::lexicographical_compare(
+ x.begin(), x.end(), y.begin(), y.end());
+ }
+
+ //
+ // id_placeholder
+ //
+
+ struct id_placeholder
+ {
+ enum state_enum { child, unresolved, resolved, generated };
+
+ unsigned index; // The poisition in the placeholder deque.
+ state_enum state; // Placeholder's position in generation
+ // process.
+ std::string id; // The id so far.
+ id_placeholder* parent; // Placeholder of the parent id.
+ // Only when state == child
+ id_category category;
+ unsigned level; // Level in the document.
+ // 0 = doc_id
+ // 1 = id directly in doc_id or
+ // first level of section.
+ unsigned order; // Order of the placeholders in the generated
+ // xml. Stored because it can be slightly
+ // different to the order they're generated
+ // in. e.g. for nested tables the cells
+ // are processed before the title id.
+ // Only set when processing ids.
+ id_data* data; // Assigned data shared by duplicate ids
+ // used to detect them. Only when
+ // state == resolved
+
+ id_placeholder(
+ unsigned index,
+ std::string const& id,
+ id_category category,
+ id_placeholder* parent_ = 0)
+ : index(index),
+ state(parent_ ? child : unresolved),
+ id(id),
+ parent(parent_),
+ category(category),
+ level(boost::range::count(id, '.') +
+ (parent_ ? parent_->level + 1 : 0)),
+ order(0),
+ data(0)
+ {
+ }
+
+ std::string to_string()
+ {
+ return '$' + boost::lexical_cast<std::string>(index);
+ }
+
+ bool check_state() const
+ {
+ return (
+ (state == child) == (bool) parent &&
+ (state == resolved) == (bool) data);
+ }
+
+ bool check_state(state_enum s) const
+ {
+ return s == state && check_state();
+ }
+ };
+
+ //
+ // id_state
+ //
+
+ struct id_state
+ {
+ std::deque<id_placeholder> placeholders;
+
+ id_placeholder* add_placeholder(
+ std::string const&, id_category, id_placeholder* parent = 0);
+
+ id_placeholder* get_placeholder(string_ref);
+ };
+
+ id_placeholder* id_state::add_placeholder(
+ std::string const& id, id_category category,
+ id_placeholder* parent)
+ {
+ placeholders.push_back(id_placeholder(
+ placeholders.size(), id, category, parent));
+ return &placeholders.back();
+ }
+
+ id_placeholder* id_state::get_placeholder(string_ref value)
+ {
+ // If this isn't a placeholder id.
+ if (value.size() <= 1 || *value.begin() != '$')
+ return 0;
+
+ unsigned index = boost::lexical_cast<int>(std::string(
+ value.begin() + 1, value.end()));
+
+ return &placeholders.at(index);
+ }
+
+ //
+ // section_manager
+ //
+
+ struct section_manager
+ {
+ section_manager(
+ id_state& ids,
+ unsigned qbk_version)
+ : ids(ids),
+ qbk_version(qbk_version),
+ level(0)
+ {}
+
+ virtual ~section_manager() {
+ assert(level <= 1);
+ }
+
+ virtual std::auto_ptr<section_manager> start_file(
+ bool have_docinfo,
+ unsigned qbk_version,
+ std::string const& include_doc_id,
+ std::string const& id,
+ std::string const& title,
+ std::string* doc_id_result,
+ std::string* placeholder) = 0;
+
+ virtual std::string docinfo(
+ std::string const& id = std::string(),
+ id_category = id_category()) = 0;
+
+ virtual bool end_file() = 0;
+
+ virtual std::string add_id(
+ std::string const&,
+ id_category) = 0;
+
+ virtual std::string old_style_id(
+ std::string const&,
+ id_category) = 0;
+
+ virtual std::string begin_section(
+ std::string const&,
+ id_category) = 0;
+
+ virtual void end_section() = 0;
+
+ id_state& ids;
+ unsigned qbk_version;
+ int level;
+ boost::scoped_ptr<section_manager> parent;
+ };
+
+ //
+ // id_manager implementation
+ //
+
+ namespace {
+ std::auto_ptr<section_manager> create_section_manager(
+ id_state& ids,
+ unsigned qbk_version);
+ }
+
+ id_manager::id_manager()
+ : state(new id_state),
+ current_section(create_section_manager(*state, 0))
+ {
+ }
+
+ id_manager::~id_manager() {}
+
+ void id_manager::start_file(
+ std::string const& include_doc_id,
+ std::string const& id,
+ std::string const& title)
+ {
+ boost::scoped_ptr<section_manager> new_section(
+ current_section->start_file(false, current_section->qbk_version,
+ include_doc_id, id, title, 0, 0));
+
+ if (new_section) {
+ boost::swap(current_section, new_section->parent);
+ boost::swap(current_section, new_section);
+ }
+ }
+
+ id_manager::start_file_info id_manager::start_file_with_docinfo(
+ unsigned qbk_version,
+ std::string const& include_doc_id,
+ std::string const& id,
+ std::string const& title)
+ {
+ start_file_info result;
+
+ boost::scoped_ptr<section_manager> new_section(
+ current_section->start_file(true, qbk_version,
+ include_doc_id, id, title,
+ &result.doc_id, &result.placeholder));
+
+ if (new_section) {
+ boost::swap(current_section, new_section->parent);
+ boost::swap(current_section, new_section);
+ }
+
+ return result;
+ }
+
+ void id_manager::end_file()
+ {
+ if (current_section->end_file()) {
+ boost::scoped_ptr<section_manager> old_section;
+ boost::swap(current_section, old_section);
+ boost::swap(current_section, old_section->parent);
+ }
+ }
+
+ std::string id_manager::begin_section(std::string const& id, id_category category)
+ {
+ // Shouldn't begin_section without calling docinfo first.
+ assert(current_section->level > 0);
+ return current_section->begin_section(id, category);
+ }
+
+ void id_manager::end_section()
+ {
+ assert(current_section->level > 1);
+ return current_section->end_section();
+ }
+
+ int id_manager::section_level() const
+ {
+ return current_section->level;
+ }
+
+ std::string id_manager::old_style_id(std::string const& id, id_category category)
+ {
+ return current_section->old_style_id(id, category);
+ }
+
+ std::string id_manager::add_id(std::string const& id, id_category category)
+ {
+ return current_section->add_id(id, category);
+ }
+
+ std::string id_manager::add_anchor(std::string const& id, id_category category)
+ {
+ return state->add_placeholder(id, category)->to_string();
+ }
+
+ std::string id_manager::replace_placeholders(std::string const& xml) const
+ {
+ assert(current_section && !current_section->parent);
+ return process_ids(*state, xml);
+ }
+
+ //
+ // normalize_id
+ //
+ // Normalizes generated ids.
+ //
+
+ namespace
+ {
+ std::string normalize_id(
+ std::string src_id,
+ std::size_t prefix = 0,
+ std::size_t size = max_size)
+ {
+ std::string id;
+ id.swap(src_id);
+
+ std::size_t src = prefix;
+ std::size_t dst = prefix;
+ size += prefix;
+
+ while (src < id.length() && dst < size) {
+ if (id[src] == '_') {
+ do {
+ ++src;
+ } while(src < id.length() && id[src] == '_');
+
+ if (src < id.length()) id[dst++] = '_';
+ }
+ else {
+ id[dst++] = id[src++];
+ }
+ }
+
+ id.erase(dst);
+
+ return id;
+ }
+ }
+
+ //
+ // section_manager_1_1
+ //
+ // Handles sections for quickbook 1.1 to 1.5
+ //
+
+ struct section_manager_1_1 : section_manager
+ {
+ section_manager_1_1(
+ id_state& ids,
+ unsigned qbk_version)
+ : section_manager(ids, qbk_version),
+ doc_id(),
+ section_id(),
+ qualified_id()
+ {}
+
+ virtual std::auto_ptr<section_manager> start_file(
+ bool have_docinfo,
+ unsigned qbk_version,
+ std::string const& include_doc_id,
+ std::string const& id,
+ std::string const& title,
+ std::string* doc_id_result,
+ std::string* placeholder);
+
+ virtual std::string docinfo(
+ std::string const& id,
+ id_category);
+
+ virtual bool end_file();
+
+ virtual std::string add_id(
+ std::string const&,
+ id_category);
+
+ virtual std::string old_style_id(
+ std::string const&,
+ id_category);
+
+ virtual std::string begin_section(
+ std::string const&,
+ id_category);
+
+ virtual void end_section();
+
+ std::string doc_id;
+ std::string section_id;
+ std::string qualified_id;
+ std::vector<std::string> doc_id_stack;
+ };
+
+ std::auto_ptr<section_manager> section_manager_1_1::start_file(
+ bool have_docinfo,
+ unsigned qbk_version,
+ std::string const& include_doc_id,
+ std::string const& id,
+ std::string const& title,
+ std::string* doc_id_result,
+ std::string* placeholder)
+ {
+ std::string initial_doc_id =
+ !id.empty() ? id :
+ !include_doc_id.empty() ? include_doc_id :
+ detail::make_identifier(title);
+
+ id_category category =
+ !id.empty() || !include_doc_id.empty() ?
+ id_category::explicit_id :
+ id_category::generated_doc;
+
+ if (doc_id_result) *doc_id_result = initial_doc_id;
+
+ if (have_docinfo) {
+ std::auto_ptr<section_manager> new_section_manager =
+ create_section_manager(ids, qbk_version);
+ std::string initial_placeholder = new_section_manager->docinfo(
+ initial_doc_id, category);
+ if (placeholder) *placeholder = initial_placeholder;
+ return new_section_manager;
+ }
+ else {
+ doc_id_stack.push_back(doc_id);
+ doc_id = initial_doc_id;
+ if (placeholder) *placeholder = "";
+ return std::auto_ptr<section_manager>();
+ }
+ }
+
+ std::string section_manager_1_1::docinfo(
+ std::string const& id,
+ id_category category)
+ {
+ doc_id = id;
+ ++level;
+ return ids.add_placeholder(id, category)->to_string();
+ }
+
+ bool section_manager_1_1::end_file()
+ {
+ // If there are not stacked doc_ids then this is the end
+ // of the document.
+ if (doc_id_stack.empty()) return true;
+
+ doc_id = doc_id_stack.back();
+ doc_id_stack.pop_back();
+ return false;
+ }
+
+ std::string section_manager_1_1::add_id(
+ std::string const& id,
+ id_category category)
+ {
+ std::string new_id = doc_id;
+ if (!new_id.empty() && !qualified_id.empty()) new_id += '.';
+ new_id += qualified_id;
+ if (!new_id.empty() && !id.empty()) new_id += '.';
+ new_id += id;
+ return ids.add_placeholder(new_id, category)->to_string();
+ }
+
+ std::string section_manager_1_1::old_style_id(
+ std::string const& id,
+ id_category category)
+ {
+ return qbk_version < 103 ?
+ ids.add_placeholder(section_id + "." + id, category)->to_string() :
+ add_id(id, category);
+ }
+
+ std::string section_manager_1_1::begin_section(
+ std::string const& id,
+ id_category category)
+ {
+ if (level > 1) qualified_id += '.';
+ qualified_id += id;
+ section_id = id;
+ ++level;
+ return (qbk_version < 103u ?
+ ids.add_placeholder(doc_id + "." + id, category) :
+ ids.add_placeholder(doc_id + "." + qualified_id, category))->to_string();
+ }
+
+ void section_manager_1_1::end_section()
+ {
+ // Note: This doesn't change section_id here - in order to
+ // be bug compatible with early versions of quickbook.
+
+ --level;
+ if (level == 1)
+ {
+ qualified_id.clear();
+ }
+ else
+ {
+ std::string::size_type const n =
+ qualified_id.find_last_of('.');
+ qualified_id.erase(n, std::string::npos);
+ }
+ }
+
+ //
+ // section_manager_1_6
+ //
+ // Handles sections for quickbook 1.6+
+ //
+
+ struct section_manager_1_6 : section_manager
+ {
+ section_manager_1_6(
+ id_state& ids,
+ unsigned qbk_version)
+ : section_manager(ids, qbk_version),
+ current_placeholder(0),
+ depth(0)
+ {}
+
+ virtual std::auto_ptr<section_manager> start_file(
+ bool have_docinfo,
+ unsigned qbk_version,
+ std::string const& include_doc_id,
+ std::string const& id,
+ std::string const& title,
+ std::string* doc_id_result,
+ std::string* placeholder);
+
+ virtual std::string docinfo(
+ std::string const& id,
+ id_category);
+
+ virtual bool end_file();
+
+ virtual std::string add_id(
+ std::string const&,
+ id_category);
+
+ virtual std::string old_style_id(
+ std::string const&,
+ id_category);
+
+ virtual std::string begin_section(
+ std::string const&,
+ id_category);
+
+ virtual void end_section();
+
+ id_placeholder* current_placeholder;
+ unsigned depth;
+ };
+
+ std::auto_ptr<section_manager> section_manager_1_6::start_file(
+ bool have_docinfo,
+ unsigned qbk_version,
+ std::string const& include_doc_id,
+ std::string const& id,
+ std::string const& title,
+ std::string* doc_id_result,
+ std::string* placeholder)
+ {
+ if (have_docinfo || !include_doc_id.empty()) {
+ std::string initial_doc_id =
+ !include_doc_id.empty() ? include_doc_id :
+ !id.empty() ? id :
+ detail::make_identifier(title);
+
+ id_category category =
+ !include_doc_id.empty() || !id.empty() ?
+ id_category::explicit_id :
+ id_category::generated_doc;
+
+ if (doc_id_result) *doc_id_result = initial_doc_id;
+
+ std::auto_ptr<section_manager> new_section_manager =
+ create_section_manager(ids, qbk_version);
+ std::string initial_placeholder = new_section_manager->docinfo(
+ initial_doc_id, category);
+ if (placeholder) *placeholder = initial_placeholder;
+ return new_section_manager;
+ }
+ else {
+ ++depth;
+ if (doc_id_result) *doc_id_result = "";
+ if (placeholder) *placeholder = "";
+ return std::auto_ptr<section_manager>();
+ }
+ }
+
+ std::string section_manager_1_6::docinfo(
+ std::string const& id,
+ id_category category)
+ {
+ return begin_section(id, category);
+ }
+
+ bool section_manager_1_6::end_file()
+ {
+ if (depth == 0) {
+ end_section();
+ assert(!current_placeholder);
+ return true;
+ }
+ else {
+ --depth;
+ return false;
+ }
+ }
+
+ std::string section_manager_1_6::add_id(
+ std::string const& id,
+ id_category category)
+ {
+ return ids.add_placeholder(
+ category.c == id_category::explicit_id ? id : normalize_id(id),
+ category, current_placeholder)->to_string();
+ }
+
+ std::string section_manager_1_6::old_style_id(
+ std::string const& id,
+ id_category category)
+ {
+ return add_id(id, category);
+ }
+
+ std::string section_manager_1_6::begin_section(
+ std::string const& id,
+ id_category category)
+ {
+ ++level;
+
+ current_placeholder = ids.add_placeholder(
+ category.c == id_category::explicit_id ? id : normalize_id(id),
+ category, current_placeholder);
+
+ return current_placeholder->to_string();
+ }
+
+ void section_manager_1_6::end_section()
+ {
+ --level;
+ current_placeholder = current_placeholder->parent;
+ }
+
+ //
+ // create_section_manager
+ //
+
+ namespace {
+ std::auto_ptr<section_manager> create_section_manager(
+ id_state& ids,
+ unsigned qbk_version)
+ {
+ return std::auto_ptr<section_manager>(qbk_version < 106u ?
+ (section_manager*)(new section_manager_1_1(ids, qbk_version)) :
+ (section_manager*)(new section_manager_1_6(ids, qbk_version)));
+ }
+ }
+
+ //
+ // Xml subset parser used for finding id values.
+ //
+ // I originally tried to integrate this into the post processor
+ // but that proved tricky. Alternatively it could use a proper
+ // xml parser, but I want this to be able to survive badly
+ // marked up escapes.
+ //
+
+ struct xml_processor
+ {
+ xml_processor();
+
+ std::vector<std::string> id_attributes;
+
+ struct callback {
+ virtual void start(string_ref) {}
+ virtual void id_value(string_ref) {}
+ virtual void finish(string_ref) {}
+ virtual ~callback() {}
+ };
+
+ void parse(std::string const&, callback&);
+ };
+
+ namespace
+ {
+ char const* id_attributes_[] =
+ {
+ "id",
+ "linkend",
+ "linkends",
+ "arearefs"
+ };
+ }
+
+ xml_processor::xml_processor()
+ {
+ static int const n_id_attributes = sizeof(id_attributes_)/sizeof(char const*);
+ for (int i = 0; i != n_id_attributes; ++i)
+ {
+ id_attributes.push_back(id_attributes_[i]);
+ }
+
+ boost::sort(id_attributes);
+ }
+
+ template <typename Iterator>
+ bool read(Iterator& it, Iterator end, char const* text)
+ {
+ for(Iterator it2 = it;; ++it2, ++text) {
+ if (!*text) {
+ it = it2;
+ return true;
+ }
+
+ if (it2 == end || *it2 != *text)
+ return false;
+ }
+ }
+
+ template <typename Iterator>
+ void read_past(Iterator& it, Iterator end, char const* text)
+ {
+ while (it != end && !read(it, end, text)) ++it;
+ }
+
+ bool find_char(char const* text, char c)
+ {
+ for(;*text; ++text)
+ if (c == *text) return true;
+ return false;
+ }
+
+ template <typename Iterator>
+ void read_some_of(Iterator& it, Iterator end, char const* text)
+ {
+ while(it != end && find_char(text, *it)) ++it;
+ }
+
+ template <typename Iterator>
+ void read_to_one_of(Iterator& it, Iterator end, char const* text)
+ {
+ while(it != end && !find_char(text, *it)) ++it;
+ }
+
+ void xml_processor::parse(std::string const& source, callback& c)
+ {
+ typedef std::string::const_iterator iterator;
+
+ string_ref source_ref(source.begin(), source.end());
+ c.start(source_ref);
+
+ iterator it = source_ref.begin(), end = source_ref.end();
+
+ for(;;)
+ {
+ read_past(it, end, "<");
+ if (it == end) break;
+
+ if (read(it, end, "!--quickbook-escape-prefix-->"))
+ {
+ read_past(it, end, "<!--quickbook-escape-postfix-->");
+ continue;
+ }
+
+ switch(*it)
+ {
+ case '?':
+ ++it;
+ read_past(it, end, "?>");
+ break;
+
+ case '!':
+ if (read(it, end, "!--"))
+ read_past(it, end, "-->");
+ else
+ read_past(it, end, ">");
+ break;
+
+ default:
+ if ((*it >= 'a' && *it <= 'z') ||
+ (*it >= 'A' && *it <= 'Z') ||
+ *it == '_' || *it == ':')
+ {
+ read_to_one_of(it, end, " \t\n\r>");
+
+ for (;;) {
+ read_some_of(it, end, " \t\n\r");
+ iterator name_start = it;
+ read_to_one_of(it, end, "= \t\n\r>");
+ if (it == end || *it == '>') break;
+ string_ref name(name_start, it);
+ ++it;
+
+ read_some_of(it, end, "= \t\n\r");
+ if (it == end || (*it != '"' && *it != '\'')) break;
+
+ char delim = *it;
+ ++it;
+
+ iterator value_start = it;
+
+ it = std::find(it, end, delim);
+ if (it == end) break;
+ string_ref value(value_start, it);
+ ++it;
+
+ if (boost::find(id_attributes, name)
+ != id_attributes.end())
+ {
+ c.id_value(value);
+ }
+ }
+ }
+ else
+ {
+ read_past(it, end, ">");
+ }
+ }
+ }
+
+ c.finish(source_ref);
+ }
+
+ //
+ // process_ids
+ //
+
+ typedef boost::unordered_map<std::string, id_data> allocated_ids;
+ typedef std::vector<id_placeholder*> placeholder_index;
+
+ placeholder_index index_placeholders(id_state&, std::string const& xml);
+ void resolve_id(id_placeholder&, allocated_ids&);
+ void generate_id(id_placeholder&, allocated_ids&);
+ std::string replace_ids(id_state& state, std::string const& xml);
+
+ std::string process_ids(id_state& state, std::string const& xml)
+ {
+ placeholder_index placeholders = index_placeholders(state, xml);
+
+ typedef std::vector<id_placeholder*>::iterator iterator;
+
+ iterator it = placeholders.begin(),
+ end = placeholders.end();
+
+ // Placeholder ids are processed in blocks of ids with
+ // an equal level.
+ while (it != end) {
+ unsigned level = (*it)->level;
+
+ // ids can't clash with ids at a different level, so
+ // this only needs to track the id generation data
+ // for a single level at a time.
+ allocated_ids ids;
+
+ iterator it2 = it;
+ do {
+ resolve_id(**it2++, ids);
+ } while(it2 != end && (*it2)->level == level);
+
+ do {
+ generate_id(**it++, ids);
+ } while(it != it2);
+ }
+
+ return replace_ids(state, xml);
+ }
+
+ //
+ // index_placeholders
+ //
+ // Create a sorted index of the placeholders, in ordered
+ // to make numbering duplicates easy.
+ //
+
+ struct placeholder_compare
+ {
+ bool operator()(id_placeholder* x, id_placeholder* y) const
+ {
+ bool x_explicit = x->category.c == id_category::explicit_id;
+ bool y_explicit = y->category.c == id_category::explicit_id;
+
+ return
+ x->level < y->level ? true :
+ x->level > y->level ? false :
+ x_explicit > y_explicit ? true :
+ x_explicit < y_explicit ? false :
+ x->order < y->order;
+ }
+ };
+
+ struct number_placeholders_callback : xml_processor::callback
+ {
+ id_state& ids;
+ unsigned count;
+
+ number_placeholders_callback(id_state& ids)
+ : ids(ids),
+ count(0)
+ {}
+
+ void id_value(string_ref value)
+ {
+ id_placeholder* p = ids.get_placeholder(value);
+ number(p);
+ }
+
+ void number(id_placeholder* p)
+ {
+ if (p && !p->order) {
+ number(p->parent);
+ p->order = ++count;
+ }
+ }
+ };
+
+ placeholder_index index_placeholders(
+ id_state& state,
+ std::string const& xml)
+ {
+ xml_processor processor;
+ number_placeholders_callback callback(state);
+ processor.parse(xml, callback);
+
+ placeholder_index sorted_placeholders;
+ sorted_placeholders.reserve(state.placeholders.size());
+ BOOST_FOREACH(id_placeholder& p, state.placeholders)
+ if (p.order) sorted_placeholders.push_back(&p);
+ boost::sort(sorted_placeholders, placeholder_compare());
+
+ return sorted_placeholders;
+ }
+
+ //
+ // Data used for generating placeholders that have duplicates.
+ //
+
+ struct id_generation_data
+ {
+ id_generation_data(std::string const& src_id)
+ : child_start(src_id.rfind('.') + 1),
+ id(normalize_id(src_id, child_start, max_size - 1)),
+ // 'max_size - 1' leaves a character to append
+ // a number.
+ count(0)
+ {
+ if (std::isdigit(id[id.length() - 1]))
+ {
+ if (child_length() < max_size - 1)
+ id += '_';
+ else
+ reduce_id();
+ }
+ }
+
+ void reduce_id()
+ {
+ assert(id.length() > child_start);
+ std::size_t length = id.length() - 1;
+ while(length > child_start && std::isdigit(id[length - 1])) --length;
+ id.erase(length);
+ count = 0;
+ }
+
+ std::size_t child_length() const
+ {
+ return id.length() - child_start;
+ }
+
+ std::size_t child_start;
+ std::string id;
+ int count;
+ };
+
+ // Created for all desired ids, either when resolving an id or due to
+ // generating a new id to avoid duplicates.
+ struct id_data
+ {
+ id_data()
+ : category(id_category::numbered),
+ used(false),
+ generation_data()
+ {}
+
+ void update_category(id_category c)
+ {
+ if (c.c > category.c) category = c;
+ }
+
+ id_category category; // The highest priority category of the
+ // placeholders that want to use this id.
+ bool used; // Whether this id has been used.
+ boost::shared_ptr<id_generation_data> generation_data;
+ // If a duplicates are found, this is
+ // created to generate new ids.
+ //
+ // Many to one relationship, because truncation
+ // can lead to different ids contending for the
+ // same id prefix.
+ };
+
+ //
+ // resolve_id
+ //
+ // Convert child ids to full ids, and add to the
+ // allocated ids (although not yet set in stone because
+ // there might be duplicates).
+ //
+ // Note that the parent ids has to be generated before resolving
+ // the child id.
+ //
+
+ void resolve_id(id_placeholder& p, allocated_ids& ids)
+ {
+ if (p.state == id_placeholder::child)
+ {
+ assert(p.check_state());
+ assert(p.parent->check_state(id_placeholder::generated));
+
+ p.id = p.parent->id + "." + p.id;
+ p.state = id_placeholder::unresolved;
+ p.parent = 0;
+ }
+
+ assert(p.check_state(id_placeholder::unresolved));
+
+ id_data& data = ids.emplace(p.id, id_data()).first->second;
+ data.update_category(p.category);
+
+ p.data = &data;
+ p.state = id_placeholder::resolved;
+ }
+
+ //
+ // generate_id
+ //
+ // Finally generate the final id.
+ //
+
+ void register_generation_data(id_placeholder&, allocated_ids&);
+
+ void generate_id(id_placeholder& p, allocated_ids& ids)
+ {
+ assert(p.check_state(id_placeholder::resolved));
+
+ // If the placeholder id is available, then update data
+ // and return.
+ if (p.category == p.data->category && !p.data->used &&
+ p.category.c != id_category::numbered)
+ {
+ p.data->used = true;
+ p.state = id_placeholder::generated;
+ p.data = 0;
+ return;
+ }
+
+ if (!p.data->generation_data)
+ {
+ p.data->generation_data.reset(new id_generation_data(p.id));
+ register_generation_data(p, ids);
+ }
+
+ // Loop until an available id is found.
+ for(;;)
+ {
+ id_generation_data& generation_data = *p.data->generation_data;
+
+ std::string postfix =
+ boost::lexical_cast<std::string>(generation_data.count++);
+
+ if (generation_data.child_length() + postfix.length() > max_size) {
+ // The resulting id is too long, so move to a shorter id.
+ generation_data.reduce_id();
+ register_generation_data(p, ids);
+ }
+ else {
+ std::string id = generation_data.id + postfix;
+
+ if (ids.find(id) == ids.end()) {
+ p.id.swap(id);
+ p.state = id_placeholder::generated;
+ p.data = 0;
+ return;
+ }
+ }
+ }
+ }
+
+ // Every time the generation id is changed, this is called to
+ // check if that id is already in use.
+ void register_generation_data(id_placeholder& p, allocated_ids& ids)
+ {
+ std::string const& id = p.data->generation_data->id;
+
+ id_data& new_data = ids.emplace(id, id_data()).first->second;
+
+ // If there is already generation_data for the new id then use that.
+ // Otherwise use the placeholder's existing generation_data.
+ if (new_data.generation_data)
+ p.data->generation_data = new_data.generation_data;
+ else
+ new_data.generation_data = p.data->generation_data;
+ }
+
+ //
+ // replace_ids
+ //
+ // Return a copy of the xml with all the placeholders replaced by
+ // generated_ids.
+ //
+
+ struct replace_ids_callback : xml_processor::callback
+ {
+ id_state& ids;
+ std::string::const_iterator source_pos;
+ std::string result;
+
+ replace_ids_callback(id_state& ids)
+ : ids(ids),
+ source_pos(),
+ result()
+ {}
+
+ void start(string_ref xml)
+ {
+ source_pos = xml.begin();
+ }
+
+ void id_value(string_ref value)
+ {
+ if (id_placeholder* p = ids.get_placeholder(value))
+ {
+ assert(p->check_state(id_placeholder::generated));
+
+ result.append(source_pos, value.begin());
+ result.append(p->id.begin(), p->id.end());
+ source_pos = value.end();
+ }
+ }
+
+ void finish(string_ref xml)
+ {
+ result.append(source_pos, xml.end());
+ source_pos = xml.end();
+ }
+ };
+
+ std::string replace_ids(id_state& state, std::string const& xml)
+ {
+ xml_processor processor;
+ replace_ids_callback callback(state);
+ processor.parse(xml, callback);
+ return callback.result;
+ }
+}

Added: branches/quickbook-dev/tools/quickbook/src/id_manager.hpp
==============================================================================
--- (empty file)
+++ branches/quickbook-dev/tools/quickbook/src/id_manager.hpp 2011-11-02 03:49:22 EDT (Wed, 02 Nov 2011)
@@ -0,0 +1,84 @@
+/*=============================================================================
+ Copyright (c) 2011 Daniel James
+
+ Use, modification and distribution is subject to the Boost Software
+ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+#if !defined(BOOST_QUICKBOOK_ID_MANAGER_HPP)
+#define BOOST_QUICKBOOK_ID_MANAGER_HPP
+
+#include <boost/scoped_ptr.hpp>
+#include <string>
+
+namespace quickbook
+{
+ // id_category
+ //
+ // Higher categories get priority over lower ones.
+
+ struct id_category
+ {
+ enum categories
+ {
+ default_category = 0,
+ numbered, // Just used to avoid random docbook ids
+ generated, // Generated ids for other elements.
+ generated_heading, // Generated ids for headings.
+ generated_section, // Generated ids for sections.
+ generated_doc, // Generated ids for document.
+ explicit_id // Explicitly given by user
+ };
+
+ id_category() : c(default_category) {}
+ id_category(categories c) : c(c) {}
+ explicit id_category(int c) : c(categories(c)) {}
+
+ bool operator==(id_category rhs) const { return c == rhs.c; }
+
+ categories c;
+ };
+
+ struct id_state;
+ struct section_manager;
+
+ struct id_manager
+ {
+ id_manager();
+ ~id_manager();
+
+ struct start_file_info {
+ std::string doc_id;
+ std::string placeholder;
+ };
+
+ start_file_info start_file_with_docinfo(
+ unsigned qbk_version,
+ std::string const& include_doc_id,
+ std::string const& id,
+ std::string const& title);
+
+ void start_file(
+ std::string const& include_doc_id,
+ std::string const& id,
+ std::string const& title);
+
+ void end_file();
+
+ std::string begin_section(std::string const&, id_category);
+ void end_section();
+ int section_level() const;
+
+ std::string old_style_id(std::string const&, id_category);
+ std::string add_id(std::string const&, id_category);
+ std::string add_anchor(std::string const&, id_category);
+
+ std::string replace_placeholders(std::string const&) const;
+ private:
+ boost::scoped_ptr<id_state> state;
+ boost::scoped_ptr<section_manager> current_section;
+ };
+}
+
+#endif

Modified: branches/quickbook-dev/tools/quickbook/src/quickbook.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/quickbook.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/quickbook.cpp 2011-11-02 03:49:22 EDT (Wed, 02 Nov 2011)
@@ -13,7 +13,7 @@
 #include "post_process.hpp"
 #include "utils.hpp"
 #include "input_path.hpp"
-#include "id_generator.hpp"
+#include "id_manager.hpp"
 #include <boost/program_options.hpp>
 #include <boost/filesystem/v3/path.hpp>
 #include <boost/filesystem/v3/operations.hpp>
@@ -95,13 +95,6 @@
         
         if (!info.hit) actor.source_mode = saved_source_mode;
 
- section_info section;
- section_info* saved_section = &section;
- boost::swap(saved_section, actor.section);
-
- if (saved_section) section = *saved_section;
- if (docinfo_type) section.clear_section();
-
         if (info.hit || !docinfo_type)
         {
             pre(actor.out, actor, include_doc_id, docinfo_type);
@@ -113,11 +106,6 @@
             }
         }
 
- // If this is not a nested document then we want to keep
- // the current section state.
- if (!docinfo_type) saved_section->copy_section(section);
- boost::swap(saved_section, actor.section);
-
         if (!info.full)
         {
             file_position const& pos = info.stop.get_position();
@@ -158,7 +146,7 @@
       , bool pretty_print)
     {
         string_stream buffer;
- id_generator ids;
+ id_manager ids;
         actions actor(filein_, xinclude_base_, buffer, ids);
         set_macros(actor);
 

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

Modified: branches/quickbook-dev/tools/quickbook/test/doc-info/source-mode-1.6.gold
==============================================================================
--- branches/quickbook-dev/tools/quickbook/test/doc-info/source-mode-1.6.gold (original)
+++ branches/quickbook-dev/tools/quickbook/test/doc-info/source-mode-1.6.gold 2011-11-02 03:49:22 EDT (Wed, 02 Nov 2011)
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE article PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
-<article id="c___test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
+<article id="c_test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>C++ test</title>
   <articleinfo>
- <legalnotice id="c___test.legal">
+ <legalnotice id="c_test.legal">
       <para>
         <code><phrase role="keyword">def</phrase> <phrase role="identifier">foo</phrase><phrase
         role="special">(</phrase><phrase role="identifier">x</phrase><phrase role="special">):</phrase>

Modified: branches/quickbook-dev/tools/quickbook/test/heading-1_6.gold
==============================================================================
--- branches/quickbook-dev/tools/quickbook/test/heading-1_6.gold (original)
+++ branches/quickbook-dev/tools/quickbook/test/heading-1_6.gold 2011-11-02 03:49:22 EDT (Wed, 02 Nov 2011)
@@ -32,11 +32,11 @@
     6</link>
   </bridgehead>
   <bridgehead renderas="sect1" id="heading_test_1_6.h9">
- <phrase id="heading_test_1_6._bold_"/><link linkend="heading_test_1_6._bold_"><emphasis
+ <phrase id="heading_test_1_6._bold"/><link linkend="heading_test_1_6._bold"><emphasis
     role="bold">Bold</emphasis></link>
   </bridgehead>
   <bridgehead renderas="sect1" id="heading_test_1_6.h10">
- <phrase id="heading_test_1_6.comment___"/><link linkend="heading_test_1_6.comment___">Comment</link>
+ <phrase id="heading_test_1_6.comment"/><link linkend="heading_test_1_6.comment">Comment</link>
   </bridgehead>
   <bridgehead renderas="sect1" id="heading_test_1_6.h11">
     <phrase id="heading_test_1_6.h1"/><link linkend="heading_test_1_6.h1">H1</link>
@@ -71,28 +71,28 @@
   <bridgehead renderas="sect1" id="heading_test_1_6.h13">
     <phrase id="heading_test_1_6.a1"/><link linkend="heading_test_1_6.a1">H1</link>
   </bridgehead>
- <section id="heading_test_1_6.s1">
- <title><link linkend="heading_test_1_6.s1">S1</link></title>
- <bridgehead renderas="sect2" id="heading_test_1_6.s1.h5">
- <phrase id="heading_test_1_6.s1.a2"/><link linkend="heading_test_1_6.s1.a2">H2</link>
- </bridgehead>
- <section id="heading_test_1_6.s1.s2">
- <title><link linkend="heading_test_1_6.s1.s2">S2</link></title>
- <bridgehead renderas="sect3" id="heading_test_1_6.s1.s2.h1">
- <phrase id="heading_test_1_6.s1.s2.a3"/><link linkend="heading_test_1_6.s1.s2.a3">H3</link>
+ <section id="heading_test_1_6.s1_0">
+ <title><link linkend="heading_test_1_6.s1_0">S1</link></title>
+ <bridgehead renderas="sect2" id="heading_test_1_6.s1_0.h0">
+ <phrase id="heading_test_1_6.s1_0.a2"/><link linkend="heading_test_1_6.s1_0.a2">H2</link>
+ </bridgehead>
+ <section id="heading_test_1_6.s1_0.s2">
+ <title><link linkend="heading_test_1_6.s1_0.s2">S2</link></title>
+ <bridgehead renderas="sect3" id="heading_test_1_6.s1_0.s2.h0">
+ <phrase id="heading_test_1_6.s1_0.s2.a3"/><link linkend="heading_test_1_6.s1_0.s2.a3">H3</link>
       </bridgehead>
     </section>
- <bridgehead renderas="sect2" id="heading_test_1_6.s1.h7">
- <phrase id="heading_test_1_6.s1.a4"/><link linkend="heading_test_1_6.s1.a4">H4</link>
+ <bridgehead renderas="sect2" id="heading_test_1_6.s1_0.h1">
+ <phrase id="heading_test_1_6.s1_0.a4"/><link linkend="heading_test_1_6.s1_0.a4">H4</link>
     </bridgehead>
- <section id="heading_test_1_6.s1.s3">
- <title><link linkend="heading_test_1_6.s1.s3">S3</link></title>
- <bridgehead renderas="sect3" id="heading_test_1_6.s1.s3.h1">
- <phrase id="heading_test_1_6.s1.s3.a5"/><link linkend="heading_test_1_6.s1.s3.a5">H5</link>
+ <section id="heading_test_1_6.s1_0.s3">
+ <title><link linkend="heading_test_1_6.s1_0.s3">S3</link></title>
+ <bridgehead renderas="sect3" id="heading_test_1_6.s1_0.s3.h0">
+ <phrase id="heading_test_1_6.s1_0.s3.a5"/><link linkend="heading_test_1_6.s1_0.s3.a5">H5</link>
       </bridgehead>
     </section>
- <bridgehead renderas="sect3" id="heading_test_1_6.s1.h8">
- <phrase id="heading_test_1_6.s1.a6"/><link linkend="heading_test_1_6.s1.a6">H6</link>
+ <bridgehead renderas="sect3" id="heading_test_1_6.s1_0.h2">
+ <phrase id="heading_test_1_6.s1_0.a6"/><link linkend="heading_test_1_6.s1_0.a6">H6</link>
     </bridgehead>
   </section>
   <bridgehead renderas="sect1" id="heading_test_1_6.h14">

Modified: branches/quickbook-dev/tools/quickbook/test/identifier-1_6.gold
==============================================================================
--- branches/quickbook-dev/tools/quickbook/test/identifier-1_6.gold (original)
+++ branches/quickbook-dev/tools/quickbook/test/identifier-1_6.gold 2011-11-02 03:49:22 EDT (Wed, 02 Nov 2011)
@@ -4,7 +4,7 @@
  xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>Identifiers in quickbook 1.6</title>
   <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h0">
- <phrase id="identifiers_in_quickbook_1_6.test_heading_with__code_"/><link linkend="identifiers_in_quickbook_1_6.test_heading_with__code_">Test
+ <phrase id="identifiers_in_quickbook_1_6.test_heading_with_code"/><link linkend="identifiers_in_quickbook_1_6.test_heading_with_code">Test
     heading with <code><phrase role="identifier">code</phrase></code></link>
   </bridgehead>
   <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h1">
@@ -27,8 +27,8 @@
     </tgroup>
   </table>
   <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h3">
- <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_duplicate_it_by_having_several_headers"/><link
- linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_duplicate_it_by_having_several_headers">Generate
+ <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_du"/><link
+ linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_du">Generate
     a really long id and duplicate it by having several headers</link>
   </bridgehead>
   <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h4">
@@ -37,203 +37,203 @@
     a really long id and duplicate it by having several headers</link>
   </bridgehead>
   <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h5">
- <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_duplicate_it_by_having_lots_of_headers"/><link
- linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_duplicate_it_by_having_lots_of_headers">Generate
- a really long id and duplicate it by having lots of headers</link>
- </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h6">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_d1"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_d1">Generate
     a really long id and duplicate it by having lots of headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h7">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h6">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_d2"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_d2">Generate
     a really long id and duplicate it by having lots of headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h8">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h7">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_d3"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_d3">Generate
- a really long id and duplicate it by having several headers</link>
+ a really long id and duplicate it by having lots of headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h9">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h8">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_d5"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_d5">Generate
     a really long id and duplicate it by having several headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h10">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h9">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_d6"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_d6">Generate
     a really long id and duplicate it by having several headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h11">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h10">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_d7"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_d7">Generate
     a really long id and duplicate it by having several headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h12">
- <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_duplicate_it_by_having_too_many_headers"/><link
- linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_duplicate_it_by_having_too_many_headers">Generate
- a really long id and duplicate it by having too many headers</link>
- </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h13">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h11">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_d8"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_d8">Generate
- a really long id and duplicate it by having too many headers</link>
+ a really long id and duplicate it by having several headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h14">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h12">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_d9"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_d9">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h15">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h13">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_0"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_0">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h16">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h14">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_1"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_1">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h17">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h15">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_2"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_2">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h18">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h16">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_3"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_3">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h19">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h17">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_4"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_4">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h20">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h18">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_5"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_5">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h21">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h19">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_6"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_6">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h22">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h20">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_7"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_7">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h23">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h21">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_8"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_8">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h24">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h22">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_9"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_9">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h25">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h23">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_10"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_10">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h26">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h24">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_11"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_11">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h27">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h25">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_12"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_12">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h28">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h26">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_13"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_13">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h29">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h27">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_14"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_14">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h30">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h28">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_16"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_16">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h31">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h29">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_17"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_17">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h32">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h30">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_18"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_18">Generate
     a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h33">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h31">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_19"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_19">Generate
- a really long id and duplicate it by having several headers</link>
+ a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h34">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h32">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_20"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_20">Generate
- a really long id and duplicate it by having several headers</link>
+ a really long id and duplicate it by having too many headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h35">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h33">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_21"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_21">Generate
     a really long id and duplicate it by having several headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h36">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h34">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_22"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_22">Generate
     a really long id and duplicate it by having several headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h37">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h35">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_23"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_23">Generate
     a really long id and duplicate it by having several headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h38">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h36">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_24"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_24">Generate
     a really long id and duplicate it by having several headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h39">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h37">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_25"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_25">Generate
     a really long id and duplicate it by having several headers</link>
   </bridgehead>
- <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h40">
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h38">
     <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_26"/><link
     linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_26">Generate
     a really long id and duplicate it by having several headers</link>
   </bridgehead>
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h39">
+ <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_27"/><link
+ linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_27">Generate
+ a really long id and duplicate it by having several headers</link>
+ </bridgehead>
+ <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h40">
+ <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_28"/><link
+ linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_28">Generate
+ a really long id and duplicate it by having several headers</link>
+ </bridgehead>
   <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h41">
- <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_duplicate_it_by_having_even_more_headers"/><link
- linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_duplicate_it_by_having_even_more_headers">Generate
+ <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_29"/><link
+ linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_29">Generate
     a really long id and duplicate it by having even more headers</link>
   </bridgehead>
   <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h42">
- <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_27"/><link
- linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_27">Generate
+ <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_30"/><link
+ linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_30">Generate
     a really long id and duplicate it by having even more headers</link>
   </bridgehead>
   <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h43">
- <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_28"/><link
- linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_28">Generate
+ <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_31"/><link
+ linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_31">Generate
     a really long id and duplicate it by having even more headers</link>
   </bridgehead>
   <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h44">
- <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_29"/><link
- linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_29">Generate
+ <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_32"/><link
+ linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_32">Generate
     a really long id and duplicate it by having several headers</link>
   </bridgehead>
   <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h45">
@@ -247,13 +247,13 @@
     a really long id and 15</link>
   </bridgehead>
   <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h47">
- <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_30"/><link
- linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_30">Generate
+ <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_33"/><link
+ linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_33">Generate
     a really long id and d4</link>
   </bridgehead>
   <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h48">
- <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_31"/><link
- linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_31">Generate
+ <phrase id="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_34"/><link
+ linkend="identifiers_in_quickbook_1_6.generate_a_really_long_id_and_34">Generate
     a really long id and 15</link>
   </bridgehead>
   <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h49">
@@ -280,8 +280,8 @@
     linkend="identifiers_in_quickbook_1_6.abcdefghijklmnopqrstuvwxyzabcde2">abcdefghijklmnopqrstuvwxyzabcdef</link>
   </bridgehead>
   <bridgehead renderas="sect2" id="identifiers_in_quickbook_1_6.h55">
- <phrase id="identifiers_in_quickbook_1_6.markup_in__heading___in__order__to_test_normalization"/><link
- linkend="identifiers_in_quickbook_1_6.markup_in__heading___in__order__to_test_normalization">Markup
+ <phrase id="identifiers_in_quickbook_1_6.markup_in_heading_in_order_to_te"/><link
+ linkend="identifiers_in_quickbook_1_6.markup_in_heading_in_order_to_te">Markup
     in <code><phrase role="identifier">heading</phrase></code> in <emphasis role="bold">order</emphasis>
     to test normalization</link>
   </bridgehead>
@@ -301,8 +301,8 @@
     <title><link linkend="identifiers_in_quickbook_1_6.identifier_10">Identifier
     10</link></title>
     <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h0">
- <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_duplicate_it_by_having_several_headers"/><link
- linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_duplicate_it_by_having_several_headers">Generate
+ <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_du"/><link
+ linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_du">Generate
       a really long id and duplicate it by having several headers</link>
     </bridgehead>
     <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h1">
@@ -311,203 +311,203 @@
       a really long id and duplicate it by having several headers</link>
     </bridgehead>
     <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h2">
- <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_duplicate_it_by_having_lots_of_headers"/><link
- linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_duplicate_it_by_having_lots_of_headers">Generate
- a really long id and duplicate it by having lots of headers</link>
- </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h4">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_d1"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_d1">Generate
       a really long id and duplicate it by having lots of headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h5">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h4">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_d2"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_d2">Generate
       a really long id and duplicate it by having lots of headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h6">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h5">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_d3"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_d3">Generate
- a really long id and duplicate it by having several headers</link>
+ a really long id and duplicate it by having lots of headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h7">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h6">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_d5"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_d5">Generate
       a really long id and duplicate it by having several headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h8">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h7">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_d6"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_d6">Generate
       a really long id and duplicate it by having several headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h9">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h8">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_d7"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_d7">Generate
       a really long id and duplicate it by having several headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h10">
- <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_duplicate_it_by_having_too_many_headers"/><link
- linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_duplicate_it_by_having_too_many_headers">Generate
- a really long id and duplicate it by having too many headers</link>
- </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h11">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h9">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_d8"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_d8">Generate
- a really long id and duplicate it by having too many headers</link>
+ a really long id and duplicate it by having several headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h12">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h10">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_d9"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_d9">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h13">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h11">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_0"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_0">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h14">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h12">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_1"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_1">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h15">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h13">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_2"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_2">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h16">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h14">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_3"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_3">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h17">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h15">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_4"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_4">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h18">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h16">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_5"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_5">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h19">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h17">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_6"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_6">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h20">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h18">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_7"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_7">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h21">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h19">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_8"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_8">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h22">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h20">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_9"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_9">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h23">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h21">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_10"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_10">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h24">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h22">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_11"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_11">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h25">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h23">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_12"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_12">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h26">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h24">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_13"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_13">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h27">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h25">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_14"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_14">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h28">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h26">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_16"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_16">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h29">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h27">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_17"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_17">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h30">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h28">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_18"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_18">Generate
       a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h31">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h29">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_19"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_19">Generate
- a really long id and duplicate it by having several headers</link>
+ a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h32">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h30">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_20"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_20">Generate
- a really long id and duplicate it by having several headers</link>
+ a really long id and duplicate it by having too many headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h33">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h31">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_21"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_21">Generate
       a really long id and duplicate it by having several headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h34">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h32">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_22"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_22">Generate
       a really long id and duplicate it by having several headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h35">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h33">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_23"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_23">Generate
       a really long id and duplicate it by having several headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h36">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h34">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_24"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_24">Generate
       a really long id and duplicate it by having several headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h37">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h35">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_25"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_25">Generate
       a really long id and duplicate it by having several headers</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h38">
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h36">
       <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_26"/><link
       linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_26">Generate
       a really long id and duplicate it by having several headers</link>
     </bridgehead>
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h37">
+ <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_27"/><link
+ linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_27">Generate
+ a really long id and duplicate it by having several headers</link>
+ </bridgehead>
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h38">
+ <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_28"/><link
+ linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_28">Generate
+ a really long id and duplicate it by having several headers</link>
+ </bridgehead>
     <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h39">
- <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_duplicate_it_by_having_even_more_headers"/><link
- linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_duplicate_it_by_having_even_more_headers">Generate
+ <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_29"/><link
+ linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_29">Generate
       a really long id and duplicate it by having even more headers</link>
     </bridgehead>
     <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h40">
- <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_27"/><link
- linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_27">Generate
+ <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_30"/><link
+ linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_30">Generate
       a really long id and duplicate it by having even more headers</link>
     </bridgehead>
     <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h41">
- <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_28"/><link
- linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_28">Generate
+ <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_31"/><link
+ linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_31">Generate
       a really long id and duplicate it by having even more headers</link>
     </bridgehead>
     <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h42">
- <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_29"/><link
- linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_29">Generate
+ <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_32"/><link
+ linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_32">Generate
       a really long id and duplicate it by having several headers</link>
     </bridgehead>
     <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h43">
@@ -521,13 +521,13 @@
       a really long id and 15</link>
     </bridgehead>
     <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h45">
- <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_30"/><link
- linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_30">Generate
+ <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_33"/><link
+ linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_33">Generate
       a really long id and d4</link>
     </bridgehead>
     <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h46">
- <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_31"/><link
- linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_31">Generate
+ <phrase id="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_34"/><link
+ linkend="identifiers_in_quickbook_1_6.identifier_10.generate_a_really_long_id_and_34">Generate
       a really long id and 15</link>
     </bridgehead>
     <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h47">
@@ -554,8 +554,8 @@
       linkend="identifiers_in_quickbook_1_6.identifier_10.abcdefghijklmnopqrstuvwxyzabcde2">abcdefghijklmnopqrstuvwxyzabcdef</link>
     </bridgehead>
     <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.identifier_10.h53">
- <phrase id="identifiers_in_quickbook_1_6.identifier_10.markup_in__heading___in__order__to_test_normalization"/><link
- linkend="identifiers_in_quickbook_1_6.identifier_10.markup_in__heading___in__order__to_test_normalization">Markup
+ <phrase id="identifiers_in_quickbook_1_6.identifier_10.markup_in_heading_in_order_to_te"/><link
+ linkend="identifiers_in_quickbook_1_6.identifier_10.markup_in_heading_in_order_to_te">Markup
       in <code><phrase role="identifier">heading</phrase></code> in <emphasis role="bold">order</emphasis>
       to test normalization</link>
     </bridgehead>
@@ -594,15 +594,15 @@
       </tgroup>
     </table>
   </section>
- <section id="identifiers_in_quickbook_1_6.punctuation___stuff">
- <title><link linkend="identifiers_in_quickbook_1_6.punctuation___stuff">Punctuation
+ <section id="identifiers_in_quickbook_1_6.punctuation_stuff">
+ <title><link linkend="identifiers_in_quickbook_1_6.punctuation_stuff">Punctuation
     &amp; stuff</link></title>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.punctuation___stuff.h0">
- <phrase id="identifiers_in_quickbook_1_6.punctuation___stuff.a___b"/><link
- linkend="identifiers_in_quickbook_1_6.punctuation___stuff.a___b">A + B</link>
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.punctuation_stuff.h0">
+ <phrase id="identifiers_in_quickbook_1_6.punctuation_stuff.a_b"/><link linkend="identifiers_in_quickbook_1_6.punctuation_stuff.a_b">A
+ + B</link>
     </bridgehead>
- <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.punctuation___stuff.h1">
- <phrase id="identifiers_in_quickbook_1_6.punctuation___stuff.a_b0"/><link linkend="identifiers_in_quickbook_1_6.punctuation___stuff.a_b0">A
+ <bridgehead renderas="sect3" id="identifiers_in_quickbook_1_6.punctuation_stuff.h1">
+ <phrase id="identifiers_in_quickbook_1_6.punctuation_stuff.a_b0"/><link linkend="identifiers_in_quickbook_1_6.punctuation_stuff.a_b0">A
       + B</link>
     </bridgehead>
   </section>

Modified: branches/quickbook-dev/tools/quickbook/test/include/in_section-1_6.gold
==============================================================================
--- branches/quickbook-dev/tools/quickbook/test/include/in_section-1_6.gold (original)
+++ branches/quickbook-dev/tools/quickbook/test/include/in_section-1_6.gold 2011-11-02 03:49:22 EDT (Wed, 02 Nov 2011)
@@ -35,26 +35,26 @@
   <article id="include_in_section_include_1_0" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
   xmlns:xi="http://www.w3.org/2001/XInclude">
     <title>Include in section include 1</title>
- <bridgehead renderas="sect1" id="include_in_section_include_1.h1">
- <phrase id="include_in_section_include_1.test1_0"/><link linkend="include_in_section_include_1.test1_0">Test1</link>
+ <bridgehead renderas="sect1" id="include_in_section_include_1_0.h0">
+ <phrase id="include_in_section_include_1_0.test1"/><link linkend="include_in_section_include_1_0.test1">Test1</link>
     </bridgehead>
- <section id="include_in_section_include_1.inner">
- <title><link linkend="include_in_section_include_1.inner"></link></title>
- <bridgehead renderas="sect1" id="include_in_section_include_1.inner.h1">
- <phrase id="include_in_section_include_1.inner.test2_0"/><link linkend="include_in_section_include_1.inner.test2_0">Test2</link>
+ <section id="include_in_section_include_1_0.inner">
+ <title><link linkend="include_in_section_include_1_0.inner"></link></title>
+ <bridgehead renderas="sect1" id="include_in_section_include_1_0.inner.h0">
+ <phrase id="include_in_section_include_1_0.inner.test2"/><link linkend="include_in_section_include_1_0.inner.test2">Test2</link>
       </bridgehead>
     </section>
   </article>
- <article id="section_include" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ <article id="section_include0" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
   xmlns:xi="http://www.w3.org/2001/XInclude">
     <title>Include in section include 2</title>
- <bridgehead renderas="sect1" id="section_include.h1">
- <phrase id="section_include.test1_0"/><link linkend="section_include.test1_0">Test1</link>
+ <bridgehead renderas="sect1" id="section_include0.h0">
+ <phrase id="section_include0.test1"/><link linkend="section_include0.test1">Test1</link>
     </bridgehead>
- <section id="section_include.inner">
- <title><link linkend="section_include.inner"></link></title>
- <bridgehead renderas="sect1" id="section_include.inner.h1">
- <phrase id="section_include.inner.test2_0"/><link linkend="section_include.inner.test2_0">Test2</link>
+ <section id="section_include0.inner">
+ <title><link linkend="section_include0.inner"></link></title>
+ <bridgehead renderas="sect1" id="section_include0.inner.h0">
+ <phrase id="section_include0.inner.test2"/><link linkend="section_include0.inner.test2">Test2</link>
       </bridgehead>
     </section>
   </article>
@@ -63,26 +63,26 @@
     <article id="include_in_section_include_1_1" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
     xmlns:xi="http://www.w3.org/2001/XInclude">
       <title>Include in section include 1</title>
- <bridgehead renderas="sect1" id="include_in_section_include_1.h2">
- <phrase id="include_in_section_include_1.test1_1"/><link linkend="include_in_section_include_1.test1_1">Test1</link>
+ <bridgehead renderas="sect1" id="include_in_section_include_1_1.h0">
+ <phrase id="include_in_section_include_1_1.test1"/><link linkend="include_in_section_include_1_1.test1">Test1</link>
       </bridgehead>
- <section id="include_in_section_include_1.inner">
- <title><link linkend="include_in_section_include_1.inner"></link></title>
- <bridgehead renderas="sect1" id="include_in_section_include_1.inner.h2">
- <phrase id="include_in_section_include_1.inner.test2_1"/><link linkend="include_in_section_include_1.inner.test2_1">Test2</link>
+ <section id="include_in_section_include_1_1.inner">
+ <title><link linkend="include_in_section_include_1_1.inner"></link></title>
+ <bridgehead renderas="sect1" id="include_in_section_include_1_1.inner.h0">
+ <phrase id="include_in_section_include_1_1.inner.test2"/><link linkend="include_in_section_include_1_1.inner.test2">Test2</link>
         </bridgehead>
       </section>
     </article>
- <article id="section_include" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ <article id="section_include1" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
     xmlns:xi="http://www.w3.org/2001/XInclude">
       <title>Include in section include 2</title>
- <bridgehead renderas="sect1" id="section_include.h2">
- <phrase id="section_include.test1_1"/><link linkend="section_include.test1_1">Test1</link>
+ <bridgehead renderas="sect1" id="section_include1.h0">
+ <phrase id="section_include1.test1"/><link linkend="section_include1.test1">Test1</link>
       </bridgehead>
- <section id="section_include.inner">
- <title><link linkend="section_include.inner"></link></title>
- <bridgehead renderas="sect1" id="section_include.inner.h2">
- <phrase id="section_include.inner.test2_1"/><link linkend="section_include.inner.test2_1">Test2</link>
+ <section id="section_include1.inner">
+ <title><link linkend="section_include1.inner"></link></title>
+ <bridgehead renderas="sect1" id="section_include1.inner.h0">
+ <phrase id="section_include1.inner.test2"/><link linkend="section_include1.inner.test2">Test2</link>
         </bridgehead>
       </section>
     </article>

Modified: branches/quickbook-dev/tools/quickbook/test/unit/Jamfile.v2
==============================================================================
--- branches/quickbook-dev/tools/quickbook/test/unit/Jamfile.v2 (original)
+++ branches/quickbook-dev/tools/quickbook/test/unit/Jamfile.v2 2011-11-02 03:49:22 EDT (Wed, 02 Nov 2011)
@@ -13,7 +13,7 @@
     ;
 
 run values_test.cpp ../../src/values.cpp ;
-run post_process_test.cpp ../../src/post_process.cpp ../../src/id_generator.cpp ;
+run post_process_test.cpp ../../src/post_process.cpp ;
 run iterator_tests.cpp ../../src/values.cpp ;
 
 # Copied from spirit


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk