Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73222 - in trunk/tools/quickbook: src test
From: dnljms_at_[hidden]
Date: 2011-07-18 19:48:54


Author: danieljames
Date: 2011-07-18 19:48:53 EDT (Mon, 18 Jul 2011)
New Revision: 73222
URL: http://svn.boost.org/trac/boost/changeset/73222

Log:
Quickbook: Add ids to footnotes.
Text files modified:
   trunk/tools/quickbook/src/actions.cpp | 20 +++++++++++++++++++-
   trunk/tools/quickbook/src/actions_class.cpp | 1 +
   trunk/tools/quickbook/src/actions_class.hpp | 1 +
   trunk/tools/quickbook/src/markups.cpp | 1 -
   trunk/tools/quickbook/test/blocks.gold | 2 +-
   trunk/tools/quickbook/test/list_test.gold | 2 +-
   trunk/tools/quickbook/test/quickbook-manual.gold | 4 ++--
   7 files changed, 25 insertions(+), 6 deletions(-)

Modified: trunk/tools/quickbook/src/actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions.cpp (original)
+++ trunk/tools/quickbook/src/actions.cpp 2011-07-18 19:48:53 EDT (Mon, 18 Jul 2011)
@@ -84,6 +84,7 @@
     void anchor_action(quickbook::actions&, value);
     void link_action(quickbook::actions&, value);
     void phrase_action(quickbook::actions&, value);
+ void footnote_action(quickbook::actions&, value);
     void raw_phrase_action(quickbook::actions&, value);
     void source_mode_action(quickbook::actions&, value);
     void do_template_action(quickbook::actions&, value, file_position);
@@ -161,8 +162,9 @@
         case phrase_tags::strikethrough:
         case phrase_tags::quote:
         case phrase_tags::replaceable:
- case phrase_tags::footnote:
             return phrase_action(actions, v);
+ case phrase_tags::footnote:
+ return footnote_action(actions, v);
         case phrase_tags::escape:
             return raw_phrase_action(actions, v);
         case source_mode_tags::cpp:
@@ -258,6 +260,22 @@
         values.finish();
     }
 
+ void footnote_action(quickbook::actions& actions, value phrase)
+ {
+ if (actions.suppress) return;
+ write_anchors(actions, actions.phrase);
+
+ value_consumer values = phrase;
+ actions.phrase
+ << "<footnote id=\""
+ << actions.doc_id << ".f"
+ << boost::lexical_cast<std::string>(actions.footnote_id_count++)
+ << "\"><para>"
+ << values.consume().get_boostbook()
+ << "</para></footnote>";
+ values.finish();
+ }
+
     void raw_phrase_action(quickbook::actions& actions, value phrase)
     {
         if (actions.suppress) return;

Modified: trunk/tools/quickbook/src/actions_class.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions_class.cpp (original)
+++ trunk/tools/quickbook/src/actions_class.cpp 2011-07-18 19:48:53 EDT (Mon, 18 Jul 2011)
@@ -56,6 +56,7 @@
 
     // temporary or global state
         , callout_id_count(0)
+ , footnote_id_count(0)
         , template_depth(0)
         , templates()
         , error_count(0)

Modified: trunk/tools/quickbook/src/actions_class.hpp
==============================================================================
--- trunk/tools/quickbook/src/actions_class.hpp (original)
+++ trunk/tools/quickbook/src/actions_class.hpp 2011-07-18 19:48:53 EDT (Mon, 18 Jul 2011)
@@ -94,6 +94,7 @@
 
     // temporary or global state
         int callout_id_count;
+ int footnote_id_count;
         int template_depth;
         template_stack templates;
         int error_count;

Modified: trunk/tools/quickbook/src/markups.cpp
==============================================================================
--- trunk/tools/quickbook/src/markups.cpp (original)
+++ trunk/tools/quickbook/src/markups.cpp 2011-07-18 19:48:53 EDT (Mon, 18 Jul 2011)
@@ -54,7 +54,6 @@
                 { phrase_tags::strikethrough, "<emphasis role=\"strikethrough\">", "</emphasis>" },
                 { phrase_tags::quote, "<quote>", "</quote>" },
                 { phrase_tags::replaceable, "<replaceable>", "</replaceable>" },
- { phrase_tags::footnote, "<footnote><para>", "</para></footnote>" },
                 { phrase_tags::escape, "<!--quickbook-escape-prefix-->", "<!--quickbook-escape-postfix-->" },
                 { phrase_tags::break_mark, "<sbr/>\n", 0 }
             };

Modified: trunk/tools/quickbook/test/blocks.gold
==============================================================================
--- trunk/tools/quickbook/test/blocks.gold (original)
+++ trunk/tools/quickbook/test/blocks.gold 2011-07-18 19:48:53 EDT (Mon, 18 Jul 2011)
@@ -76,7 +76,7 @@
   </bridgehead>
   <blockquote>
     <para>
- Blockquote containing a footnote<footnote>
+ Blockquote containing a footnote<footnote id="various_blocks.f0">
       <para>
         Here it is!
       </para>

Modified: trunk/tools/quickbook/test/list_test.gold
==============================================================================
--- trunk/tools/quickbook/test/list_test.gold (original)
+++ trunk/tools/quickbook/test/list_test.gold 2011-07-18 19:48:53 EDT (Mon, 18 Jul 2011)
@@ -231,7 +231,7 @@
     </listitem>
     <listitem>
       <simpara>
- <footnote>
+ <footnote id="list_test.f0">
         <para>
           Footnote
         </para>

Modified: trunk/tools/quickbook/test/quickbook-manual.gold
==============================================================================
--- trunk/tools/quickbook/test/quickbook-manual.gold (original)
+++ trunk/tools/quickbook/test/quickbook-manual.gold 2011-07-18 19:48:53 EDT (Mon, 18 Jul 2011)
@@ -404,7 +404,7 @@
         </para>
         <para>
           Unlike QuickBook's standard formatting scheme, the rules for simpler alternatives
- are much stricter<footnote>
+ are much stricter<footnote id="quickbook.f0">
           <para>
             Thanks to David Barrett, author of <ulink url="http://quinthar.com/qwikiwiki/index.php?page=Home">Qwiki</ulink>,
             for sharing these samples and teaching me these obscure formatting rules.
@@ -1030,7 +1030,7 @@
 <programlisting><!--quickbook-escape-prefix-->[footnote A sample footnote]
 <!--quickbook-escape-postfix--></programlisting>
         <para>
- will generate this<footnote>
+ will generate this<footnote id="quickbook.f1">
           <para>
             A sample footnote
           </para>


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