Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74344 - in trunk/tools/quickbook: src test
From: dnljms_at_[hidden]
Date: 2011-09-11 12:56:50


Author: danieljames
Date: 2011-09-11 12:56:49 EDT (Sun, 11 Sep 2011)
New Revision: 74344
URL: http://svn.boost.org/trac/boost/changeset/74344

Log:
Quickbook: Fully qualify footnote and callout ids.
Text files modified:
   trunk/tools/quickbook/src/actions.cpp | 19 +++--
   trunk/tools/quickbook/test/callouts.gold | 130 ++++++++++++++++++++++++++++++++++++++++
   trunk/tools/quickbook/test/callouts.quickbook | 25 +++++++
   trunk/tools/quickbook/test/quickbook-manual.gold | 12 +-
   4 files changed, 171 insertions(+), 15 deletions(-)

Modified: trunk/tools/quickbook/src/actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions.cpp (original)
+++ trunk/tools/quickbook/src/actions.cpp 2011-09-11 12:56:49 EDT (Sun, 11 Sep 2011)
@@ -280,7 +280,9 @@
         value_consumer values = phrase;
         actions.phrase
             << "<footnote id=\""
- << actions.ids.add(actions.doc_id + ".f", id_generator::numbered)
+ << actions.ids.add(fully_qualified_id(actions.doc_id,
+ actions.qualified_section_id, "f"),
+ id_generator::numbered)
             << "\"><para>"
             << values.consume().get_boostbook()
             << "</para></footnote>";
@@ -1258,17 +1260,16 @@
                 }
 
                 unsigned int size = symbol->params.size();
+ std::string callout_base_id =
+ fully_qualified_id(actions.doc_id,
+ actions.qualified_section_id, "c");
 
                 for(unsigned int i = 0; i < size; ++i)
                 {
- std::string callout_id1 =
- actions.ids.add(
- actions.doc_id + ".c",
- id_generator::numbered);
- std::string callout_id2 =
- actions.ids.add(
- actions.doc_id + ".c",
- id_generator::numbered);
+ std::string callout_id1 = actions.ids.add(
+ callout_base_id, id_generator::numbered);
+ std::string callout_id2 = actions.ids.add(
+ callout_base_id, id_generator::numbered);
 
                     std::string code;
                     code += "<co id=\"" + callout_id1 + "\" ";

Modified: trunk/tools/quickbook/test/callouts.gold
==============================================================================
--- trunk/tools/quickbook/test/callouts.gold (original)
+++ trunk/tools/quickbook/test/callouts.gold 2011-09-11 12:56:49 EDT (Sun, 11 Sep 2011)
@@ -130,4 +130,134 @@
       </para>
     </callout>
   </calloutlist>
+ <section id="callout_tests.test_section">
+ <title><link linkend="callout_tests.test_section">Try callouts in a section</link></title>
+ <para>
+ Example 1:
+ </para>
+ <para>
+ Now we can define a function that simulates an ordinary six-sided die.
+ </para>
+ <para>
+
+<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
+ <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="identifier">dist</phrase><phrase role="special">(</phrase><phrase role="number">1</phrase><phrase role="special">,</phrase> <phrase role="number">6</phrase><phrase role="special">);</phrase> <co id="callout_tests.test_section.c0" linkends="callout_tests.test_section.c1" />
+<phrase role="special">}</phrase>
+
+</programlisting>
+ </para>
+ <calloutlist>
+ <callout arearefs="callout_tests.test_section.c0" id="callout_tests.test_section.c1">
+ <para>
+ create a uniform_int distribution
+ </para>
+ </callout>
+ </calloutlist>
+ <para>
+ Example 2:
+ </para>
+ <para>
+
+<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
+ <co id="callout_tests.test_section.c2" linkends="callout_tests.test_section.c3" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&amp;,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="special">&gt;</phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
+<phrase role="special">}</phrase>
+
+</programlisting>
+ </para>
+ <calloutlist>
+ <callout arearefs="callout_tests.test_section.c2" id="callout_tests.test_section.c3">
+ <important>
+ <para>
+ test
+ </para>
+ </important>
+ </callout>
+ </calloutlist>
+ <para>
+ Example 3:
+ </para>
+ <para>
+
+<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
+ <co id="callout_tests.test_section.c4" linkends="callout_tests.test_section.c5" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&amp;,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="special">&gt;</phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
+<phrase role="special">}</phrase>
+
+</programlisting>
+ </para>
+ <calloutlist>
+ <callout arearefs="callout_tests.test_section.c4" id="callout_tests.test_section.c5">
+ <important>
+ <para>
+ test
+ </para>
+ </important>
+ </callout>
+ </calloutlist>
+ <para>
+ Example 3 (again!):
+ </para>
+ <para>
+
+<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
+ <co id="callout_tests.test_section.c6" linkends="callout_tests.test_section.c7" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&amp;,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="special">&gt;</phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
+<phrase role="special">}</phrase>
+
+</programlisting>
+ </para>
+ <calloutlist>
+ <callout arearefs="callout_tests.test_section.c6" id="callout_tests.test_section.c7">
+ <important>
+ <para>
+ test
+ </para>
+ </important>
+ </callout>
+ </calloutlist>
+ <para>
+ Example 4:
+ </para>
+ <para>
+
+<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
+ <co id="callout_tests.test_section.c8" linkends="callout_tests.test_section.c9" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&amp;,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="special">&gt;</phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
+<co id="callout_tests.test_section.c10" linkends="callout_tests.test_section.c11" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="identifier">dist</phrase><phrase role="special">(</phrase><phrase role="number">1</phrase><phrase role="special">,</phrase> <phrase role="number">6</phrase><phrase role="special">);</phrase> <co id="callout_tests.test_section.c12" linkends="callout_tests.test_section.c13" />
+<phrase role="special">}</phrase>
+
+</programlisting>
+ </para>
+ <calloutlist>
+ <callout arearefs="callout_tests.test_section.c8" id="callout_tests.test_section.c9">
+ <para>
+ callout 1
+ </para>
+ </callout>
+ <callout arearefs="callout_tests.test_section.c10" id="callout_tests.test_section.c11">
+ <para>
+ callout 2
+ </para>
+ </callout>
+ <callout arearefs="callout_tests.test_section.c12" id="callout_tests.test_section.c13">
+ <para>
+ create a uniform_int distribution
+ </para>
+ </callout>
+ </calloutlist>
+ <para>
+
+<programlisting><co id="callout_tests.test_section.c14" linkends="callout_tests.test_section.c15" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="identifier">dist</phrase><phrase role="special">(</phrase><phrase role="number">1</phrase><phrase role="special">,</phrase> <phrase role="number">6</phrase><phrase role="special">);</phrase> <co id="callout_tests.test_section.c16" linkends="callout_tests.test_section.c17" />
+</programlisting>
+ </para>
+ <calloutlist>
+ <callout arearefs="callout_tests.test_section.c14" id="callout_tests.test_section.c15">
+ <para>
+ callout 2
+ </para>
+ </callout>
+ <callout arearefs="callout_tests.test_section.c16" id="callout_tests.test_section.c17">
+ <para>
+ create a uniform_int distribution
+ </para>
+ </callout>
+ </calloutlist>
+ </section>
 </article>

