Update of /cvsroot/boost/boost/tools/quickbook/detail
In directory
sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10849/tools/quickbook_backend/detail
Modified Files:
Tag: QUICKBOOK_BACKEND
actions.cpp actions.hpp actions_class.cpp actions_class.hpp
quickbook.cpp
Log Message:
Support for abstracting the backend format generation into templates. Starting
out with a few hard wired settings and only the image element implemented.
Index: actions.cpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/detail/actions.cpp,v
retrieving revision 1.49
retrieving revision 1.49.2.1
diff -u -d -r1.49 -r1.49.2.1
--- actions.cpp 28 Feb 2007 10:20:37 -0000 1.49
+++ actions.cpp 13 Apr 2007 03:28:16 -0000 1.49.2.1
@@ -593,6 +593,12 @@
--actions.template_depth;
}
+ void do_template_action::operator()(std::string const & name, iterator
first, iterator last) const
+ {
+ actions.template_info.insert(actions.template_info.begin(),name);
+ do_template_action::operator()(first,last);
+ }
+
void link_action::operator()(iterator first, iterator last) const
{
iterator save = first;
@@ -1170,4 +1176,13 @@
{
phrase.swap(out);
}
+
+ void backend_action::operator()(iterator first, iterator last) const
+ {
+ do_template_action::operator()(
+ this->actions.backend_tag+"_"+this->action_name,
+ first,
+ last
+ );
+ }
}
Index: actions.hpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/detail/actions.hpp,v
retrieving revision 1.36
retrieving revision 1.36.2.1
diff -u -d -r1.36 -r1.36.2.1
--- actions.hpp 27 Feb 2007 15:22:15 -0000 1.36
+++ actions.hpp 13 Apr 2007 03:28:16 -0000 1.36.2.1
@@ -497,6 +497,7 @@
: actions(actions) {}
void operator()(iterator first, iterator last) const;
+ void operator()(std::string const & name, iterator first, iterator
last) const;
quickbook::actions& actions;
};
@@ -695,6 +696,22 @@
std::string& out;
collector& phrase;
};
+
+ struct backend_action : protected do_template_action
+ {
+ backend_action(
+ std::string const & action_name,
+ quickbook::actions & actions
+ )
+ : do_template_action(actions)
+ , action_name(action_name)
+ {
+ }
+
+ void operator()(iterator first, iterator last) const;
+
+ std::string action_name;
+ };
}
#endif // BOOST_SPIRIT_QUICKBOOK_ACTIONS_HPP
Index: actions_class.cpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/detail/actions_class.cpp,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -u -d -r1.9 -r1.9.2.1
--- actions_class.cpp 27 Feb 2007 15:22:15 -0000 1.9
+++ actions_class.cpp 13 Apr 2007 03:28:16 -0000 1.9.2.1
@@ -18,8 +18,11 @@
namespace quickbook
{
actions::actions(char const* filein_, fs::path const& outdir_,
string_stream& out_)
+ // backend, default
+ : backend_file("boostbook.qbk")
+ , backend_tag("boostbook")
// header info
- : doc_type()
+ , doc_type()
, doc_title()
, doc_version()
, doc_id()
@@ -91,7 +94,7 @@
, tip(out, temp_para, tip_pre, tip_post)
, plain_char(phrase)
, raw_char(phrase)
- , image(phrase)
+ , image("image",*this)
, list(out, list_buffer, list_indent, list_marks)
, list_format(list_buffer, list_indent, list_marks)
Index: actions_class.hpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/detail/actions_class.hpp,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -u -d -r1.9 -r1.9.2.1
--- actions_class.hpp 27 Feb 2007 15:22:15 -0000 1.9
+++ actions_class.hpp 13 Apr 2007 03:28:16 -0000 1.9.2.1
@@ -30,6 +30,10 @@
typedef std::vector<std::pair<std::string, std::string> > author_list;
typedef std::pair<char, int> mark_type;
static int const max_template_depth = 100;
+
+ // backend
+ std::string backend_file;
+ std::string backend_tag;
// header info
std::string doc_type;
@@ -112,7 +116,7 @@
phrase_action warning, caution, important, note, tip;
plain_char_action plain_char;
raw_char_action raw_char;
- image_action image;
+ backend_action image;
list_action list;
list_format_action list_format;
Index: quickbook.cpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/detail/quickbook.cpp,v
retrieving revision 1.29
retrieving revision 1.29.2.1
diff -u -d -r1.29 -r1.29.2.1
--- quickbook.cpp 20 Dec 2006 15:41:20 -0000 1.29
+++ quickbook.cpp 13 Apr 2007 03:28:16 -0000 1.29.2.1
@@ -91,6 +91,23 @@
parse(char const* filein_, fs::path const& outdir, string_stream& out,
bool ignore_docinfo = false)
{
actions actor(filein_, outdir, out);
+
+ // prevent output from parsing the backend templates from appearing
+ // in the real output
+ actor.out.push();
+
+ // include the default backend templates
+ typedef position_iterator<std::string::const_iterator> string_pos_iter;
+ string_pos_iter backendFirst(
+ actor.backend_file.begin(),actor.backend_file.end(),
+ filein_);
+ string_pos_iter backendLast(
+ actor.backend_file.end(),actor.backend_file.end());
+ actor.include(backendFirst,backendLast);
+
+ // and throw the template output away
+ actor.out.pop();
+
bool r = parse(filein_, actor);
if (actor.section_level != 0)
detail::outwarn(filein_,1)
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/boost-cvs