|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r70232 - in trunk/tools/quickbook: . src test
From: dnljms_at_[hidden]
Date: 2011-03-20 17:46:12
Author: danieljames
Date: 2011-03-20 17:46:10 EDT (Sun, 20 Mar 2011)
New Revision: 70232
URL: http://svn.boost.org/trac/boost/changeset/70232
Log:
Quickbook: explicit list markup. Refs #1193.
Added:
trunk/tools/quickbook/test/elements_1_5.gold
- copied unchanged from r69438, /branches/quickbook-filenames/tools/quickbook/test/elements_1_5.gold
trunk/tools/quickbook/test/elements_1_5.quickbook
- copied unchanged from r69438, /branches/quickbook-filenames/tools/quickbook/test/elements_1_5.quickbook
trunk/tools/quickbook/test/elements_1_6.gold
- copied unchanged from r69438, /branches/quickbook-filenames/tools/quickbook/test/elements_1_6.gold
trunk/tools/quickbook/test/elements_1_6.quickbook
- copied unchanged from r69438, /branches/quickbook-filenames/tools/quickbook/test/elements_1_6.quickbook
Properties modified:
trunk/tools/quickbook/ (props changed)
Text files modified:
trunk/tools/quickbook/src/actions.cpp | 21 +++++++++++++++++++++
trunk/tools/quickbook/src/block_element_grammar.cpp | 9 ++++++++-
trunk/tools/quickbook/src/block_tags.hpp | 2 +-
trunk/tools/quickbook/src/grammar_impl.hpp | 6 ++++--
trunk/tools/quickbook/src/main_grammar.cpp | 3 ++-
trunk/tools/quickbook/src/markups.cpp | 2 ++
trunk/tools/quickbook/test/Jamfile.v2 | 2 ++
7 files changed, 40 insertions(+), 5 deletions(-)
Modified: trunk/tools/quickbook/src/actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions.cpp (original)
+++ trunk/tools/quickbook/src/actions.cpp 2011-03-20 17:46:10 EDT (Sun, 20 Mar 2011)
@@ -52,6 +52,7 @@
}
void list_action(quickbook::actions&, value);
+ void explicit_list_action(quickbook::actions&, value);
void header_action(quickbook::actions&, value);
void begin_section_action(quickbook::actions&, value);
void end_section_action(quickbook::actions&, value, file_position);
@@ -80,6 +81,9 @@
{
case block_tags::list:
return list_action(actions, v);
+ case block_tags::ordered_list:
+ case block_tags::itemized_list:
+ return explicit_list_action(actions, v);
case block_tags::generic_heading:
case block_tags::heading1:
case block_tags::heading2:
@@ -449,6 +453,23 @@
}
}
+ void explicit_list_action(quickbook::actions& actions, value list)
+ {
+ if(!actions.output_pre(actions.out)) return;
+ detail::markup markup = detail::markups[list.get_tag()];
+
+ actions.out << markup.pre;
+
+ BOOST_FOREACH(value item, list)
+ {
+ actions.out << "<listitem>";
+ actions.out << item.get_boostbook();
+ actions.out << "</listitem>";
+ }
+
+ actions.out << markup.post;
+ }
+
// TODO: No need to check suppress since this is only used in the syntax
// highlighter. I should moved this or something.
void span::operator()(iterator first, iterator last) const
Modified: trunk/tools/quickbook/src/block_element_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/block_element_grammar.cpp (original)
+++ trunk/tools/quickbook/src/block_element_grammar.cpp 2011-03-20 17:46:10 EDT (Sun, 20 Mar 2011)
@@ -29,7 +29,7 @@
cl::rule<scanner>
heading, inner_block, inner_phrase, def_macro,
table, table_row, variablelist,
- varlistentry, varlistterm, cell,
+ varlistentry, varlistterm, list, cell,
preformatted, begin_section, end_section,
xinclude, include,
template_, template_id, template_formal_arg,
@@ -232,6 +232,13 @@
)
;
+ elements.add
+ ("ordered_list", element_info(element_info::nested_block, &local.list, block_tags::ordered_list, 106))
+ ("itemized_list", element_info(element_info::nested_block, &local.list, block_tags::itemized_list, 106))
+ ;
+
+ local.list = *local.cell;
+
local.cell =
space
>> cl::ch_p('[')
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-20 17:46:10 EDT (Sun, 20 Mar 2011)
@@ -23,7 +23,7 @@
(variable_list)(table)
(xinclude)(import)(include)
(paragraph)
- (list)
+ (list)(ordered_list)(itemized_list)
)
QUICKBOOK_VALUE_TAGS(table_tags, 0x250,
Modified: trunk/tools/quickbook/src/grammar_impl.hpp
==============================================================================
--- trunk/tools/quickbook/src/grammar_impl.hpp (original)
+++ trunk/tools/quickbook/src/grammar_impl.hpp 2011-03-20 17:46:10 EDT (Sun, 20 Mar 2011)
@@ -43,12 +43,14 @@
element_info(
type_enum t,
cl::rule<scanner>* r,
- value::tag_type tag = value::default_tag)
- : type(t), rule(r), tag(tag) {}
+ value::tag_type tag = value::default_tag,
+ unsigned int v = 0)
+ : type(t), rule(r), tag(tag), qbk_version(v) {}
type_enum type;
cl::rule<scanner>* rule;
value::tag_type tag;
+ unsigned int qbk_version;
};
struct quickbook_grammar::impl
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-20 17:46:10 EDT (Sun, 20 Mar 2011)
@@ -35,7 +35,8 @@
bool start()
{
- if (!(l.info.type & l.actions_.context))
+ if (!(l.info.type & l.actions_.context) ||
+ qbk_version_n < l.info.qbk_version)
return false;
info_ = l.info;
Modified: trunk/tools/quickbook/src/markups.cpp
==============================================================================
--- trunk/tools/quickbook/src/markups.cpp (original)
+++ trunk/tools/quickbook/src/markups.cpp 2011-03-20 17:46:10 EDT (Sun, 20 Mar 2011)
@@ -108,6 +108,8 @@
{ block_tags::important, important_pre, important_post },
{ block_tags::note, note_pre, note_post },
{ block_tags::tip, tip_pre, tip_post },
+ { block_tags::ordered_list, "<orderedlist>", "</orderedlist>" },
+ { block_tags::itemized_list, "<itemizedlist>", "</itemizedlist>" },
{ phrase_tags::url, url_pre_, url_post_ },
{ phrase_tags::link, link_pre_, link_post_ },
{ phrase_tags::funcref, funcref_pre_, funcref_post_ },
Modified: trunk/tools/quickbook/test/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/test/Jamfile.v2 (original)
+++ trunk/tools/quickbook/test/Jamfile.v2 2011-03-20 17:46:10 EDT (Sun, 20 Mar 2011)
@@ -60,6 +60,8 @@
[ quickbook-test xml-escape_1_2 ]
[ quickbook-test xml-escape_1_5 ]
[ quickbook-test blocks ]
+ [ quickbook-test elements_1_5 ]
+ [ quickbook-test elements_1_6 ]
[ quickbook-test newline ]
[ quickbook-test anchor ]
[ quickbook-test command_line_macro : : : <quickbook-test-define>__macro__=*bold* ]
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