Modified: trunk/tools/quickbook/test/callouts.quickbook
==============================================================================
--- trunk/tools/quickbook/test/callouts.quickbook (original)
+++ trunk/tools/quickbook/test/callouts.quickbook 2011-09-11 12:56:49 EDT (Sun, 11 Sep 2011)
@@ -24,3 +24,28 @@
 
 [example4]
 [example4a]
+
+[section:test_section Try callouts in a section]
+
+Example 1:
+
+[example1]
+
+Example 2:
+
+[example2]
+
+Example 3:
+
+[example3]
+
+Example 3 (again!):
+
+[example3]
+
+Example 4:
+
+[example4]
+[example4a]
+
+[endsect]
\ No newline at end of file

Modified: trunk/tools/quickbook/test/quickbook-manual.gold
==============================================================================
--- trunk/tools/quickbook/test/quickbook-manual.gold (original)
+++ trunk/tools/quickbook/test/quickbook-manual.gold 2011-09-11 12:56:49 EDT (Sun, 11 Sep 2011)
@@ -404,7 +404,7 @@
         </para>
         <para>
           Unlike QuickBook's standard formatting scheme, the rules for simpler alternatives
- are much stricter<footnote id="quickbook.f0">
+ are much stricter<footnote id="quickbook.syntax.phrase.simple_formatting.f0">
           <para>
             Thanks to David Barrett, author of <ulink url="http://quinthar.com/qwikiwiki/index.php?page=Home">Qwiki</ulink>,
             for sharing these samples and teaching me these obscure formatting rules.
@@ -1030,7 +1030,7 @@
 <programlisting><!--quickbook-escape-prefix-->[footnote A sample footnote]
 <!--quickbook-escape-postfix--></programlisting>
         <para>
- will generate this<footnote id="quickbook.f1">
+ will generate this<footnote id="quickbook.syntax.phrase.footnotes.f0">
           <para>
             A sample footnote
           </para>
@@ -2796,20 +2796,20 @@
         </para>
         <para>
           
-<programlisting><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">string</phrase> <phrase role="identifier">foo_bar</phrase><phrase role="special">()</phrase> <co id="quickbook.c0" linkends="quickbook.c1" />
+<programlisting><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">string</phrase> <phrase role="identifier">foo_bar</phrase><phrase role="special">()</phrase> <co id="quickbook.syntax.block.import.c0" linkends="quickbook.syntax.block.import.c1" />
 <phrase role="special">{</phrase>
- <phrase role="keyword">return</phrase> <phrase role="string">&quot;foo-bar&quot;</phrase><phrase role="special">;</phrase> <co id="quickbook.c2" linkends="quickbook.c3" />
+ <phrase role="keyword">return</phrase> <phrase role="string">&quot;foo-bar&quot;</phrase><phrase role="special">;</phrase> <co id="quickbook.syntax.block.import.c2" linkends="quickbook.syntax.block.import.c3" />
 <phrase role="special">}</phrase>
 </programlisting>
         </para>
         <calloutlist>
- <callout arearefs="quickbook.c0" id="quickbook.c1">
+ <callout arearefs="quickbook.syntax.block.import.c0" id="quickbook.syntax.block.import.c1">
             <para>
               The <emphasis>Mythical</emphasis> FooBar. See <ulink url="http://en.wikipedia.org/wiki/Foobar">Foobar
               for details</ulink>
             </para>
           </callout>
- <callout arearefs="quickbook.c2" id="quickbook.c3">
+ <callout arearefs="quickbook.syntax.block.import.c2" id="quickbook.syntax.block.import.c3">
             <para>
               return 'em, foo-bar man!
             </para>


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