|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r75248 - branches/quickbook-dev/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2011-11-02 03:44:28
Author: danieljames
Date: 2011-11-02 03:44:26 EDT (Wed, 02 Nov 2011)
New Revision: 75248
URL: http://svn.boost.org/trac/boost/changeset/75248
Log:
Quickbook: Move doc_id into section_info.
And doc_id state saving into quickbook.cpp.
Text files modified:
branches/quickbook-dev/tools/quickbook/src/actions.cpp | 23 +++++++++++------------
branches/quickbook-dev/tools/quickbook/src/actions_class.cpp | 3 ---
branches/quickbook-dev/tools/quickbook/src/actions_class.hpp | 1 -
branches/quickbook-dev/tools/quickbook/src/actions_state.hpp | 1 -
branches/quickbook-dev/tools/quickbook/src/doc_info_actions.cpp | 24 +++++++++++++-----------
branches/quickbook-dev/tools/quickbook/src/id_generator.cpp | 5 ++---
branches/quickbook-dev/tools/quickbook/src/id_generator.hpp | 3 +--
branches/quickbook-dev/tools/quickbook/src/quickbook.cpp | 17 +++++++++++++----
8 files changed, 40 insertions(+), 37 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:44:26 EDT (Wed, 02 Nov 2011)
@@ -261,7 +261,7 @@
actions.phrase
<< "<footnote id=\""
<< actions.section->fully_qualified_id(
- actions.ids, actions.doc_id, "f", id_generator::numbered)
+ actions.ids, "f", id_generator::numbered)
<< "\"><para>"
<< values.consume().get_boostbook()
<< "</para></footnote>";
@@ -304,7 +304,7 @@
actions.out << "<bridgehead renderas=\"sect" << level << "\"";
actions.out << " id=\"";
actions.out << actions.section->fully_qualified_id(
- actions.ids, actions.doc_id, "h", id_generator::numbered);
+ actions.ids, "h", id_generator::numbered);
actions.out << "\">";
actions.out << "<phrase id=\"" << id << "\"/>";
actions.out << "<link linkend=\"" << id << "\">";
@@ -376,7 +376,7 @@
);
std::string anchor = actions.section->fully_qualified_id(
- actions.ids, actions.doc_id, id, category);
+ actions.ids, id, category);
write_bridgehead(actions, level,
content.get_boostbook(), anchor, true);
@@ -1260,9 +1260,9 @@
for(unsigned int i = 0; i < size; ++i)
{
std::string callout_id1 = actions.section->fully_qualified_id(
- actions.ids, actions.doc_id, callout_base, id_generator::numbered);
+ actions.ids, callout_base, id_generator::numbered);
std::string callout_id2 = actions.section->fully_qualified_id(
- actions.ids, actions.doc_id, callout_base, id_generator::numbered);
+ actions.ids, callout_base, id_generator::numbered);
std::string code;
code += "<co id=\"" + callout_id1 + "\" ";
@@ -1281,9 +1281,6 @@
if(!symbol->callouts.empty())
{
- template_state state(actions);
- ++actions.template_depth;
-
block += "<calloutlist>";
int i = 0;
BOOST_FOREACH(value c, symbol->callouts)
@@ -1294,6 +1291,8 @@
std::string callout_value;
{
template_state state(actions);
+ ++actions.template_depth;
+
bool r = parse_template(
template_body(c, symbol->body.filename), false, actions);
@@ -1455,17 +1454,17 @@
if(qbk_version_n >= 105) {
if(!element_id.empty()) {
table_id = actions.section->fully_qualified_id(
- actions.ids, actions.doc_id, element_id, id_generator::explicit_id);
+ actions.ids, element_id, id_generator::explicit_id);
}
else if(has_title) {
table_id = actions.section->fully_qualified_id(
- actions.ids, actions.doc_id, detail::make_identifier(title), id_generator::generated);
+ actions.ids, detail::make_identifier(title), id_generator::generated);
}
}
else if (has_title)
{
table_id = actions.section->fully_qualified_id(
- actions.ids, actions.doc_id, "t", id_generator::numbered);
+ actions.ids, "t", id_generator::numbered);
}
// Emulating the old behaviour which used the width of the final
@@ -1543,7 +1542,7 @@
values.finish();
std::string full_id = actions.section->begin_section(
- actions.ids, qbk_version_n, actions.doc_id,
+ actions.ids, qbk_version_n,
!element_id.empty() ?
element_id.get_quickbook() :
detail::make_identifier(content.get_quickbook()),
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-02 03:44:26 EDT (Wed, 02 Nov 2011)
@@ -40,7 +40,6 @@
, doc_type()
, macro()
, source_mode("c++")
- , doc_id()
, filename(filein_)
, filename_relative(filein_.filename())
@@ -99,7 +98,6 @@
, qbk_version(qbk_version_n)
, imported(a.imported)
, doc_type(a.doc_type)
- , doc_id(a.doc_id)
, filename(a.filename)
, filename_relative(a.filename_relative)
, source_mode(a.source_mode)
@@ -120,7 +118,6 @@
boost::swap(qbk_version_n, qbk_version);
boost::swap(a.imported, imported);
boost::swap(a.doc_type, doc_type);
- boost::swap(a.doc_id, doc_id);
boost::swap(a.filename, filename);
boost::swap(a.filename_relative, filename_relative);
boost::swap(a.source_mode, source_mode);
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-02 03:44:26 EDT (Wed, 02 Nov 2011)
@@ -55,7 +55,6 @@
std::string doc_type;
string_symbols macro;
std::string source_mode;
- std::string doc_id;
fs::path filename;
fs::path filename_relative; // for the __FILENAME__ macro.
// (relative to the original file
Modified: branches/quickbook-dev/tools/quickbook/src/actions_state.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions_state.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions_state.hpp 2011-11-02 03:44:26 EDT (Wed, 02 Nov 2011)
@@ -38,7 +38,6 @@
unsigned qbk_version;
bool imported;
std::string doc_type;
- std::string doc_id;
fs::path filename;
fs::path filename_relative;
std::string source_mode;
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-02 03:44:26 EDT (Wed, 02 Nov 2011)
@@ -134,28 +134,29 @@
if (qbk_version_n >= 106)
{
if (!include_doc_id.empty())
- actions.doc_id = include_doc_id.get_quickbook();
+ actions.section->doc_id = include_doc_id.get_quickbook();
else if (!id.empty())
- actions.doc_id = id.get_quickbook();
+ actions.section->doc_id = id.get_quickbook();
else if (docinfo_type) {
- actions.doc_id = detail::make_identifier(actions.doc_title_qbk);
+ actions.section->doc_id = detail::make_identifier(actions.doc_title_qbk);
generated_id = true;
}
+ else {
+ assert(!actions.section->doc_id.empty());
+ }
}
else
{
if (!id.empty())
- actions.doc_id = id.get_quickbook();
+ actions.section->doc_id = id.get_quickbook();
else if (!include_doc_id.empty())
- actions.doc_id = include_doc_id.get_quickbook();
+ actions.section->doc_id = include_doc_id.get_quickbook();
else {
- actions.doc_id = detail::make_identifier(actions.doc_title_qbk);
+ actions.section->doc_id = detail::make_identifier(actions.doc_title_qbk);
generated_id = true;
}
}
- assert(!actions.doc_id.empty());
-
// if we're ignoring the document info, we're done.
if (!docinfo_type)
@@ -232,7 +233,8 @@
dirname = id;
}
else {
- dirname = qbk_bbk_value(actions.doc_id, doc_info_attributes::dirname);
+ dirname = qbk_bbk_value(actions.section->doc_id,
+ doc_info_attributes::dirname);
}
}
@@ -292,7 +294,7 @@
out << '<' << actions.doc_type << "\n"
<< " id=\""
- << actions.ids.add(actions.doc_id, generated_id ?
+ << actions.ids.add(actions.section->doc_id, generated_id ?
id_generator::generated_doc : id_generator::explicit_id)
<< "\"\n"
;
@@ -388,7 +390,7 @@
if (!license.empty())
{
tmp << " <legalnotice id=\""
- << actions.ids.add(actions.doc_id + ".legal",
+ << actions.ids.add(actions.section->doc_id + ".legal",
id_generator::generated)
<< "\">\n"
<< " <para>\n"
Modified: branches/quickbook-dev/tools/quickbook/src/id_generator.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/id_generator.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/id_generator.cpp 2011-11-02 03:44:26 EDT (Wed, 02 Nov 2011)
@@ -456,7 +456,7 @@
// section_info
section_info::section_info()
- : level(0), min_level(0), id(), qualified_id() {}
+ : level(0), min_level(0), doc_id(), id(), qualified_id() {}
std::string section_info::old_style_id(
id_generator& ids,
@@ -468,7 +468,6 @@
std::string section_info::fully_qualified_id(
id_generator& ids,
- std::string const& doc_id,
std::string const& id_part,
id_generator::categories category)
{
@@ -483,7 +482,6 @@
std::string section_info::begin_section(
id_generator& ids,
unsigned qbk_version_n,
- std::string const& doc_id,
std::string const& id_part,
id_generator::categories category)
{
@@ -528,6 +526,7 @@
{
boost::swap(a.level, b.level);
boost::swap(a.min_level, b.min_level);
+ boost::swap(a.doc_id, b.doc_id);
boost::swap(a.id, b.id);
boost::swap(a.qualified_id, b.qualified_id);
}
Modified: branches/quickbook-dev/tools/quickbook/src/id_generator.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/id_generator.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/id_generator.hpp 2011-11-02 03:44:26 EDT (Wed, 02 Nov 2011)
@@ -119,19 +119,18 @@
id_generator::categories);
std::string fully_qualified_id(
id_generator&,
- std::string const& doc_id,
std::string const&,
id_generator::categories);
std::string begin_section(
id_generator&,
unsigned qbk_version_n,
- std::string const& doc_id,
std::string const&,
id_generator::categories);
void end_section();
int level;
int min_level;
+ std::string doc_id;
std::string id;
std::string qualified_id;
};
Modified: branches/quickbook-dev/tools/quickbook/src/quickbook.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/quickbook.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/quickbook.cpp 2011-11-02 03:44:26 EDT (Wed, 02 Nov 2011)
@@ -97,11 +97,14 @@
section_info section;
section_info* saved_section = §ion;
+ boost::swap(saved_section, actor.section);
- if (docinfo_type) {
- boost::swap(saved_section, actor.section);
+ if (saved_section) {
+ if (!docinfo_type) section = *saved_section;
+ else section.doc_id = saved_section->doc_id;
}
+
if (info.hit || !docinfo_type)
{
pre(actor.out, actor, include_doc_id, docinfo_type);
@@ -113,8 +116,14 @@
}
}
- if (docinfo_type)
- boost::swap(saved_section, actor.section);
+ // If this is not a nested document then we want to keep
+ // the current section state.
+ if (saved_section && !docinfo_type) {
+ saved_section->level = section.level;
+ saved_section->id = section.id;
+ saved_section->qualified_id = section.qualified_id;
+ }
+ boost::swap(saved_section, actor.section);
if (!info.full)
{
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