Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59571 - branches/quickbook-1.5-spirit2
From: daniel_james_at_[hidden]
Date: 2010-02-07 09:48:52


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

Log:
Add html support to the post processor.
Text files modified:
   branches/quickbook-1.5-spirit2/post_process.cpp | 30 +++++++++++++++++++++++++-----
   1 files changed, 25 insertions(+), 5 deletions(-)

Modified: branches/quickbook-1.5-spirit2/post_process.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/post_process.cpp (original)
+++ branches/quickbook-1.5-spirit2/post_process.cpp 2010-02-07 09:48:51 EST (Sun, 07 Feb 2010)
@@ -14,6 +14,7 @@
 #include <boost/spirit/include/qi_char_.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_bind.hpp>
+#include <boost/spirit/include/phoenix_operator.hpp>
 #include <set>
 #include <stack>
 #include <cctype>
@@ -215,6 +216,18 @@
         , "warning"
         , "xml"
         , "xi:include"
+
+ // TODO: Should separate html and boostbook tags.
+ , "dd"
+ , "dl"
+ , "dt"
+ , "div"
+ , "ol"
+ , "p"
+ , "pre"
+ , "td"
+ , "tr"
+ , "ul"
     };
 
     char const* doc_types_[] =
@@ -280,10 +293,15 @@
                 ]]
                [ph::bind(&tidy_grammar::do_tag, this, qi::_1)];
 
- code = qi::raw[
- "<programlisting>"
- >> *(qi::char_ - "</programlisting>")
- >> "</programlisting>"
+ code_tags.add
+ ("<programlisting>", "</programlisting>")
+ ("<pre>", "</pre>")
+ ;
+
+ code %= qi::raw[
+ code_tags [qi::_a = qi::_1]
+ >> *(qi::char_ - qi::lit(qi::_a))
+ >> qi::lit(qi::_a)
                 ];
 
             // What's the business of lexeme_d['>' >> *space]; ?
@@ -421,7 +439,9 @@
                             markup, escape;
         qi::rule<Iterator, std::string()>
                             start_tag, start_end_tag,
- content, end_tag, code;
+ content, end_tag;
+ qi::rule<Iterator, qi::locals<std::string>, std::string()> code;
+ qi::symbols<char, std::string> code_tags;
     };
 
     int post_process(


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