Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70525 - trunk/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2011-03-24 17:23:56


Author: danieljames
Date: 2011-03-24 17:23:54 EDT (Thu, 24 Mar 2011)
New Revision: 70525
URL: http://svn.boost.org/trac/boost/changeset/70525

Log:
Quickbook: Remove remainging uses for markup_action.
Text files modified:
   trunk/tools/quickbook/src/actions.cpp | 26 +++++++++++++++++++++++---
   trunk/tools/quickbook/src/actions.hpp | 27 ---------------------------
   trunk/tools/quickbook/src/actions_class.cpp | 5 -----
   trunk/tools/quickbook/src/actions_class.hpp | 4 ----
   trunk/tools/quickbook/src/block_tags.hpp | 1 +
   trunk/tools/quickbook/src/doc_info_grammar.cpp | 12 +++++++-----
   trunk/tools/quickbook/src/main_grammar.cpp | 23 +++++++++++++----------
   trunk/tools/quickbook/src/markups.cpp | 4 +++-
   trunk/tools/quickbook/src/phrase_tags.hpp | 1 +
   9 files changed, 48 insertions(+), 55 deletions(-)

Modified: trunk/tools/quickbook/src/actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions.cpp (original)
+++ trunk/tools/quickbook/src/actions.cpp 2011-03-24 17:23:54 EDT (Thu, 24 Mar 2011)
@@ -57,6 +57,7 @@
     void begin_section_action(quickbook::actions&, value);
     void end_section_action(quickbook::actions&, value, file_position);
     void block_action(quickbook::actions&, value);
+ void block_empty_action(quickbook::actions&, value);
     void macro_definition_action(quickbook::actions&, value);
     void template_body_action(quickbook::actions&, value);
     void variable_list_action(quickbook::actions&, value);
@@ -67,7 +68,8 @@
     void image_action(quickbook::actions&, value);
     void anchor_action(quickbook::actions&, value);
     void link_action(quickbook::actions&, value);
- void phrase_action_(quickbook::actions&, value);
+ void phrase_action(quickbook::actions&, value);
+ void raw_phrase_action(quickbook::actions&, value);
     void source_mode_action(quickbook::actions&, value);
 
     void element_action::operator()(iterator first, iterator) const
@@ -105,6 +107,8 @@
         case block_tags::note:
         case block_tags::tip:
             return block_action(actions,v);
+ case block_tags::hr:
+ return block_empty_action(actions,v);
         case block_tags::macro_definition:
             return macro_definition_action(actions,v);
         case block_tags::template_definition:
@@ -142,7 +146,9 @@
         case phrase_tags::quote:
         case phrase_tags::replaceable:
         case phrase_tags::footnote:
- return phrase_action_(actions, v);
+ return phrase_action(actions, v);
+ case phrase_tags::escape:
+ return raw_phrase_action(actions, v);
         case source_mode_tags::cpp:
         case source_mode_tags::python:
         case source_mode_tags::teletype:
@@ -211,7 +217,14 @@
         values.finish();
     }
 
- void phrase_action_(quickbook::actions& actions, value phrase)
+ void block_empty_action(quickbook::actions& actions, value block)
+ {
+ if(!actions.output_pre(actions.out)) return;
+ detail::markup markup = detail::markups[block.get_tag()];
+ actions.out << markup.pre;
+ }
+
+ void phrase_action(quickbook::actions& actions, value phrase)
     {
         if(!actions.output_pre(actions.phrase)) return;
         detail::markup markup = detail::markups[phrase.get_tag()];
@@ -221,6 +234,13 @@
         values.finish();
     }
 
+ void raw_phrase_action(quickbook::actions& actions, value phrase)
+ {
+ if(!actions.output_pre(actions.phrase)) return;
+ detail::markup markup = detail::markups[phrase.get_tag()];
+ actions.phrase << markup.pre << phrase.get_quickbook() << markup.post;
+ }
+
     void paragraph_action::operator()() const
     {
         if(actions.suppress) return;

Modified: trunk/tools/quickbook/src/actions.hpp
==============================================================================
--- trunk/tools/quickbook/src/actions.hpp (original)
+++ trunk/tools/quickbook/src/actions.hpp 2011-03-24 17:23:54 EDT (Thu, 24 Mar 2011)
@@ -289,33 +289,6 @@
         quickbook::actions& actions;
     };
 
