|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r69174 - branches/quickbook-filenames/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2011-02-22 15:35:58
Author: danieljames
Date: 2011-02-22 15:35:54 EST (Tue, 22 Feb 2011)
New Revision: 69174
URL: http://svn.boost.org/trac/boost/changeset/69174
Log:
Rest of the block elements.
Text files modified:
branches/quickbook-filenames/tools/quickbook/src/actions.cpp | 68 ++++++++++++++++++++++++++-------------
branches/quickbook-filenames/tools/quickbook/src/actions.hpp | 60 -----------------------------------
branches/quickbook-filenames/tools/quickbook/src/actions_class.cpp | 7 ----
branches/quickbook-filenames/tools/quickbook/src/actions_class.hpp | 7 ----
branches/quickbook-filenames/tools/quickbook/src/block_element_grammar.cpp | 23 +++++--------
branches/quickbook-filenames/tools/quickbook/src/block_tags.hpp | 4 +
6 files changed, 57 insertions(+), 112 deletions(-)
Modified: branches/quickbook-filenames/tools/quickbook/src/actions.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/actions.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/actions.cpp 2011-02-22 15:35:54 EST (Tue, 22 Feb 2011)
@@ -55,6 +55,11 @@
void block_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);
+ void table_action(quickbook::actions&, value);
+ void xinclude_action(quickbook::actions&, value);
+ void import_action(quickbook::actions&, value);
+ void include_action(quickbook::actions&, value);
void element_action::operator()(iterator first, iterator) const
{
@@ -90,6 +95,16 @@
return macro_definition_action(actions,v);
case block_tags::template_definition:
return template_body_action(actions,v);
+ case block_tags::variable_list:
+ return variable_list_action(actions, v);
+ case block_tags::table:
+ return table_action(actions, v);
+ case block_tags::xinclude:
+ return xinclude_action(actions, v);
+ case block_tags::import:
+ return import_action(actions, v);
+ case block_tags::include:
+ return include_action(actions, v);
default:
break;
}
@@ -1213,11 +1228,11 @@
}
}
- void variablelist_action::operator()(iterator, iterator) const
+ void variable_list_action(quickbook::actions& actions, value variable_list)
{
if(actions.suppress) return;
- value_consumer values = actions.values.get();
+ value_consumer values = variable_list;
std::string title = values.consume(table_tags::title).get_quickbook();
actions.out << "<variablelist>\n";
@@ -1247,11 +1262,11 @@
actions.out << "</variablelist>\n";
}
- void table_action::operator()(iterator, iterator) const
+ void table_action(quickbook::actions& actions, value table)
{
if(actions.suppress) return;
- value_consumer values = actions.values.get();
+ value_consumer values = table;
std::string element_id;
if(values.is(general_tags::element_id))
@@ -1444,14 +1459,13 @@
return std::accumulate(file, path.end(), result, concat);
}
- std::string check_path(iterator first, iterator last,
- quickbook::actions& actions)
+ std::string check_path(value const& path, quickbook::actions& actions)
{
- std::string path_text(first, last);
+ std::string path_text = path.get_quickbook();
if(path_text.find('\\') != std::string::npos)
{
- detail::outwarn(actions.filename, first.get_position().line)
+ detail::outwarn(actions.filename, path.get_position().line)
<< "Path isn't portable: "
<< detail::utf8(path_text)
<< std::endl;
@@ -1476,14 +1490,18 @@
return path;
}
- void xinclude_action::operator()(iterator first, iterator last) const
+ void xinclude_action(quickbook::actions& actions, value xinclude)
{
- if(!actions.output_pre(out)) return;
+ if(!actions.output_pre(actions.out)) return;
+
+ value_consumer values = xinclude;
+ fs::path path = calculate_relative_path(
+ check_path(values.consume(), actions), actions);
+ assert(!values.is());
- fs::path path = calculate_relative_path(check_path(first, last, actions), actions);
- out << "\n<xi:include href=\"";
- detail::print_string(detail::escape_uri(path.generic_string()), out.get());
- out << "\" />\n";
+ actions.out << "\n<xi:include href=\"";
+ detail::print_string(detail::escape_uri(path.generic_string()), actions.out.get());
+ actions.out << "\" />\n";
}
namespace
@@ -1516,12 +1534,15 @@
}
}
- void import_action::operator()(iterator first, iterator last) const
+ void import_action(quickbook::actions& actions, value import)
{
if(!actions.output_pre(actions.out)) return;
+ value_consumer values = import;
fs::path path = include_search(actions.filename.parent_path(),
- check_path(first, last, actions));
+ check_path(values.consume(), actions));
+ assert(!values.is());
+
std::string ext = path.extension().generic_string();
std::vector<template_symbol> storage;
actions.error_count +=
@@ -1540,12 +1561,16 @@
}
}
- void include_action::operator()(iterator first, iterator last) const
+ void include_action(quickbook::actions& actions, value include)
{
if(!actions.output_pre(actions.out)) return;
+ value_consumer values = include;
+ value include_doc_id = values.optional_consume(general_tags::include_id);
fs::path filein = include_search(actions.filename.parent_path(),
- check_path(first, last, actions));
+ check_path(values.consume(), actions));
+ assert(!values.is());
+
std::string doc_type, doc_id;
// swap the filenames
@@ -1575,11 +1600,8 @@
// if an id is specified in this include (as in [include:id foo.qbk])
// then use it as the doc_id.
- if (!actions.include_doc_id.empty())
- {
- actions.doc_id = actions.include_doc_id;
- actions.include_doc_id.clear();
- }
+ if (!include_doc_id.is_empty())
+ actions.doc_id = include_doc_id.get_quickbook();
// update the __FILENAME__ macro
*boost::spirit::classic::find(actions.macro, "__FILENAME__")
Modified: branches/quickbook-filenames/tools/quickbook/src/actions.hpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/actions.hpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/actions.hpp 2011-02-22 15:35:54 EST (Tue, 22 Feb 2011)
@@ -545,30 +545,6 @@
quickbook::actions& actions;
};
- struct variablelist_action
- {
- // Handles variable lists
-
- variablelist_action(quickbook::actions& actions)
- : actions(actions) {}
-
- void operator()(iterator, iterator) const;
-
- quickbook::actions& actions;
- };
-
- struct table_action
- {
- // Handles tables
-
- table_action(quickbook::actions& actions)
- : actions(actions) {}
-
- void operator()(iterator, iterator) const;
-
- quickbook::actions& actions;
- };
-
struct element_id_warning_action
{
element_id_warning_action(quickbook::actions& actions_)
@@ -579,42 +555,6 @@
quickbook::actions& actions;
};
- struct xinclude_action
- {
- // Handles XML includes
- xinclude_action(collector& out_, quickbook::actions& actions_)
- : out(out_), actions(actions_) {}
-
- void operator()(iterator first, iterator last) const;
-
- collector& out;
- quickbook::actions& actions;
- };
-
- struct include_action
- {
- // Handles QBK includes
-
- include_action(quickbook::actions& actions_)
- : actions(actions_) {}
-
- void operator()(iterator first, iterator last) const;
-
- quickbook::actions& actions;
- };
-
- struct import_action
- {
- // Handles import of source code files (e.g. *.cpp *.py)
- import_action(collector& out_, quickbook::actions& actions_)
- : out(out_), actions(actions_) {}
-
- void operator()(iterator first, iterator last) const;
-
- collector& out;
- quickbook::actions& actions;
- };
-
void pre(collector& out, quickbook::actions& actions, bool ignore_docinfo = false);
void post(collector& out, quickbook::actions& actions, bool ignore_docinfo = false);
Modified: branches/quickbook-filenames/tools/quickbook/src/actions_class.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/actions_class.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/actions_class.cpp 2011-02-22 15:35:54 EST (Tue, 22 Feb 2011)
@@ -27,7 +27,6 @@
, doc_type()
, doc_title_qbk()
, doc_id()
- , include_doc_id()
// main output stream
, out(out_)
@@ -118,8 +117,6 @@
, simple_teletype(phrase, teletype_pre_, teletype_post_, macro, *this)
, simple_strikethrough(phrase, strikethrough_pre_, strikethrough_post_, macro, *this)
- , variablelist(*this)
-
, break_(phrase, *this)
, do_macro(phrase, *this)
, do_template(*this)
@@ -127,13 +124,9 @@
, url_post(phrase, url_post_, *this)
, link_pre(phrase, link_pre_, *this)
, link_post(phrase, link_post_, *this)
- , table(*this)
, anchor(*this)
, element_id_warning(*this)
- , xinclude(out, *this)
- , include(*this)
- , import(out, *this)
, escape_pre(phrase, escape_pre_, *this)
, escape_post(phrase, escape_post_, *this)
Modified: branches/quickbook-filenames/tools/quickbook/src/actions_class.hpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/actions_class.hpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/actions_class.hpp 2011-02-22 15:35:54 EST (Tue, 22 Feb 2011)
@@ -42,7 +42,6 @@
std::string doc_type;
std::string doc_title_qbk;
std::string doc_id;
- std::string include_doc_id;
// main output stream
collector out;
@@ -162,8 +161,6 @@
simple_phrase_action simple_teletype;
simple_phrase_action simple_strikethrough;
- variablelist_action variablelist;
-
break_action break_;
do_macro_action do_macro;
do_template_action do_template;
@@ -171,13 +168,9 @@
markup_action url_post;
link_action link_pre;
markup_action link_post;
- table_action table;
anchor_action anchor;
element_id_warning_action element_id_warning;
- xinclude_action xinclude;
- include_action include;
- import_action import;
markup_action escape_pre;
markup_action escape_post;
Modified: branches/quickbook-filenames/tools/quickbook/src/block_element_grammar.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/block_element_grammar.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/block_element_grammar.cpp 2011-02-22 15:35:54 EST (Tue, 22 Feb 2011)
@@ -175,7 +175,7 @@
;
elements.add
- ("variablelist", element_info(element_info::block, &local.variablelist))
+ ("variablelist", element_info(element_info::block, &local.variablelist, block_tags::variable_list))
;
local.variablelist =
@@ -183,7 +183,6 @@
>> (*(cl::anychar_p - eol)) [actions.values.entry(ph::arg1, ph::arg2, table_tags::title)]
>> (+eol) [actions.output_pre]
>> *local.varlistentry
- >> cl::eps_p [actions.variablelist]
;
local.varlistentry =
@@ -225,7 +224,7 @@
;
elements.add
- ("table", element_info(element_info::block, &local.table))
+ ("table", element_info(element_info::block, &local.table, block_tags::table))
;
local.table =
@@ -235,7 +234,6 @@
>> (*(cl::anychar_p - eol)) [actions.values.entry(ph::arg1, ph::arg2, table_tags::title)]
>> (+eol) [actions.output_pre]
>> *local.table_row
- >> cl::eps_p [actions.table]
;
local.table_row =
@@ -266,21 +264,19 @@
;
elements.add
- ("xinclude", element_info(element_info::conditional_or_block, &local.xinclude))
- ("import", element_info(element_info::conditional_or_block, &local.import))
- ("include", element_info(element_info::conditional_or_block, &local.include))
+ ("xinclude", element_info(element_info::conditional_or_block, &local.xinclude, block_tags::xinclude))
+ ("import", element_info(element_info::conditional_or_block, &local.import, block_tags::import))
+ ("include", element_info(element_info::conditional_or_block, &local.include, block_tags::include))
;
local.xinclude =
space
- >> (*(cl::anychar_p - phrase_end))
- [actions.xinclude]
+ >> (*(cl::anychar_p - phrase_end)) [actions.values.entry(ph::arg1, ph::arg2)]
;
local.import =
space
- >> (*(cl::anychar_p - phrase_end))
- [actions.import]
+ >> (*(cl::anychar_p - phrase_end)) [actions.values.entry(ph::arg1, ph::arg2)]
;
local.include =
@@ -289,11 +285,10 @@
!(
':'
>> (*((cl::alnum_p | '_') - cl::space_p))
- [cl::assign_a(actions.include_doc_id)]
+ [actions.values.entry(ph::arg1, ph::arg2, general_tags::include_id)]
>> space
)
- >> (*(cl::anychar_p - phrase_end))
- [actions.include]
+ >> (*(cl::anychar_p - phrase_end)) [actions.values.entry(ph::arg1, ph::arg2)]
;
local.inner_phrase =
Modified: branches/quickbook-filenames/tools/quickbook/src/block_tags.hpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/block_tags.hpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/block_tags.hpp 2011-02-22 15:35:54 EST (Tue, 22 Feb 2011)
@@ -20,6 +20,8 @@
(blurb)(blockquote)(preformatted)
(warning)(caution)(important)(note)(tip)
(macro_definition)(template_definition)
+ (variable_list)(table)
+ (xinclude)(import)(include)
)
QUICKBOOK_VALUE_TAGS(table_tags, 0x250,
@@ -27,7 +29,7 @@
)
QUICKBOOK_VALUE_TAGS(general_tags, 0x300,
- (element_id)
+ (element_id)(include_id)
)
}
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