|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r69825 - in trunk/tools/quickbook: . src
From: dnljms_at_[hidden]
Date: 2011-03-10 13:55:20
Author: danieljames
Date: 2011-03-10 13:55:18 EST (Thu, 10 Mar 2011)
New Revision: 69825
URL: http://svn.boost.org/trac/boost/changeset/69825
Log:
Cherry pick adding ids to bridgeheads.
Properties modified:
trunk/tools/quickbook/ (props changed)
Text files modified:
trunk/tools/quickbook/src/actions.cpp | 38 +++++++++++++++++---------------------
trunk/tools/quickbook/src/actions.hpp | 9 +++------
trunk/tools/quickbook/src/actions_class.cpp | 12 ++++++------
trunk/tools/quickbook/src/markups.cpp | 12 ------------
4 files changed, 26 insertions(+), 45 deletions(-)
Modified: trunk/tools/quickbook/src/actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions.cpp (original)
+++ trunk/tools/quickbook/src/actions.cpp 2011-03-10 13:55:18 EST (Thu, 10 Mar 2011)
@@ -107,6 +107,20 @@
out << post;
}
}
+
+ namespace {
+ void write_bridgehead(collector& out, int level,
+ std::string const& str, std::string const& id, std::string const& linkend)
+ {
+ out << "<bridgehead renderas=\"sect" << level << "\"";
+ if(!id.empty()) out << " id=\"" << id << "\"";
+ out << ">";
+ if(!linkend.empty()) out << "<link linkend=\"" << linkend << "\">";
+ out << str;
+ if(!linkend.empty()) out << "</link>";
+ out << "</bridgehead>";
+ }
+ }
void header_action::operator()(iterator first, iterator last) const
{
@@ -138,20 +152,8 @@
actions.anchors.push_back(anchor);
actions.output_pre(out);
- if (qbk_version_n < 103)
- {
- out << pre << str << post
- ;
- }
- else // version 1.3 and above
- {
- out << pre
- << "<link linkend=\"" << anchor << "\">"
- << str
- << "</link>"
- << post
- ;
- }
+ std::string linkend = qbk_version_n < 103 ? std::string() : anchor;
+ write_bridgehead(out, level, str, anchor + "-heading", linkend);
}
void generic_header_action::operator()(iterator first, iterator last) const
@@ -179,13 +181,7 @@
actions.anchors.push_back(anchor);
actions.output_pre(out);
- out
- << "<bridgehead renderas=\"sect" << level_ << "\">"
- << "<link linkend=\"" << anchor << "\">"
- << str
- << "</link>"
- << "</bridgehead>"
- ;
+ write_bridgehead(out, level_, str, anchor + "-heading", anchor);
}
void simple_phrase_action::operator()(iterator first, iterator last) const
Modified: trunk/tools/quickbook/src/actions.hpp
==============================================================================
--- trunk/tools/quickbook/src/actions.hpp (original)
+++ trunk/tools/quickbook/src/actions.hpp 2011-03-10 13:55:18 EST (Thu, 10 Mar 2011)
@@ -221,8 +221,7 @@
std::string const& library_id,
std::string const& section_id,
std::string const& qualified_section_id,
- std::string const& pre,
- std::string const& post,
+ int level,
quickbook::actions& actions)
: out(out)
, phrase(phrase)
@@ -230,8 +229,7 @@
, library_id(library_id)
, section_id(section_id)
, qualified_section_id(qualified_section_id)
- , pre(pre)
- , post(post)
+ , level(level)
, actions(actions) {}
void operator()(iterator first, iterator last) const;
@@ -242,8 +240,7 @@
std::string const& library_id;
std::string const& section_id;
std::string const& qualified_section_id;
- std::string pre;
- std::string post;
+ int level;
quickbook::actions& actions;
};
Modified: trunk/tools/quickbook/src/actions_class.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions_class.cpp (original)
+++ trunk/tools/quickbook/src/actions_class.cpp 2011-03-10 13:55:18 EST (Thu, 10 Mar 2011)
@@ -97,12 +97,12 @@
, inline_code(phrase, *this)
, inside_paragraph(out, phrase, paragraph_pre, paragraph_post, *this)
, h(out, phrase, element_id, doc_id, section_id, qualified_section_id, section_level, *this)
- , h1(out, phrase, element_id, doc_id, section_id, qualified_section_id, h1_pre, h1_post, *this)
- , h2(out, phrase, element_id, doc_id, section_id, qualified_section_id, h2_pre, h2_post, *this)
- , h3(out, phrase, element_id, doc_id, section_id, qualified_section_id, h3_pre, h3_post, *this)
- , h4(out, phrase, element_id, doc_id, section_id, qualified_section_id, h4_pre, h4_post, *this)
- , h5(out, phrase, element_id, doc_id, section_id, qualified_section_id, h5_pre, h5_post, *this)
- , h6(out, phrase, element_id, doc_id, section_id, qualified_section_id, h6_pre, h6_post, *this)
+ , h1(out, phrase, element_id, doc_id, section_id, qualified_section_id, 1, *this)
+ , h2(out, phrase, element_id, doc_id, section_id, qualified_section_id, 2, *this)
+ , h3(out, phrase, element_id, doc_id, section_id, qualified_section_id, 3, *this)
+ , h4(out, phrase, element_id, doc_id, section_id, qualified_section_id, 4, *this)
+ , h5(out, phrase, element_id, doc_id, section_id, qualified_section_id, 5, *this)
+ , h6(out, phrase, element_id, doc_id, section_id, qualified_section_id, 6, *this)
, hr(out, hr_, *this)
, blurb(out, blurb_pre, blurb_post, *this)
, blockquote(out, blockquote_pre, blockquote_post, *this)
Modified: trunk/tools/quickbook/src/markups.cpp
==============================================================================
--- trunk/tools/quickbook/src/markups.cpp (original)
+++ trunk/tools/quickbook/src/markups.cpp 2011-03-10 13:55:18 EST (Thu, 10 Mar 2011)
@@ -16,18 +16,6 @@
const char* comment_post = "-->";
const char* paragraph_pre = "<para>\n";
const char* paragraph_post = "</para>\n";
- const char* h1_pre = "<bridgehead renderas=\"sect1\">";
- const char* h1_post = "</bridgehead>";
- const char* h2_pre = "<bridgehead renderas=\"sect2\">";
- const char* h2_post = "</bridgehead>";
- const char* h3_pre = "<bridgehead renderas=\"sect3\">";
- const char* h3_post = "</bridgehead>";
- const char* h4_pre = "<bridgehead renderas=\"sect4\">";
- const char* h4_post = "</bridgehead>";
- const char* h5_pre = "<bridgehead renderas=\"sect5\">";
- const char* h5_post = "</bridgehead>";
- const char* h6_pre = "<bridgehead renderas=\"sect6\">";
- const char* h6_post = "</bridgehead>";
const char* hr_ = "<para/>";
const char* blurb_pre = "<sidebar role=\"blurb\">\n";
const char* blurb_post = "</sidebar>\n";
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