$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r86688 - in trunk/tools/quickbook: src test test/include
From: dnljms_at_[hidden]
Date: 2013-11-13 16:49:49
Author: danieljames
Date: 2013-11-13 16:49:49 EST (Wed, 13 Nov 2013)
New Revision: 86688
URL: http://svn.boost.org/trac/boost/changeset/86688
Log:
Allow template calls in anchors, roles and includes.
Actually a subtle change, as includes and anchors could previously
contain spaces. Possibly should still alow that, although I expect it's
never used.
Added:
   trunk/tools/quickbook/test/anchor-1_7.gold   (contents, props changed)
   trunk/tools/quickbook/test/anchor-1_7.quickbook   (contents, props changed)
   trunk/tools/quickbook/test/include-1_7.gold   (contents, props changed)
   trunk/tools/quickbook/test/include-1_7.quickbook   (contents, props changed)
   trunk/tools/quickbook/test/include/template_include-1_7.gold   (contents, props changed)
   trunk/tools/quickbook/test/include/template_include-1_7.quickbook   (contents, props changed)
Text files modified: 
   trunk/tools/quickbook/src/actions.cpp                             |    19 +++-                                    
   trunk/tools/quickbook/src/block_element_grammar.cpp               |     4                                         
   trunk/tools/quickbook/src/phrase_element_grammar.cpp              |    10 ++                                      
   trunk/tools/quickbook/test/Jamfile.v2                             |     2                                         
   trunk/tools/quickbook/test/anchor-1_7.gold                        |   151 ++++++++++++++++++++++++++++++++++++++++
   trunk/tools/quickbook/test/anchor-1_7.quickbook                   |    97 +++++++++++++++++++++++++               
   trunk/tools/quickbook/test/include-1_7.gold                       |    36 +++++++++                               
   trunk/tools/quickbook/test/include-1_7.quickbook                  |    18 ++++                                    
   trunk/tools/quickbook/test/include/Jamfile.v2                     |     1                                         
   trunk/tools/quickbook/test/include/template_include-1_7.gold      |    12 +++                                     
   trunk/tools/quickbook/test/include/template_include-1_7.quickbook |     8 ++                                      
   trunk/tools/quickbook/test/role-1_7.gold                          |     4 +                                       
   trunk/tools/quickbook/test/role-1_7.quickbook                     |    10 ++                                      
   13 files changed, 361 insertions(+), 11 deletions(-)
Modified: trunk/tools/quickbook/src/actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions.cpp	Wed Nov 13 16:49:05 2013	(r86687)
+++ trunk/tools/quickbook/src/actions.cpp	2013-11-13 16:49:49 EST (Wed, 13 Nov 2013)	(r86688)
@@ -308,19 +308,25 @@
         values.finish();
     }
 
-    void role_action(quickbook::state& state, value role)
+    void role_action(quickbook::state& state, value role_list)
     {
         write_anchors(state, state.phrase);
 
-        value_consumer values = role;
+        value_consumer values = role_list;
+        value role = values.consume();
+        value phrase = values.consume();
+        values.finish();
+
         state.phrase
             << "<phrase role=\"";
-        detail::print_string(values.consume().get_quickbook(), state.phrase.get());
+        // TODO: Validate role?
+        detail::print_string(role.is_encoded() ?
+                    role.get_encoded() : detail::to_s(role.get_quickbook()),
+                state.phrase.get());
         state.phrase
             << "\">"
-            << values.consume().get_encoded()
+            << phrase.get_encoded()
             << "</phrase>";
-        values.finish();
     }
 
     void footnote_action(quickbook::state& state, value phrase)
@@ -685,8 +691,7 @@
         value anchor_id = values.consume();
         // Note: anchor_id is never encoded as boostbook. If it
         // is encoded, it's just things like escapes.
-        add_anchor(state, anchor_id.is_encoded() ?
-            anchor_id.get_encoded() : anchor_id.get_quickbook());
+        add_anchor(state, validate_id(state, anchor_id));
         values.finish();
     }
 