- struct markup_action
- {
- // A generic markup action
-
- markup_action(
- collector& phrase,
- std::string const& str,
- quickbook::actions& actions)
- : phrase(phrase), str(str), actions(actions) {}
-
- template <typename T>
- void operator()(T const&) const
- {
- phrase << str;
- }
-
- template <typename T>
- void operator()(T const&, T const&) const
- {
- phrase << str;
- }
-
- collector& phrase;
- std::string str;
- quickbook::actions& actions;
- };
-
     struct code_action
     {
         // Does the actual syntax highlighing of code

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-24 17:23:54 EDT (Thu, 24 Mar 2011)
@@ -9,7 +9,6 @@
     http://www.boost.org/LICENSE_1_0.txt)
 =============================================================================*/
 #include "actions_class.hpp"
-#include "markups.hpp"
 #include "quickbook.hpp"
 #include "grammar.hpp"
 #include "input_path.hpp"
@@ -72,7 +71,6 @@
         , code_block(phrase, phrase, *this)
         , inline_code(phrase, *this)
         , paragraph(*this)
- , hr(out, hr_, *this)
         , space_char(phrase)
         , plain_char(phrase, *this)
         , raw_char(phrase, *this)
@@ -86,9 +84,6 @@
 
         , element_id_warning(*this)
 
- , escape_pre(phrase, escape_pre_, *this)
- , escape_post(phrase, escape_post_, *this)
-
         , output_pre(*this)
     {
         // add the predefined macros

Modified: trunk/tools/quickbook/src/actions_class.hpp
==============================================================================
--- trunk/tools/quickbook/src/actions_class.hpp (original)
+++ trunk/tools/quickbook/src/actions_class.hpp 2011-03-24 17:23:54 EDT (Thu, 24 Mar 2011)
@@ -119,7 +119,6 @@
         code_action code_block;
         inline_code_action inline_code;
         paragraph_action paragraph;
- markup_action hr;
         space space_char;
         plain_char_action plain_char;
         raw_char_action raw_char;
@@ -133,9 +132,6 @@
 
         element_id_warning_action element_id_warning;
 
- markup_action escape_pre;
- markup_action escape_post;
-
         pre_output_action output_pre;
     };
 }

Modified: trunk/tools/quickbook/src/block_tags.hpp
==============================================================================
--- trunk/tools/quickbook/src/block_tags.hpp (original)
+++ trunk/tools/quickbook/src/block_tags.hpp 2011-03-24 17:23:54 EDT (Thu, 24 Mar 2011)
@@ -24,6 +24,7 @@
         (xinclude)(import)(include)
         (paragraph)
         (list)(ordered_list)(itemized_list)
+ (hr)
     )
 
     QUICKBOOK_VALUE_TAGS(table_tags, 0x250,

Modified: trunk/tools/quickbook/src/doc_info_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/doc_info_grammar.cpp (original)
+++ trunk/tools/quickbook/src/doc_info_grammar.cpp 2011-03-24 17:23:54 EDT (Thu, 24 Mar 2011)
@@ -11,6 +11,7 @@
 #include "grammar_impl.hpp"
 #include "actions_class.hpp"
 #include "doc_info_tags.hpp"
+#include "phrase_tags.hpp"
 #include <boost/spirit/include/classic_core.hpp>
 #include <boost/spirit/include/classic_actor.hpp>
 #include <boost/spirit/include/classic_loops.hpp>
@@ -243,11 +244,12 @@
             | "\\U" >> cl::repeat_p(8)
                     [cl::chset<>("0-9a-fA-F")]
                                             [actions.escape_unicode]
- | (
- ("'''" >> !cl::eol_p) [actions.escape_pre]
- >> *(cl::anychar_p - "'''")[actions.raw_char]
- >> cl::str_p("'''") [actions.escape_post]
- )
+ | ("'''" >> !eol)
+ >> actions.values.save()
+ [ (*(cl::anychar_p - "'''"))
+ [actions.values.entry(ph::arg1, ph::arg2, phrase_tags::escape)]
+ >> cl::str_p("'''") [actions.element]
+ ]
             | cl::anychar_p [actions.plain_char]
             ;
     }

