Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56715 - in trunk/tools/quickbook: detail test
From: daniel_james_at_[hidden]
Date: 2009-10-11 12:18:05


Author: danieljames
Date: 2009-10-11 12:18:04 EDT (Sun, 11 Oct 2009)
New Revision: 56715
URL: http://svn.boost.org/trac/boost/changeset/56715

Log:
Use qualified ids in tables, and fix a bug generating ids when there isn't a section.
Added:
   trunk/tools/quickbook/test/heading.gold (contents, props changed)
   trunk/tools/quickbook/test/heading.quickbook (contents, props changed)
Text files modified:
   trunk/tools/quickbook/detail/actions.cpp | 35 +++++++++++++++++++++++++++--------
   trunk/tools/quickbook/test/Jamfile.v2 | 1 +
   trunk/tools/quickbook/test/table_1_5.gold | 33 +++++++++++++++++++++++++++++----
   trunk/tools/quickbook/test/table_1_5.quickbook | 12 +++++++++++-
   4 files changed, 68 insertions(+), 13 deletions(-)

Modified: trunk/tools/quickbook/detail/actions.cpp
==============================================================================
--- trunk/tools/quickbook/detail/actions.cpp (original)
+++ trunk/tools/quickbook/detail/actions.cpp 2009-10-11 12:18:04 EDT (Sun, 11 Oct 2009)
@@ -25,6 +25,20 @@
 
 namespace quickbook
 {
+ namespace {
+ std::string fully_qualified_id(std::string const& library_id,
+ std::string const& qualified_section_id,
+ std::string const& section_id)
+ {
+ std::string id = library_id;
+ if(!id.empty() && !qualified_section_id.empty()) id += '.';
+ id += qualified_section_id;
+ if(!id.empty() && !section_id.empty()) id += '.';
+ id += section_id;
+ return id;
+ }
+ }
+
     // Handles line-breaks (DEPRECATED!!!)
     void break_action::operator()(iterator first, iterator) const
     {
@@ -65,9 +79,8 @@
         }
         else // version 1.3 and above
         {
- std::string anchor =
- library_id + '.' + qualified_section_id + '.' +
- detail::make_identifier(str.begin(), str.end());
+ std::string anchor = fully_qualified_id(library_id, qualified_section_id,
+ detail::make_identifier(str.begin(), str.end()));
 
             out << "<anchor id=\"" << anchor << "\"/>"
                 << pre
@@ -89,9 +102,8 @@
         std::string str;
         phrase.swap(str);
 
- std::string anchor =
- library_id + '.' + qualified_section_id + '.' +
- detail::make_identifier(str.begin(), str.end());
+ std::string anchor = fully_qualified_id(library_id, qualified_section_id,
+ detail::make_identifier(str.begin(), str.end()));
 
         out
             << "<anchor id=\"" << anchor << "\"/>"
@@ -905,8 +917,15 @@
         
         std::string table_id;
         if(qbk_version_n >= 105) {
- if(!actions.element_id.empty()) table_id = actions.element_id;
- else if(has_title) table_id = detail::make_identifier(first, last);
+ if(!actions.element_id.empty()) {
+ table_id = fully_qualified_id(actions.doc_id,
+ actions.qualified_section_id, actions.element_id);
+ }
+ else if(has_title) {
+ table_id = fully_qualified_id(actions.doc_id,
+ actions.qualified_section_id,
+ detail::make_identifier(first, last));
+ }
         }
 
         if (has_title)

Modified: trunk/tools/quickbook/test/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/test/Jamfile.v2 (original)
+++ trunk/tools/quickbook/test/Jamfile.v2 2009-10-11 12:18:04 EDT (Sun, 11 Oct 2009)
@@ -27,6 +27,7 @@
     [ quickbook-test import ]
     [ quickbook-test section_1_4 ]
     [ quickbook-test section_1_5 ]
+ [ quickbook-test heading ]
     [ quickbook-test table_1_5 ]
     [ quickbook-test image_1_5 ]
     [ quickbook-fail-test fail-include ]

Added: trunk/tools/quickbook/test/heading.gold
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/heading.gold 2009-10-11 12:18:04 EDT (Sun, 11 Oct 2009)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
+<article id="header" last-revision="$Date: 2009/10/11 16:14:06 $" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Header</title>
+ <articleinfo>
+ </articleinfo>
+ <anchor id="header.header_test"/>
+ <bridgehead renderas="sect2">
+ <link linkend="header.header_test">Header Test</link>
+ </bridgehead>
+ <para>
+ Testing headers without sections.
+ </para>
+</article>

Added: trunk/tools/quickbook/test/heading.quickbook
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/heading.quickbook 2009-10-11 12:18:04 EDT (Sun, 11 Oct 2009)
@@ -0,0 +1,8 @@
+[article Header
+ [quickbook 1.5]
+ [id header]
+]
+
+[heading Header Test]
+
+Testing headers without sections.
\ No newline at end of file

Modified: trunk/tools/quickbook/test/table_1_5.gold
==============================================================================
--- trunk/tools/quickbook/test/table_1_5.gold (original)
+++ trunk/tools/quickbook/test/table_1_5.gold 2009-10-11 12:18:04 EDT (Sun, 11 Oct 2009)
@@ -4,7 +4,7 @@
   <title>Table 1.5</title>
   <articleinfo>
   </articleinfo>
- <table frame="all" id="table1"> <title>Table 1</title>
+ <table frame="all" id="table_1_5.table1"> <title>Table 1</title>
   <tgroup cols="1">
     <thead>
       <row>
@@ -25,7 +25,7 @@
       </row>
     </tbody>
   </tgroup>
- </table> <table frame="all" id="table_2"> <title>Table 2</title>
+ </table> <table frame="all" id="table_1_5.table_2"> <title>Table 2</title>
   <tgroup cols="1">
     <thead>
       <row>
@@ -69,7 +69,7 @@
       </tbody>
     </tgroup>
   </informaltable>
- <informaltable frame="all" id="table4">
+ <informaltable frame="all" id="table_1_5.table4">
     <tgroup cols="1">
       <thead>
         <row>
@@ -91,7 +91,7 @@
       </tbody>
     </tgroup>
   </informaltable>
- <table frame="all" id="_table5_"> <title>-table5-</title>
+ <table frame="all" id="table_1_5._table5_"> <title>-table5-</title>
   <tgroup cols="1">
     <thead>
       <row>
@@ -113,4 +113,29 @@
     </tbody>
   </tgroup>
   </table>
+ <section id="table_1_5.section1">
+ <title><link linkend="table_1_5.section1"> Section 1</link></title> <table frame="all"
+ id="table_1_5.section1.table1"> <title>Table 1</title>
+ <tgroup cols="1">
+ <thead>
+ <row>
+ <entry>
+ <para>
+ Heading
+ </para>
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>
+ cell
+ </para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
 </article>

Modified: trunk/tools/quickbook/test/table_1_5.quickbook
==============================================================================
--- trunk/tools/quickbook/test/table_1_5.quickbook (original)
+++ trunk/tools/quickbook/test/table_1_5.quickbook 2009-10-11 12:18:04 EDT (Sun, 11 Oct 2009)
@@ -1,5 +1,6 @@
 [article Table 1.5
     [quickbook 1.5]
+ [id table_1_5]
 ]
 
 [table:table1 Table 1
@@ -25,4 +26,13 @@
 [table:-table5-
     [[Heading]]
     [[cell]]
-]
\ No newline at end of file
+]
+
+[section:section1 Section 1]
+
+[table:table1 Table 1
+ [[Heading]]
+ [[cell]]
+]
+
+[endsect]
\ 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