Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75256 - branches/quickbook-dev/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2011-11-02 03:58:53


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

Log:
Quickbook: Prioritize explicit ids.
Text files modified:
   branches/quickbook-dev/tools/quickbook/src/actions.cpp | 5 +++--
   branches/quickbook-dev/tools/quickbook/src/id_manager.cpp | 16 ++++++++--------
   branches/quickbook-dev/tools/quickbook/src/id_manager.hpp | 4 +++-
   3 files changed, 14 insertions(+), 11 deletions(-)

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:58:52 EDT (Wed, 02 Nov 2011)
@@ -58,7 +58,8 @@
         
         std::string add_anchor(quickbook::actions& actions,
                 std::string const& id,
- id_category::categories category = id_category::explicit_id)
+ id_category::categories category =
+ id_category::explicit_anchor_id)
         {
             std::string placeholder = actions.ids.add_anchor(id, category);
             actions.anchors.push_back(placeholder);
@@ -1572,7 +1573,7 @@
                 element_id.get_quickbook() :
                 detail::make_identifier(content.get_quickbook()),
             !element_id.empty() ?
- id_category::explicit_id :
+ id_category::explicit_section_id :
                 id_category::generated_section);
 
         actions.out << "\n<section id=\"" << full_id << "\">\n";

Modified: branches/quickbook-dev/tools/quickbook/src/id_manager.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/id_manager.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/id_manager.cpp 2011-11-02 03:58:52 EDT (Wed, 02 Nov 2011)
@@ -390,7 +390,7 @@
 
         id_category category =
             !id.empty() || !include_doc_id.empty() ?
- id_category::explicit_id :
+ id_category::explicit_section_id :
                 id_category::generated_doc;
 
         if (doc_id_result) *doc_id_result = initial_doc_id;
@@ -549,7 +549,7 @@
 
             id_category category =
                 !include_doc_id.empty() || !id.empty() ?
- id_category::explicit_id :
+ id_category::explicit_section_id :
                     id_category::generated_doc;
 
             if (doc_id_result) *doc_id_result = initial_doc_id;
@@ -594,7 +594,7 @@
             id_category category)
     {
         return ids.add_placeholder(
- category.c == id_category::explicit_id ? id : normalize_id(id),
+ category.c >= id_category::explicit_id ? id : normalize_id(id),
             category, current_placeholder)->to_string();
     }
 
@@ -612,7 +612,7 @@
         ++level;
 
         current_placeholder = ids.add_placeholder(
- category.c == id_category::explicit_id ? id : normalize_id(id),
+ category.c >= id_category::explicit_id ? id : normalize_id(id),
             category, current_placeholder);
 
         return current_placeholder->to_string();
@@ -851,16 +851,16 @@
     //
     // index_placeholders
     //
- // Create a sorted index of the placeholders, in ordered
- // to make numbering duplicates easy.
+ // Create a sorted index of the placeholders, in order
+ // to make numbering duplicates easy. A total order.
     //
 
     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;
+ 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 :

Modified: branches/quickbook-dev/tools/quickbook/src/id_manager.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/id_manager.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/id_manager.hpp 2011-11-02 03:58:52 EDT (Wed, 02 Nov 2011)
@@ -28,7 +28,9 @@
             generated_heading, // Generated ids for headings.
             generated_section, // Generated ids for sections.
             generated_doc, // Generated ids for document.
- explicit_id // Explicitly given by user
+ explicit_id, // Explicitly given by user
+ explicit_section_id,
+ explicit_anchor_id
         };
 
         id_category() : c(default_category) {}


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