Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70867 - branches/quickbook-dev/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2011-04-02 13:43:19


Author: danieljames
Date: 2011-04-02 13:43:18 EDT (Sat, 02 Apr 2011)
New Revision: 70867
URL: http://svn.boost.org/trac/boost/changeset/70867

Log:
Quickbook: Trying to clarify to myself the doc info stuff.
Text files modified:
   branches/quickbook-dev/tools/quickbook/src/doc_info_actions.cpp | 63 +++++++++++++++++++++++++--------------
   1 files changed, 40 insertions(+), 23 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-04-02 13:43:18 EDT (Sat, 02 Apr 2011)
@@ -72,6 +72,9 @@
     {
         // The doc_info in the file has been parsed. Here's what we'll do
         // *before* anything else.
+ //
+ // If there isn't a doc info block, then values will be empty, so most
+ // of the following code won't actually do anything.
 
         value_consumer values = actions.values.release();
 
@@ -122,38 +125,26 @@
         if (!id.empty())
             actions.doc_id = id.get_quickbook();
 
- if (actions.doc_id.empty())
- actions.doc_id = detail::make_identifier(actions.doc_title_qbk);
-
- if (dirname.empty() && actions.doc_type == "library") {
- if (!id.empty()) {
- dirname = id;
- }
- else {
- dirname = qbk_bbk_value(actions.doc_id, doc_info_attributes::dirname);
- }
- }
+ // This is only meant to kick in for the main document (since in
+ // included documents, the id should already be set), but due to a
+ // bug in old versions the document id is reset when including files.
 
- if (last_revision.empty())
+ if (actions.doc_id.empty())
         {
- // default value for last-revision is now
-
- char strdate[64];
- strftime(
- strdate, sizeof(strdate),
- (debug_mode ?
- "DEBUG MODE Date: %Y/%m/%d %H:%M:%S $" :
- "$" /* prevent CVS substitution */ "Date: %Y/%m/%d %H:%M:%S $"),
- current_gm_time
- );
- last_revision = qbk_bbk_value(strdate, doc_info_attributes::last_revision);
+ assert(qbk_version_n < 106 || !ignore_docinfo);
+ actions.doc_id = detail::make_identifier(actions.doc_title_qbk);
         }
 
         // if we're ignoring the document info, we're done.
+
         if (ignore_docinfo)
         {
             return;
         }
+
+ // Make sure we really did have a document info block.
+
+ assert(doc_title.check());
 
         // Quickbook version
 
@@ -196,6 +187,32 @@
             ++actions.error_count;
         }
 
+ // Set defaults for dirname + last_revision
+
+ if (dirname.empty() && actions.doc_type == "library") {
+ if (!id.empty()) {
+ dirname = id;
+ }
+ else {
+ dirname = qbk_bbk_value(actions.doc_id, doc_info_attributes::dirname);
+ }
+ }
+
+ if (last_revision.empty())
+ {
+ // default value for last-revision is now
+
+ char strdate[64];
+ strftime(
+ strdate, sizeof(strdate),
+ (debug_mode ?
+ "DEBUG MODE Date: %Y/%m/%d %H:%M:%S $" :
+ "$" /* prevent CVS substitution */ "Date: %Y/%m/%d %H:%M:%S $"),
+ current_gm_time
+ );
+ last_revision = qbk_bbk_value(strdate, doc_info_attributes::last_revision);
+ }
+
         // Warn about invalid fields
 
         if (actions.doc_type != "library")


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