Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75621 - branches/quickbook-dev/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2011-11-22 18:47:35


Author: danieljames
Date: 2011-11-22 18:47:34 EST (Tue, 22 Nov 2011)
New Revision: 75621
URL: http://svn.boost.org/trac/boost/changeset/75621

Log:
Quickbook: Extract image attribute printer.
Text files modified:
   branches/quickbook-dev/tools/quickbook/src/actions.cpp | 40 ++++++++++++++++++++--------------------
   branches/quickbook-dev/tools/quickbook/src/phrase_element_grammar.cpp | 2 ++
   2 files changed, 22 insertions(+), 20 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-22 18:47:34 EST (Tue, 22 Nov 2011)
@@ -671,6 +671,24 @@
         }
     }
 
+ void write_plain_text(std::ostream& out, value const& v)
+ {
+ if (v.is_encoded())
+ {
+ detail::print_string(v.get_encoded(), out);
+ }
+ else {
+ std::string value = v.get_quickbook();
+ for(std::string::const_iterator
+ first = value.begin(), last = value.end();
+ first != last; ++first)
+ {
+ if (*first == '\\' && ++first == last) break;
+ detail::print_char(*first, out);
+ }
+ }
+ }
+
     void image_action(quickbook::actions& actions, value image)
     {
         write_anchors(actions, actions.phrase);
@@ -826,23 +844,7 @@
         BOOST_FOREACH(attribute_map::value_type const& attr, attributes)
         {
             actions.phrase << " " << attr.first << "=\"";
-
- if (attr.second.is_encoded())
- {
- detail::print_string(attr.second.get_encoded(),
- actions.phrase.get());
- }
- else {
- std::string value = attr.second.get_quickbook();
- for(std::string::const_iterator
- first = value.begin(), last = value.end();
- first != last; ++first)
- {
- if (*first == '\\' && ++first == last) break;
- detail::print_char(*first, actions.phrase.get());
- }
- }
-
+ write_plain_text(actions.phrase.get(), attr.second);
             actions.phrase << "\"";
         }
 
@@ -852,9 +854,7 @@
         // This will be used for the alt tag in html.
         if (alt_text.check()) {
             actions.phrase << "<textobject><phrase>";
- detail::print_string(alt_text.is_encoded() ?
- alt_text.get_encoded() : alt_text.get_quickbook(),
- actions.phrase.get());
+ write_plain_text(actions.phrase.get(), alt_text);
             actions.phrase << "</phrase></textobject>";
         }
 

Modified: branches/quickbook-dev/tools/quickbook/src/phrase_element_grammar.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/phrase_element_grammar.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/phrase_element_grammar.cpp 2011-11-22 18:47:34 EST (Tue, 22 Nov 2011)
@@ -51,6 +51,8 @@
             ("$", element_info(element_info::phrase, &local.image, phrase_tags::image))
             ;
 
+ // Note that the attribute values here are encoded in plain text not
+ // boostbook.
         local.image =
                 qbk_since(105u)
>> blank


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