|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r75523 - branches/quickbook-dev/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2011-11-17 16:02:37
Author: danieljames
Date: 2011-11-17 16:02:36 EST (Thu, 17 Nov 2011)
New Revision: 75523
URL: http://svn.boost.org/trac/boost/changeset/75523
Log:
Quickbook: Move the backwards compatible id thing into id_manager.
Text files modified:
branches/quickbook-dev/tools/quickbook/src/actions_class.cpp | 1 -
branches/quickbook-dev/tools/quickbook/src/actions_class.hpp | 1 -
branches/quickbook-dev/tools/quickbook/src/doc_info_actions.cpp | 5 ++---
branches/quickbook-dev/tools/quickbook/src/id_manager.cpp | 14 +++++++++++++-
4 files changed, 15 insertions(+), 6 deletions(-)
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-17 16:02:36 EST (Thu, 17 Nov 2011)
@@ -24,7 +24,6 @@
string_stream& out_, id_manager& ids)
: grammar_()
- , doc_title_qbk()
, xinclude_base(xinclude_base_)
, templates()
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-17 16:02:36 EST (Thu, 17 Nov 2011)
@@ -39,7 +39,6 @@
static int const max_template_depth = 100;
// global state
- std::string doc_title_qbk;
fs::path xinclude_base;
template_stack templates;
int error_count;
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:02:36 EST (Thu, 17 Nov 2011)
@@ -131,7 +131,6 @@
{
actions.doc_type = values.consume(doc_info_tags::type).get_quickbook();
doc_title = values.consume(doc_info_tags::title);
- actions.doc_title_qbk = doc_title.get_quickbook();
}
else
{
@@ -209,7 +208,7 @@
compatibility_version = actions.ids.compatibility_version();
actions.ids.start_file(compatibility_version, include_doc_id_, id_,
- actions.doc_title_qbk);
+ doc_title.check() ? doc_title.get_quickbook() : std::string());
return;
}
@@ -237,7 +236,7 @@
id_manager::start_file_info start_file_info =
actions.ids.start_file_with_docinfo(
compatibility_version, include_doc_id_, id_,
- actions.doc_title_qbk);
+ doc_title.check() ? doc_title.get_quickbook() : std::string());
// if we're ignoring the document info, we're done.
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:02:36 EST (Thu, 17 Nov 2011)
@@ -101,6 +101,7 @@
struct id_state
{
std::deque<id_placeholder> placeholders;
+ std::string last_title_1_1;
id_placeholder* add_placeholder(
std::string const&, id_category, id_placeholder* parent = 0);
@@ -403,10 +404,17 @@
std::string* doc_id_result,
std::string* placeholder)
{
+ // This is set even when docinfo is otherwise ignored.
+ if (!title.empty()) ids.last_title_1_1 = title;
+
+ // This is true because the first section manager is always v1.1,
+ // and always gets a title.
+ assert(!ids.last_title_1_1.empty());
+
std::string initial_doc_id =
!id.empty() ? id :
!include_doc_id.empty() ? include_doc_id :
- detail::make_identifier(title);
+ detail::make_identifier(ids.last_title_1_1);
id_category category =
!id.empty() || !include_doc_id.empty() ?
@@ -567,6 +575,10 @@
!id.empty() ? id :
detail::make_identifier(title);
+ // Since either: have_docinfo is true => !title.empty()
+ // Or: !include_doc_id.empty()
+ assert(!initial_doc_id.empty());
+
id_category category =
!include_doc_id.empty() || !id.empty() ?
id_category::explicit_section_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