$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r85260 - trunk/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2013-08-10 05:04:53
Author: danieljames
Date: 2013-08-10 05:04:53 EDT (Sat, 10 Aug 2013)
New Revision: 85260
URL: http://svn.boost.org/trac/boost/changeset/85260
Log:
Clean header id generation.
Text files modified: 
   trunk/tools/quickbook/src/actions.cpp |    54 +++++++++++++++++++++++++-------------- 
   1 files changed, 35 insertions(+), 19 deletions(-)
Modified: trunk/tools/quickbook/src/actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions.cpp	Sat Aug 10 05:04:25 2013	(r85259)
+++ trunk/tools/quickbook/src/actions.cpp	2013-08-10 05:04:53 EDT (Sat, 10 Aug 2013)	(r85260)
@@ -391,6 +391,8 @@
 
         if (!element_id.empty())
         {
+            // Use an explicit id.
+
             std::string anchor = state.ids.add_id(
                 element_id.get_quickbook(),
                 id_category::explicit_id);
@@ -398,34 +400,48 @@
             write_bridgehead(state, level,
                 content.get_encoded(), anchor, self_linked_headers);
         }
-        else if (!generic && state.ids.compatibility_version() < 103) // version 1.2 and below
+        else if (state.ids.compatibility_version() >= 106u)
         {
-            // This generates the old id style if both the interpreting
-            // version and the generation version are less then 103u.
+            // Generate ids for 1.6+
 
-            std::string anchor = state.ids.old_style_id(
-                detail::make_identifier(
-                    state.ids.replace_placeholders_with_unresolved_ids(
-                        content.get_encoded())),
+            std::string anchor = state.ids.add_id(
+                detail::make_identifier(content.get_quickbook()),
                 id_category::generated_heading);
 
             write_bridgehead(state, level,
-                content.get_encoded(), anchor, false);
-
+                content.get_encoded(), anchor, self_linked_headers);
         }
         else
         {
-            std::string anchor = state.ids.add_id(
-                detail::make_identifier(
-                    state.ids.compatibility_version() >= 106 ?
-                        content.get_quickbook() :
-                        state.ids.replace_placeholders_with_unresolved_ids(
-                            content.get_encoded())
-                ),
-                id_category::generated_heading);
+            // Generate ids that are compatible with older versions of quickbook.
 
-            write_bridgehead(state, level,
-                content.get_encoded(), anchor, self_linked_headers);
+            // Older versions of quickbook used the generated boostbook, but
+            // we only have an intermediate version which can contain id
+            // placeholders. So to generate the ids they must be replaced
+            // by the ids that the older versions would have used - i.e. the
+            // unresolved ids.
+            //
+            // Note that this doesn't affect the actual boostbook generated for
+            // the content, it's just used to generate this id.
+
+            std::string id = detail::make_identifier(
+                    state.ids.replace_placeholders_with_unresolved_ids(
+                        content.get_encoded()));
+
+            if (generic || state.ids.compatibility_version() >= 103) {
+                std::string anchor =
+                    state.ids.add_id(id, id_category::generated_heading);
+
+                write_bridgehead(state, level,
+                    content.get_encoded(), anchor, self_linked_headers);
+            }
+            else {
+                std::string anchor =
+                    state.ids.old_style_id(id, id_category::generated_heading);
+
+                write_bridgehead(state, level,
+                    content.get_encoded(), anchor, false);
+            }
         }
     }