Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75530 - branches/quickbook-dev/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2011-11-17 16:04:43


Author: danieljames
Date: 2011-11-17 16:04:42 EST (Thu, 17 Nov 2011)
New Revision: 75530
URL: http://svn.boost.org/trac/boost/changeset/75530

Log:
Quickbook: Generate dirname in doc_info_actions.

This was always a bit silly. I was originally going to change it to only
use an explicit dirname, but dirname is technically required by the
boostbook dtd. There's no particular reason to maintain backwards
compatibility though.
Text files modified:
   branches/quickbook-dev/tools/quickbook/src/doc_info_actions.cpp | 27 +++++++++++++++++++--------
   branches/quickbook-dev/tools/quickbook/src/id_manager.cpp | 22 ++++++----------------
   branches/quickbook-dev/tools/quickbook/src/id_manager.hpp | 7 +------
   3 files changed, 26 insertions(+), 30 deletions(-)

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-17 16:04:42 EST (Thu, 17 Nov 2011)
@@ -247,15 +247,14 @@
 
         actions.current_file_tmp->version(qbk_version_n);
 
- id_manager::start_file_info start_file_info =
+ std::string id_placeholder =
             actions.ids.start_file_with_docinfo(
                 compatibility_version, include_doc_id_, id_,
                 doc_title.check() ? doc_title.get_quickbook() : std::string());
 
         // Make sure we really did have a document info block.
 
- assert(doc_title.check() && !doc_type.empty() &&
- !start_file_info.doc_id.empty());
+ assert(doc_title.check() && !doc_type.empty());
 
         // Set xmlbase
 
@@ -310,7 +309,7 @@
 
         out << '<' << doc_type << "\n"
             << " id=\""
- << start_file_info.placeholder
+ << id_placeholder
             << "\"\n";
 
         if(!lang.empty())
@@ -327,13 +326,25 @@
 
         // Set defaults for dirname + last_revision
 
- if(!dirname.empty() || doc_type == "library")
+ if (!dirname.empty() || doc_type == "library")
         {
             out << " dirname=\"";
- if (!dirname.empty())
+ if (!dirname.empty()) {
                 out << doc_info_output(dirname, 106);
- else
- out << start_file_info.doc_id;
+ }
+ else if (!id_.empty()) {
+ out << id_;
+ }
+ else if (!include_doc_id_.empty()) {
+ out << include_doc_id_;
+ }
+ else if (!doc_title.empty()) {
+ out << detail::make_identifier(doc_title.get_quickbook());
+ }
+ else {
+ out << "library";
+ }
+
             out << "\"\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-17 16:04:42 EST (Thu, 17 Nov 2011)
@@ -155,7 +155,6 @@
                 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(
@@ -209,8 +208,9 @@
             std::string const& title)
     {
         boost::scoped_ptr<section_manager> new_section(
- current_section->start_file(false, compatibility_version,
- include_doc_id, id, title, 0, 0));
+ current_section->start_file(false,
+ current_section->compatibility_version,
+ include_doc_id, id, title, 0));
 
         if (new_section) {
             boost::swap(current_section, new_section->parent);
@@ -218,18 +218,17 @@
         }
     }
 
- id_manager::start_file_info id_manager::start_file_with_docinfo(
+ std::string id_manager::start_file_with_docinfo(
             unsigned compatibility_version,
             std::string const& include_doc_id,
             std::string const& id,
             std::string const& title)
     {
- start_file_info result;
+ std::string result;
 
         boost::scoped_ptr<section_manager> new_section(
             current_section->start_file(true, compatibility_version,
- include_doc_id, id, title,
- &result.doc_id, &result.placeholder));
+ include_doc_id, id, title, &result));
 
         if (new_section) {
             boost::swap(current_section, new_section->parent);
@@ -367,7 +366,6 @@
                 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(
@@ -402,7 +400,6 @@
             std::string const& include_doc_id,
             std::string const& id,
             std::string const& title,
- std::string* doc_id_result,
             std::string* placeholder)
     {
         // This is set even when docinfo is otherwise ignored.
@@ -422,8 +419,6 @@
                 id_category::explicit_section_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(state, compatibility_version);
@@ -534,7 +529,6 @@
                 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(
@@ -567,7 +561,6 @@
             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()) {
@@ -585,8 +578,6 @@
                     id_category::explicit_section_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(state, compatibility_version);
             std::string initial_placeholder = new_section_manager->docinfo(
@@ -596,7 +587,6 @@
         }
         else {
             ++depth;
- if (doc_id_result) *doc_id_result = "";
             if (placeholder) *placeholder = "";
             return std::auto_ptr<section_manager>();
         }

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-17 16:04:42 EST (Thu, 17 Nov 2011)
@@ -50,12 +50,7 @@
         id_manager();
         ~id_manager();
 
- struct start_file_info {
- std::string doc_id;
- std::string placeholder;
- };
-
- start_file_info start_file_with_docinfo(
+ std::string start_file_with_docinfo(
                 unsigned compatibility_version,
                 std::string const& include_doc_id,
                 std::string const& id,


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