Modified: trunk/tools/quickbook/src/block_element_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/block_element_grammar.cpp	Wed Nov 13 16:49:05 2013	(r86687)
+++ trunk/tools/quickbook/src/block_element_grammar.cpp	2013-11-13 16:49:49 EST (Wed, 13 Nov 2013)	(r86688)
@@ -309,13 +309,15 @@
         local.include_filename =
                 qbk_ver(0, 106u)
             >>  (*(cl::anychar_p - phrase_end)) [state.values.entry(ph::arg1, ph::arg2)]
-            |   qbk_ver(106u)
+            |   qbk_ver(106u, 107u)
             >>  to_value()
                 [   *(  raw_escape
                     |   (cl::anychar_p - phrase_end)
                                                 [raw_char]
                     )
                 ]
+            |   qbk_ver(107u)
+            >>  to_value() [ attribute_value_1_7 ]
             ;
 
         local.inner_block =
Modified: trunk/tools/quickbook/src/phrase_element_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/phrase_element_grammar.cpp	Wed Nov 13 16:49:05 2013	(r86687)
+++ trunk/tools/quickbook/src/phrase_element_grammar.cpp	2013-11-13 16:49:49 EST (Wed, 13 Nov 2013)	(r86688)
@@ -147,13 +147,15 @@
                 blank
             >>  (   qbk_ver(0, 106u)
                 >>  (*(cl::anychar_p - phrase_end)) [state.values.entry(ph::arg1, ph::arg2)]
-                |   qbk_ver(106u)
+                |   qbk_ver(106u, 107u)
                 >>  to_value()
                     [   *(  raw_escape
                         |   (cl::anychar_p - phrase_end)
                                                     [raw_char]
                         )
                     ]
+                |   qbk_ver(107u)
+                >>  to_value() [attribute_value_1_7]
                 )
             ;
 
@@ -187,7 +189,11 @@
 
         local.role
             =   space
-            >>  (+(cl::alnum_p | '_'))              [state.values.entry(ph::arg1, ph::arg2)]
+            >>  (   qbk_ver(0, 107u)
+                >>  (+(cl::alnum_p | '_'))          [state.values.entry(ph::arg1, ph::arg2)]
+                |   qbk_ver(107u)
+                >>  to_value() [attribute_value_1_7]
+                )
             >>  hard_space
             >>  local.inner_phrase
             ;
Modified: trunk/tools/quickbook/test/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/test/Jamfile.v2	Wed Nov 13 16:49:05 2013	(r86687)
+++ trunk/tools/quickbook/test/Jamfile.v2	2013-11-13 16:49:49 EST (Wed, 13 Nov 2013)	(r86688)
@@ -24,6 +24,7 @@
 test-suite quickbook.test :
     [ quickbook-test anchor-1_1 ]
     [ quickbook-test anchor-1_6 ]
+    [ quickbook-test anchor-1_7 ]
     [ quickbook-test blocks-1_5 ]
     [ quickbook-test callouts-1_5 ]
     [ quickbook-test callouts-1_7 ]
@@ -63,6 +64,7 @@
     [ quickbook-error-test include-1_1-fail ]
     [ quickbook-test include-1_5 ]
     [ quickbook-test include-1_6 ]
+    [ quickbook-test include-1_7 ]
     [ quickbook-test include2-1_6 ]
     [ quickbook-error-test include_win_path-1_6-fail ]
     [ quickbook-test link-1_1 ]