Modified: trunk/tools/quickbook/src/main_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/main_grammar.cpp (original)
+++ trunk/tools/quickbook/src/main_grammar.cpp 2011-03-24 17:23:54 EDT (Thu, 24 Mar 2011)
@@ -13,6 +13,7 @@
 #include "utils.hpp"
 #include "template_tags.hpp"
 #include "block_tags.hpp"
+#include "phrase_tags.hpp"
 #include "parsers.hpp"
 #include "scoped.hpp"
 #include <boost/spirit/include/classic_core.hpp>
@@ -157,7 +158,7 @@
         local.blocks =
            *( local.code
             | local.list
- | local.hr [actions.hr]
+ | local.hr
             | +eol
             )
             ;
@@ -169,9 +170,11 @@
             ;
 
         local.hr =
- cl::str_p("----")
- >> *(cl::anychar_p - eol)
- >> +eol
+ cl::str_p("----")
+ >> actions.values.list(block_tags::hr)
+ [ *(cl::anychar_p - eol)
+ >> +eol
+ ] [actions.element]
             ;
 
         local.element
@@ -469,13 +472,13 @@
                                                 [actions.escape_unicode]
             | "\\U" >> cl::repeat_p(8) [cl::chset<>("0-9a-fA-F")]
                                                 [actions.escape_unicode]
- | (
- ("'''" >> !eol) [actions.escape_pre]
- >> *(cl::anychar_p - "'''") [actions.raw_char]
- >> ( cl::str_p("'''") [actions.escape_post]
+ | ("'''" >> !eol)
+ >> actions.values.save()
+ [ (*(cl::anychar_p - "'''")) [actions.values.entry(ph::arg1, ph::arg2, phrase_tags::escape)]
+ >> ( cl::str_p("'''")
                     | cl::eps_p [actions.error("Unclosed boostbook escape.")]
- )
- )
+ ) [actions.element]
+ ]
             ;
 
         //

Modified: trunk/tools/quickbook/src/markups.cpp
==============================================================================
--- trunk/tools/quickbook/src/markups.cpp (original)
+++ trunk/tools/quickbook/src/markups.cpp 2011-03-24 17:23:54 EDT (Thu, 24 Mar 2011)
@@ -110,6 +110,7 @@
                 { block_tags::tip, tip_pre, tip_post },
                 { block_tags::ordered_list, "<orderedlist>", "</orderedlist>" },
                 { block_tags::itemized_list, "<itemizedlist>", "</itemizedlist>" },
+ { block_tags::hr, hr_, 0 },
                 { phrase_tags::url, url_pre_, url_post_ },
                 { phrase_tags::link, link_pre_, link_post_ },
                 { phrase_tags::funcref, funcref_pre_, funcref_post_ },
@@ -127,7 +128,8 @@
                 { phrase_tags::strikethrough, strikethrough_pre_, strikethrough_post_ },
                 { phrase_tags::quote, quote_pre_, quote_post_ },
                 { phrase_tags::replaceable, replaceable_pre_, replaceable_post_ },
- { phrase_tags::footnote, footnote_pre_, footnote_post_ }
+ { phrase_tags::footnote, footnote_pre_, footnote_post_ },
+ { phrase_tags::escape, escape_pre_, escape_post_ }
             };
 
             BOOST_FOREACH(markup m, init_markups)

Modified: trunk/tools/quickbook/src/phrase_tags.hpp
==============================================================================
--- trunk/tools/quickbook/src/phrase_tags.hpp (original)
+++ trunk/tools/quickbook/src/phrase_tags.hpp 2011-03-24 17:23:54 EDT (Thu, 24 Mar 2011)
@@ -20,6 +20,7 @@
         (macroref)(headerref)(conceptref)(globalref)
         (bold)(italic)(underline)(teletype)(strikethrough)(quote)(replaceable)
         (footnote)
+ (escape)
     )
     
     QUICKBOOK_VALUE_NAMED_TAGS(source_mode_tags, 0x550,


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