Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69438 - in branches/quickbook-filenames/tools/quickbook: src test
From: dnljms_at_[hidden]
Date: 2011-03-01 04:15:15


Author: danieljames
Date: 2011-03-01 04:15:09 EST (Tue, 01 Mar 2011)
New Revision: 69438
URL: http://svn.boost.org/trac/boost/changeset/69438

Log:
Explicit list markup. Refs #1193

I don't think paragraph markup would be very useful right now, because
it wouldn't be usable in a phrase context.

These can't be templates because templates are implicitly wrapped in
paragraphs.
Added:
   branches/quickbook-filenames/tools/quickbook/test/elements_1_5.gold (contents, props changed)
   branches/quickbook-filenames/tools/quickbook/test/elements_1_5.quickbook (contents, props changed)
   branches/quickbook-filenames/tools/quickbook/test/elements_1_6.gold (contents, props changed)
   branches/quickbook-filenames/tools/quickbook/test/elements_1_6.quickbook (contents, props changed)
Text files modified:
   branches/quickbook-filenames/tools/quickbook/src/actions.cpp | 21 +++++++++++++++++++++
   branches/quickbook-filenames/tools/quickbook/src/block_element_grammar.cpp | 9 ++++++++-
   branches/quickbook-filenames/tools/quickbook/src/block_tags.hpp | 2 +-
   branches/quickbook-filenames/tools/quickbook/src/grammar_impl.hpp | 6 ++++--
   branches/quickbook-filenames/tools/quickbook/src/main_grammar.cpp | 3 ++-
   branches/quickbook-filenames/tools/quickbook/src/markups.cpp | 2 ++
   branches/quickbook-filenames/tools/quickbook/test/Jamfile.v2 | 2 ++
   7 files changed, 40 insertions(+), 5 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-03-01 04:15:09 EST (Tue, 01 Mar 2011)
@@ -50,6 +50,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);
@@ -78,6 +79,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:
@@ -447,6 +451,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: 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-03-01 04:15:09 EST (Tue, 01 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: 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-03-01 04:15:09 EST (Tue, 01 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: branches/quickbook-filenames/tools/quickbook/src/grammar_impl.hpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/grammar_impl.hpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/grammar_impl.hpp 2011-03-01 04:15:09 EST (Tue, 01 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: branches/quickbook-filenames/tools/quickbook/src/main_grammar.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/main_grammar.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/main_grammar.cpp 2011-03-01 04:15:09 EST (Tue, 01 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: branches/quickbook-filenames/tools/quickbook/src/markups.cpp
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/src/markups.cpp (original)
+++ branches/quickbook-filenames/tools/quickbook/src/markups.cpp 2011-03-01 04:15:09 EST (Tue, 01 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: branches/quickbook-filenames/tools/quickbook/test/Jamfile.v2
==============================================================================
--- branches/quickbook-filenames/tools/quickbook/test/Jamfile.v2 (original)
+++ branches/quickbook-filenames/tools/quickbook/test/Jamfile.v2 2011-03-01 04:15:09 EST (Tue, 01 Mar 2011)
@@ -59,6 +59,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* ]

Added: branches/quickbook-filenames/tools/quickbook/test/elements_1_5.gold
==============================================================================
--- (empty file)
+++ branches/quickbook-filenames/tools/quickbook/test/elements_1_5.gold 2011-03-01 04:15:09 EST (Tue, 01 Mar 2011)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE article PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
+<article id="1_5_elements" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>1.5 Elements</title>
+ <para>
+ [ordered_list [item1][item2]]
+ </para>
+ <para>
+ [itemized_list [item1][item2]]
+ </para>
+</article>

Added: branches/quickbook-filenames/tools/quickbook/test/elements_1_5.quickbook
==============================================================================
--- (empty file)
+++ branches/quickbook-filenames/tools/quickbook/test/elements_1_5.quickbook 2011-03-01 04:15:09 EST (Tue, 01 Mar 2011)
@@ -0,0 +1,9 @@
+[article 1.5 Elements
+[quickbook 1.5]
+]
+
+[/ elements from 1.6]
+
+[ordered_list [item1][item2]]
+
+[itemized_list [item1][item2]]

Added: branches/quickbook-filenames/tools/quickbook/test/elements_1_6.gold
==============================================================================
--- (empty file)
+++ branches/quickbook-filenames/tools/quickbook/test/elements_1_6.gold 2011-03-01 04:15:09 EST (Tue, 01 Mar 2011)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE article PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
+<article id="1_6_elements" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>1.6 Elements</title>
+ <orderedlist>
+ <listitem>
+ <para>
+ item1
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ item2
+ </para>
+ </listitem>
+ </orderedlist>
+ <itemizedlist>
+ <listitem>
+ <para>
+ item1
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ item2
+ </para>
+ </listitem>
+ </itemizedlist>
+</article>

Added: branches/quickbook-filenames/tools/quickbook/test/elements_1_6.quickbook
==============================================================================
--- (empty file)
+++ branches/quickbook-filenames/tools/quickbook/test/elements_1_6.quickbook 2011-03-01 04:15:09 EST (Tue, 01 Mar 2011)
@@ -0,0 +1,9 @@
+[article 1.6 Elements
+[quickbook 1.6]
+]
+
+[/ elements from 1.6]
+
+[ordered_list [item1][item2]]
+
+[itemized_list [item1][item2]]


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