Added: trunk/tools/quickbook/test/anchor-1_7.gold
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/tools/quickbook/test/anchor-1_7.gold	2013-11-13 16:49:49 EST (Wed, 13 Nov 2013)	(r86688)
@@ -0,0 +1,151 @@
+<?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="anchor_test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+  <title>Anchor Test</title>
+  <section id="anchor_test.anchors">
+    <title><link linkend="anchor_test.anchors">Anchors</link></title>
+    <para>
+      <anchor id="a1"/>A paragraph containing several anchors. <anchor id="a2"/>We
+      want to make sure they appear in the correct place. <anchor id="a3"/>
+    </para>
+    <bridgehead renderas="sect3" id="anchor_test.anchors.h0">
+      <phrase id="anchor_test.anchors.this_heading_shouldn_t_pick_up_t"/><link linkend="anchor_test.anchors.this_heading_shouldn_t_pick_up_t">This
+      heading shouldn't pick up the previous anchor</link>
+    </bridgehead>
+    <anchor id="a4"/>
+    <bridgehead renderas="sect3" id="anchor_test.anchors.h1">
+      <phrase id="anchor_test.anchors.this_heading_should_pick_up_the_"/><link linkend="anchor_test.anchors.this_heading_should_pick_up_the_">This
+      heading should pick up the previous anchor</link>
+    </bridgehead>
+    <anchor id="a5"/>
+    <bridgehead renderas="sect3" id="anchor_test.anchors.h2">
+      <phrase id="anchor_test.anchors.and_this_one"/><link linkend="anchor_test.anchors.and_this_one">And
+      this one</link>
+    </bridgehead>
+    <anchor id="a6"/>
+    <bridgehead renderas="sect3" id="anchor_test.anchors.h3">
+      <phrase id="anchor_test.anchors.also_this_one"/><link linkend="anchor_test.anchors.also_this_one">Also
+      this one</link>
+    </bridgehead>
+    <anchor id="a7"/>
+    <bridgehead renderas="sect3" id="anchor_test.anchors.h4">
+      <phrase id="anchor_test.anchors.finally_this"/><link linkend="anchor_test.anchors.finally_this">Finally
+      this</link>
+    </bridgehead>
+    <anchor id="a8"/>
+  </section>
+  <section id="anchor_test.section_anchor">
+    <title><anchor id="a9"/><link linkend="anchor_test.section_anchor">Section Anchor</link></title>
+    <section id="anchor_test.section_anchor.nested_section">
+      <title><anchor id="a10"/><link linkend="anchor_test.section_anchor.nested_section">Nested
+      Section</link></title>
+    </section>
+    <anchor id="a11"/>
+  </section>
+  <section id="anchor_test.conditional_section_anchor">
+    <title><anchor id="a12"/><link linkend="anchor_test.conditional_section_anchor">Conditional
+    Section Anchor</link></title>
+  </section>
+  <section id="anchor_test.lists">
+    <title><link linkend="anchor_test.lists">Lists</link></title> <anchor id="a14"/>
+    <itemizedlist>
+      <listitem>
+        <simpara>
+          Item 1
+        </simpara>
+      </listitem>
+      <listitem>
+        <simpara>
+          Item 2
+        </simpara>
+      </listitem>
+      <listitem>
+        <simpara>
+          Nested List <anchor id="a15"/>
+          <itemizedlist>
+            <listitem>
+              <simpara>
+                Nested Item 1
+              </simpara>
+            </listitem>
+            <listitem>
+              <simpara>
+                Nested Item 2
+              </simpara>
+            </listitem>
+            <listitem>
+              <simpara>
+                <anchor id="a16"/>Nested Item 3
+              </simpara>
+            </listitem>
+          </itemizedlist>
+        </simpara>
+      </listitem>
+      <listitem>
+        <simpara>
+          Item 3
+        </simpara>
+      </listitem>
+    </itemizedlist>
+  </section>
+  <section id="anchor_test.anchors_in_templates">
+    <title><link linkend="anchor_test.anchors_in_templates">Anchors in templates</link></title>
+    <para>
+      <anchor id="t1"/>Some text.
+    </para>
+    <para>
+      <anchor id="t2"/>Text content
+    </para>
+  </section>
+  <section id="anchor_test.anchors_in_syntax_highlighted_co">
+    <title><link linkend="anchor_test.anchors_in_syntax_highlighted_co">Anchors in
+    syntax highlighted code</link></title>
+<programlisting><phrase role="keyword">int</phrase> <anchor id="s1"/><phrase role="identifier">main</phrase><phrase role="special">()</phrase> <phrase role="special">{}</phrase>
+</programlisting>
+  </section>
+  <section id="anchor_test.nested_anchors">
+    <title><link linkend="anchor_test.nested_anchors">Nested anchors</link></title>
+    <table frame="all" id="anchor_test.nested_anchors.table_with_anchors">
+      <title>Table with anchors</title>
+      <tgroup cols="1">
+        <thead>
+          <row>
+            <entry>
+              <para>
+                Heading
+              </para>
+            </entry>
+          </row>
+        </thead>
+        <tbody>
+          <row>
+            <entry>
+              <para>
+                <anchor id="table1"/>Cell 1
+              </para>
+            </entry>
+          </row>
+          <row>
+            <entry>
+              <para>
+                <anchor id="table2"/>Cell 2
+              </para>
+            </entry>
+          </row>
+          <row>
+            <entry>
+              <para>
+                Cell 3<anchor id="table3"/>
+              </para>
+            </entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </table>
+  </section>
+  <section id="anchor_test.templates">
+    <title><link linkend="anchor_test.templates">Anchors with templates</link></title>
+    <anchor id="anchor1"/><anchor id="anchor2"/><anchor id="x1y"/><anchor id="x12y"/>
+  </section>
+</article>
Added: trunk/tools/quickbook/test/anchor-1_7.quickbook
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/tools/quickbook/test/anchor-1_7.quickbook	2013-11-13 16:49:49 EST (Wed, 13 Nov 2013)	(r86688)
@@ -0,0 +1,97 @@
+[article Anchor Test
+[quickbook 1.7]
+]
+
+[section Anchors]
+
+[#a1] A paragraph containing several anchors. [#a2] We want to make sure
+they appear in the correct place. [#a3]
+
+[heading This heading shouldn't pick up the previous anchor]
+
+[#a4]
+
+[heading This heading should pick up the previous anchor]
+
+[#a5]
+[heading And this one]
+
+[#a6][heading Also this one]
+
+[#a7][h3 Finally this]
+
+[#a8]
+
+[endsect]
+
+[#a9]
+[section Section Anchor]
+[#a10][section Nested Section]
+[endsect]
+[/ This anchor is invalid, I'm not sure what to do with it]
+[#a11]
+[endsect]
+
+[#a12][?__not_defined__ #a13]
+[section Conditional Section Anchor]
+[endsect]
+
+[section Lists]
+
+[#a14]
+* Item 1
+* Item 2
+* Nested List
+  [#a15]
+  * Nested Item 1
+  * Nested Item 2
+  * [#a16] Nested Item 3
+* Item 3
+
+[endsect]
+
+[section Anchors in templates]
+
+[template anchor1[][#t1]]
+[template para[] Text content]
+
+[anchor1]
+
+Some text.
+
+[#t2]
+
+[para]
+
+[endsect]
+
+[section Anchors in syntax highlighted code]
+
+    int ``[#s1]``main() {}
+
+[endsect]
+
+[section Nested anchors]
+
+[table Table with anchors
+    [[Heading]]
+    [[[#table1]Cell 1]]
+    [[[#table2] Cell 2]]
+    [[Cell 3[#table3]]]
+]
+[endsect]
+
+[section:templates Anchors with templates]
+
+[template a1 anchor1]
+[template a2 anchor2]
+
+[#[a1]]
+[#[a2]]
+
+[template anchor[name] [#x[name]y]]
+
+[anchor 1]
+[anchor 12]
+
+[endsect] [/ templates]
Added: trunk/tools/quickbook/test/include-1_7.gold
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/tools/quickbook/test/include-1_7.gold	2013-11-13 16:49:49 EST (Wed, 13 Nov 2013)	(r86688)
@@ -0,0 +1,36 @@
+<?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="include-test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+  <title>Include Test</title>
+  <section id="include-test.test">
+    <title><link linkend="include-test.test">Test</link></title>
+    <para>
+      Just testing.
+    </para>
+  </section>
+  <section id="foo.test">
+    <title><link linkend="foo.test">Test</link></title>
+    <para>
+      Just testing.
+    </para>
+  </section>
+  <section id="foo0.test">
+    <title><link linkend="foo0.test">Test</link></title>
+    <para>
+      Just testing.
+    </para>
+  </section>
+  <para>
+    Just trying including in a conditional macro.
+  </para>
+  <section id="foo2.test">
+    <title><link linkend="foo2.test">Test</link></title>
+    <para>
+      Just testing.
+    </para>
+  </section>
+  <para>
+    With some text around it.
+  </para>
+</article>
Added: trunk/tools/quickbook/test/include-1_7.quickbook
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/tools/quickbook/test/include-1_7.quickbook	2013-11-13 16:49:49 EST (Wed, 13 Nov 2013)	(r86688)
@@ -0,0 +1,18 @@
+[article Include Test
+    [quickbook 1.7]
+    [id include-test]
+]
+
+[include include-inc.quickbook]
+[include:foo include-inc.quickbook]
+
+[template id2[] include-inc]
+[include:foo0 [id2].quickbook]
+
+[def __defined__]
+
+[? __undefined__ [include:foo1 include-inc.quickbook] ]
+[? __undefined__ [include:foo1 not-a-file.quickbook] ]
+[? __defined__
+  Just trying including in a conditional macro. [include:foo2 include-inc.quickbook]
+  With some text around it.]
Modified: trunk/tools/quickbook/test/include/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/test/include/Jamfile.v2	Wed Nov 13 16:49:05 2013	(r86687)
+++ trunk/tools/quickbook/test/include/Jamfile.v2	2013-11-13 16:49:49 EST (Wed, 13 Nov 2013)	(r86688)
@@ -41,4 +41,5 @@
     [ quickbook-test source_mode-1_6 ]
     [ quickbook-test nested_compatibility-1_5 ]
     [ quickbook-test nested_compatibility-1_6 ]
+    [ quickbook-test template_include-1_7 ]
     ;
Added: trunk/tools/quickbook/test/include/template_include-1_7.gold
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/tools/quickbook/test/include/template_include-1_7.gold	2013-11-13 16:49:49 EST (Wed, 13 Nov 2013)	(r86688)
@@ -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="template_include_test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+  <title>Template include test</title>
+  <bridgehead renderas="sect2" id="template_include_test.h0">
+    <phrase id="template_include_test.simple_include"/><link linkend="template_include_test.simple_include">Simple
+    include</link>
+  </bridgehead>
+<programlisting><phrase role="keyword">void</phrase> <phrase role="identifier">main</phrase><phrase role="special">()</phrase> <phrase role="special">{}</phrase>
+</programlisting>
+</article>
Added: trunk/tools/quickbook/test/include/template_include-1_7.quickbook
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/tools/quickbook/test/include/template_include-1_7.quickbook	2013-11-13 16:49:49 EST (Wed, 13 Nov 2013)	(r86688)
@@ -0,0 +1,8 @@
+[article Template include test
+[quickbook 1.7]
+]
+
+[template include_foo[name] [include [name].quickbook]]
+
+[include_foo include-id-inc1]
+[include_foo source_mode-inc2]
Modified: trunk/tools/quickbook/test/role-1_7.gold
==============================================================================
--- trunk/tools/quickbook/test/role-1_7.gold	Wed Nov 13 16:49:05 2013	(r86687)
+++ trunk/tools/quickbook/test/role-1_7.gold	2013-11-13 16:49:49 EST (Wed, 13 Nov 2013)	(r86688)
@@ -6,4 +6,8 @@
   <para>
     <phrase role="keyword">Keyword</phrase> <phrase role="keyword"></phrase>
   </para>
+  <para>
+    road <phrase role="red">Red</phrase> <phrase role="red"></phrase> <phrase role="three-colours-red">Three
+    Colours Red</phrase> <phrase role="red-road">Red Road</phrase>
+  </para>
 </article>
Modified: trunk/tools/quickbook/test/role-1_7.quickbook
==============================================================================
--- trunk/tools/quickbook/test/role-1_7.quickbook	Wed Nov 13 16:49:05 2013	(r86687)
+++ trunk/tools/quickbook/test/role-1_7.quickbook	2013-11-13 16:49:49 EST (Wed, 13 Nov 2013)	(r86688)
@@ -1,5 +1,13 @@
 [article Quickbook Role Test
-[quickbook 1.6]
+[quickbook 1.7]
 ]
 
 [role keyword Keyword] [role keyword]
+
+[template r red]
+[template r2 road]
+[r2]
+[role [r] Red] [role [r]]
+[role three-colours-[r] Three Colours Red]
+[role [r]-[r2] Red Road]
+