Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59556 - branches/quickbook-1.5-spirit2
From: daniel_james_at_[hidden]
Date: 2010-02-07 04:09:30


Author: danieljames
Date: 2010-02-07 04:09:28 EST (Sun, 07 Feb 2010)
New Revision: 59556
URL: http://svn.boost.org/trac/boost/changeset/59556

Log:
The rest of the phrase actions.
Text files modified:
   branches/quickbook-1.5-spirit2/boostbook.cpp | 5 +++++
   branches/quickbook-1.5-spirit2/boostbook.hpp | 1 +
   branches/quickbook-1.5-spirit2/code.hpp | 2 --
   branches/quickbook-1.5-spirit2/phrase_actions.cpp | 40 ++++++++++++++--------------------------
   branches/quickbook-1.5-spirit2/phrase_actions.hpp | 4 ++++
   branches/quickbook-1.5-spirit2/process.cpp | 3 ---
   branches/quickbook-1.5-spirit2/template.hpp | 2 --
   7 files changed, 24 insertions(+), 33 deletions(-)

Modified: branches/quickbook-1.5-spirit2/boostbook.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/boostbook.cpp (original)
+++ branches/quickbook-1.5-spirit2/boostbook.cpp 2010-02-07 04:09:28 EST (Sun, 07 Feb 2010)
@@ -131,4 +131,9 @@
         boostbook_markup m = markup_map.at(x.type);
         actions.phrase << m.pre << x.content << m.post;
     }
+
+ void output(quickbook::actions& actions, break_ const& x) {
+ boostbook_markup m = markup_map.at("break");
+ actions.phrase << m.pre;
+ }
 }

Modified: branches/quickbook-1.5-spirit2/boostbook.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/boostbook.hpp (original)
+++ branches/quickbook-1.5-spirit2/boostbook.hpp 2010-02-07 04:09:28 EST (Sun, 07 Feb 2010)
@@ -13,6 +13,7 @@
     void output(quickbook::actions&, anchor const&);
     void output(quickbook::actions&, link const&);
     void output(quickbook::actions&, formatted const&);
+ void output(quickbook::actions&, break_ const&);
 
     std::string encode(std::string const&);
     std::string encode(char);

Modified: branches/quickbook-1.5-spirit2/code.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/code.hpp (original)
+++ branches/quickbook-1.5-spirit2/code.hpp 2010-02-07 04:09:28 EST (Sun, 07 Feb 2010)
@@ -21,8 +21,6 @@
         file_position position;
         std::string code;
     };
-
- nothing process(quickbook::actions&, code const&);
 }
 
 BOOST_FUSION_ADAPT_STRUCT(

Modified: branches/quickbook-1.5-spirit2/phrase_actions.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/phrase_actions.cpp (original)
+++ branches/quickbook-1.5-spirit2/phrase_actions.cpp 2010-02-07 04:09:28 EST (Sun, 07 Feb 2010)
@@ -65,37 +65,37 @@
         return r;
     }
 
- nothing process(quickbook::actions& actions, cond_phrase const& x) {
+ std::string process(quickbook::actions& actions, cond_phrase const& x) {
         bool symbol_found = actions.macro.find(x.macro_id.c_str());
 
- if (!x.content.empty() && symbol_found) {
- actions.phrase << x.content; // print the body
- }
- return nothing();
+ return (!x.content.empty() && symbol_found) ? x.content : "";
     }
 
- nothing process(quickbook::actions& actions, break_ const& x) {
+ break_ process(quickbook::actions& actions, break_ const& x) {
         detail::outwarn(x.position.file,x.position.line)
             << "in column:" << x.position.column << ", "
             << "[br] and \\n are deprecated" << ".\n";
- actions.phrase << break_mark;
- return nothing();
+ return x;
     }
 
- nothing process(quickbook::actions& actions, code const& x) {
+ formatted process(quickbook::actions& actions, code const& x) {
+ formatted r;
+ r.type = "";
+
          std::string program = x.code;
     
         if(x.block) {
             // preprocess the code section to remove the initial indentation
             detail::unindent(program);
             if (program.size() == 0)
- return nothing(); // Nothing left to do here. The program is empty.
+ return r; // Nothing left to do here. The program is empty.
         }
 
         iterator first_(program.begin(), program.end());
         iterator last_(program.end(), program.end());
         first_.set_position(x.position);
 
+ // TODO: I don't need to save this, do I?
         std::string save;
         actions.phrase.swap(save);
 
@@ -103,21 +103,9 @@
         std::string str = actions.syntax_p(first_, last_);
 
         actions.phrase.swap(save);
-
- if(x.block) {
- //
- // We must not place a \n after the <programlisting> tag
- // otherwise PDF output starts code blocks with a blank line:
- //
- actions.phrase << "<programlisting>";
- actions.phrase << str;
- actions.phrase << "</programlisting>\n";
- }
- else {
- actions.phrase << "<code>";
- actions.phrase << str;
- actions.phrase << "</code>";
- }
- return nothing();
+
+ r.type = x.block ? "programlisting" : "code";
+ r.content = str;
+ return r;
     }
 }

Modified: branches/quickbook-1.5-spirit2/phrase_actions.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/phrase_actions.hpp (original)
+++ branches/quickbook-1.5-spirit2/phrase_actions.hpp 2010-02-07 04:09:28 EST (Sun, 07 Feb 2010)
@@ -1,4 +1,5 @@
 #include "phrase.hpp"
+#include "code.hpp"
 
 namespace quickbook
 {
@@ -6,4 +7,7 @@
     std::string process(quickbook::actions&, macro const&);
     link process(quickbook::actions&, link const&);
     formatted process(quickbook::actions&, simple_markup const&);
+ std::string process(quickbook::actions&, cond_phrase const&);
+ break_ process(quickbook::actions&, break_ const&);
+ formatted process(quickbook::actions&, code const&);
 }

Modified: branches/quickbook-1.5-spirit2/process.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/process.cpp (original)
+++ branches/quickbook-1.5-spirit2/process.cpp 2010-02-07 04:09:28 EST (Sun, 07 Feb 2010)
@@ -38,8 +38,6 @@
 
     void output(quickbook::actions&, std::string const&);
     nothing process(quickbook::actions&, call_template const&);
- nothing process(quickbook::actions&, cond_phrase const&);
- nothing process(quickbook::actions&, break_ const&);
     nothing process(quickbook::actions&, image const&);
     nothing process(quickbook::actions&, hr);
     nothing process(quickbook::actions&, paragraph const&);
@@ -53,7 +51,6 @@
     nothing process(quickbook::actions&, xinclude const&);
     nothing process(quickbook::actions&, import const&);
     nothing process(quickbook::actions&, include const&);
- nothing process(quickbook::actions&, code const&);
     nothing process(quickbook::actions&, define_template const&);
     nothing process(quickbook::actions&, code_token const&);
 

Modified: branches/quickbook-1.5-spirit2/template.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/template.hpp (original)
+++ branches/quickbook-1.5-spirit2/template.hpp 2010-02-07 04:09:28 EST (Sun, 07 Feb 2010)
@@ -39,8 +39,6 @@
         quickbook::file_position position;
     };
 
- nothing process(quickbook::actions&, define_template const&);
-
     struct template_scope;
     struct template_symbol;
 


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