Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64831 - in trunk/tools/quickbook: . detail doc test
From: daniel_james_at_[hidden]
Date: 2010-08-15 12:48:12


Author: danieljames
Date: 2010-08-15 12:48:10 EDT (Sun, 15 Aug 2010)
New Revision: 64831
URL: http://svn.boost.org/trac/boost/changeset/64831

Log:
Merge multiple `listitem`s in `varlistentry`.

Docbook only allows a single `listitem` in a `varlistentry` so combine
multiple items into a single item.
Added:
   trunk/tools/quickbook/test/variablelist.gold (contents, props changed)
   trunk/tools/quickbook/test/variablelist.quickbook (contents, props changed)
Text files modified:
   trunk/tools/quickbook/block.hpp | 8 ++++----
   trunk/tools/quickbook/detail/actions.cpp | 4 ++--
   trunk/tools/quickbook/detail/actions.hpp | 14 ++++++++++++--
   trunk/tools/quickbook/doc/quickbook.qbk | 2 ++
   trunk/tools/quickbook/test/Jamfile.v2 | 1 +
   5 files changed, 21 insertions(+), 8 deletions(-)

Modified: trunk/tools/quickbook/block.hpp
==============================================================================
--- trunk/tools/quickbook/block.hpp (original)
+++ trunk/tools/quickbook/block.hpp 2010-08-15 12:48:10 EDT (Sun, 15 Aug 2010)
@@ -280,8 +280,8 @@
>>
                     (
                         (
- varlistterm
- >> +varlistitem
+ varlistterm [actions.start_varlistitem]
+ >> (+varlistitem) [actions.end_varlistitem]
>> ch_p(']') [actions.end_varlistentry]
>> space
                         )
@@ -305,12 +305,12 @@
 
                 varlistitem =
                     space
- >> ch_p('[') [actions.start_varlistitem]
+ >> ch_p('[')
>>
                     (
                         (
                             inside_paragraph
- >> ch_p(']') [actions.end_varlistitem]
+ >> ch_p(']')
>> space
                         )
                         | eps_p [actions.error]

Modified: trunk/tools/quickbook/detail/actions.cpp
==============================================================================
--- trunk/tools/quickbook/detail/actions.cpp (original)
+++ trunk/tools/quickbook/detail/actions.cpp 2010-08-15 12:48:10 EDT (Sun, 15 Aug 2010)
@@ -1045,13 +1045,13 @@
         actions.table_title.clear();
     }
 
- void start_varlistitem_action::operator()(char) const
+ void start_varlistitem_action::operator()() const
     {
         phrase << start_varlistitem_;
         phrase.push();
     }
 
- void end_varlistitem_action::operator()(char) const
+ void end_varlistitem_action::operator()() const
     {
         std::string str;
         temp_para.swap(str);

Modified: trunk/tools/quickbook/detail/actions.hpp
==============================================================================
--- trunk/tools/quickbook/detail/actions.hpp (original)
+++ trunk/tools/quickbook/detail/actions.hpp 2010-08-15 12:48:10 EDT (Sun, 15 Aug 2010)
@@ -569,7 +569,12 @@
         start_varlistitem_action(collector& phrase)
         : phrase(phrase) {}
 
- void operator()(char) const;
+ void operator()() const;
+
+ template <typename T1>
+ void operator()(T1 const&) const { return (*this)(); }
+ template <typename T1, typename T2>
+ void operator()(T1 const&, T2 const&) const { return (*this)(); }
 
         collector& phrase;
     };
@@ -579,7 +584,12 @@
         end_varlistitem_action(collector& phrase, collector& temp_para)
         : phrase(phrase), temp_para(temp_para) {}
 
- void operator()(char) const;
+ void operator()() const;
+
+ template <typename T1>
+ void operator()(T1 const&) const { return (*this)(); }
+ template <typename T1, typename T2>
+ void operator()(T1 const&, T2 const&) const { return (*this)(); }
 
         collector& phrase;
         collector& temp_para;

Modified: trunk/tools/quickbook/doc/quickbook.qbk
==============================================================================
--- trunk/tools/quickbook/doc/quickbook.qbk (original)
+++ trunk/tools/quickbook/doc/quickbook.qbk 2010-08-15 12:48:10 EDT (Sun, 15 Aug 2010)
@@ -227,6 +227,8 @@
   * Code blocks no longer have to be followed by a blank line.
 * Improved tracking of file position in templates and imported code blocks.
 * Better generated markup for callout lists.
+* In docbook, variable list entries can only have one `listitem`, so if an
+ entry has multiple values, merge them into one `listitem`.
 * Further work on quickbook 1.6, still not stable.
   * Allow heading to have ids, using the syntax: `[heading:id title]`.
 

Modified: trunk/tools/quickbook/test/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/test/Jamfile.v2 (original)
+++ trunk/tools/quickbook/test/Jamfile.v2 2010-08-15 12:48:10 EDT (Sun, 15 Aug 2010)
@@ -40,6 +40,7 @@
     [ quickbook-test identifier_1_5 ]
     [ quickbook-test identifier_1_6 ]
     [ quickbook-test para-test ]
+ [ quickbook-test variablelist ]
     [ quickbook-test table_1_5 ]
     [ quickbook-test image_1_5 ]
     [ quickbook-test list_test ]

Added: trunk/tools/quickbook/test/variablelist.gold
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/variablelist.gold 2010-08-15 12:48:10 EDT (Sun, 15 Aug 2010)
@@ -0,0 +1,97 @@
+<?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="variable_list_tests" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Variable List Tests</title>
+ <articleinfo>
+ </articleinfo>
+ <variablelist>
+ <title>Empty</title>
+ </variablelist>
+ <variablelist>
+ <title>One entry</title>
+ <varlistentry>
+ <term>a</term>
+ <listitem>
+ <para>
+ b
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <variablelist>
+ <title>One entry, multiple items</title>
+ <varlistentry>
+ <term>a</term>
+ <listitem>
+ <para>
+ b
+ </para>
+ <para>
+ c
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <variablelist>
+ <title>Several entries</title>
+ <varlistentry>
+ <term>a</term>
+ <listitem>
+ <para>
+ b
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>a</term>
+ <listitem>
+ <para>
+ b
+ </para>
+ <para>
+ c
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>a</term>
+ <listitem>
+ <para>
+ b
+ </para>
+ <para>
+ c
+ </para>
+ <para>
+ d
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>a</term>
+ <listitem>
+ <para>
+ b
+ </para>
+ <para>
+ c
+ </para>
+ <para>
+ d
+ </para>
+ <para>
+ e
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>a</term>
+ <listitem>
+ <para>
+ b
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+</article>

Added: trunk/tools/quickbook/test/variablelist.quickbook
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/variablelist.quickbook 2010-08-15 12:48:10 EDT (Sun, 15 Aug 2010)
@@ -0,0 +1,22 @@
+[article Variable List Tests
+[quickbook 1.5]
+]
+
+[variablelist Empty
+]
+
+[variablelist One entry
+ [[a][b]]
+]
+
+[variablelist One entry, multiple items
+ [[a][b][c]]
+]
+
+[variablelist Several entries
+ [[a][b]]
+ [[a][b][c]]
+ [[a][b][c][d]]
+ [[a][b][c][d][e]]
+ [[a][b]]
+]
\ No newline at end of file


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