Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86691 - in trunk/tools/quickbook: src test
From: dnljms_at_[hidden]
Date: 2013-11-13 16:51:06


Author: danieljames
Date: 2013-11-13 16:51:05 EST (Wed, 13 Nov 2013)
New Revision: 86691
URL: http://svn.boost.org/trac/boost/changeset/86691

Log:
Use quickbook 1.7's attribute value for element ids.

Allows use of templates, and allows more characters, ids now end with
whitespace - like ids in links.

Added:
   trunk/tools/quickbook/test/heading-1_7.gold (contents, props changed)
   trunk/tools/quickbook/test/heading-1_7.quickbook (contents, props changed)
   trunk/tools/quickbook/test/section-1_7.gold (contents, props changed)
   trunk/tools/quickbook/test/section-1_7.quickbook (contents, props changed)
Text files modified:
   trunk/tools/quickbook/src/actions.cpp | 19 +++---
   trunk/tools/quickbook/src/block_element_grammar.cpp | 5 +
   trunk/tools/quickbook/test/Jamfile.v2 | 2
   trunk/tools/quickbook/test/heading-1_7.gold | 113 ++++++++++++++++++++++++++++++++++++++++
   trunk/tools/quickbook/test/heading-1_7.quickbook | 83 +++++++++++++++++++++++++++++
   trunk/tools/quickbook/test/section-1_7.gold | 26 +++++++++
   trunk/tools/quickbook/test/section-1_7.quickbook | 18 ++++++
   trunk/tools/quickbook/test/table-1_7.gold | 12 +++-
   trunk/tools/quickbook/test/table-1_7.quickbook | 3 +
   9 files changed, 268 insertions(+), 13 deletions(-)

Modified: trunk/tools/quickbook/src/actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions.cpp Wed Nov 13 16:50:29 2013 (r86690)
+++ trunk/tools/quickbook/src/actions.cpp 2013-11-13 16:51:05 EST (Wed, 13 Nov 2013) (r86691)
@@ -440,7 +440,7 @@
             // Use an explicit id.
 
             std::string anchor = state.document.add_id(
- element_id.get_quickbook(),
+ validate_id(state, element_id),
                 id_category::explicit_id);
 
             write_bridgehead(state, level,
@@ -1619,8 +1619,9 @@
         value_consumer values = table;
 
         std::string element_id;
- if(values.check(general_tags::element_id))
- element_id = detail::to_s(values.consume().get_quickbook());
+ if(values.check(general_tags::element_id)) {
+ element_id = validate_id(state, values.consume());
+ }
 
         value title = values.consume(table_tags::title);
         bool has_title = !title.empty();
@@ -1719,12 +1720,12 @@
         values.finish();
 
         std::string full_id = state.document.begin_section(
- !element_id.empty() ?
- element_id.get_quickbook() :
- detail::make_identifier(content.get_quickbook()),
- !element_id.empty() ?
- id_category::explicit_section_id :
- id_category::generated_section,
+ element_id.empty() ?
+ detail::make_identifier(content.get_quickbook()) :
+ validate_id(state, element_id),
+ element_id.empty() ?
+ id_category::generated_section :
+ id_category::explicit_section_id,
             state.current_source_mode());
 
         state.out << "\n<section id=\"" << full_id << "\">\n";

Modified: trunk/tools/quickbook/src/block_element_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/block_element_grammar.cpp Wed Nov 13 16:50:29 2013 (r86690)
+++ trunk/tools/quickbook/src/block_element_grammar.cpp 2013-11-13 16:51:05 EST (Wed, 13 Nov 2013) (r86691)
@@ -53,7 +53,10 @@
 
         local.element_id =
             !( ':'
- >> ( !(qbk_ver(105u) >> space)
+ >> ( qbk_ver(107u)
+ >> to_value(general_tags::element_id) [attribute_value_1_7]
+ | qbk_ver(0, 107u)
+ >> !(qbk_ver(105u) >> space)
>> (+(cl::alnum_p | '_')) [state.values.entry(ph::arg1, ph::arg2, general_tags::element_id)]
                 | cl::eps_p [element_id_warning]
                 )

Modified: trunk/tools/quickbook/test/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/test/Jamfile.v2 Wed Nov 13 16:50:29 2013 (r86690)
+++ trunk/tools/quickbook/test/Jamfile.v2 2013-11-13 16:51:05 EST (Wed, 13 Nov 2013) (r86691)
@@ -53,6 +53,7 @@
     [ quickbook-test heading-1_3 ]
     [ quickbook-test heading-1_5 ]
     [ quickbook-test heading-1_6 ]
+ [ quickbook-test heading-1_7 ]
     [ quickbook-error-test heading_unclosed-1_4-fail ]
     [ quickbook-test hr-1_5 ]
     [ quickbook-test hr-1_6 ]
@@ -94,6 +95,7 @@
     [ quickbook-test section-1_4 ]
     [ quickbook-test section-1_5-unclosed ]
     [ quickbook-test section-1_5 ]
+ [ quickbook-test section-1_7 ]
     [ quickbook-test simple_markup-1_5 ]
     [ quickbook-test source_mode-1_7 ]
     [ quickbook-test svg-1_1 ]

Added: trunk/tools/quickbook/test/heading-1_7.gold
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/tools/quickbook/test/heading-1_7.gold 2013-11-13 16:51:05 EST (Wed, 13 Nov 2013) (r86691)
@@ -0,0 +1,113 @@
+<?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="heading_test_1_7" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Heading Test 1.7</title>
+ <bridgehead renderas="sect2" id="heading_test_1_7.h0">
+ <phrase id="heading_test_1_7.generic_header"/><link linkend="heading_test_1_7.generic_header">Generic
+ header</link>
+ </bridgehead>
+ <bridgehead renderas="sect1" id="heading_test_1_7.h2">
+ <phrase id="heading_test_1_7.level_1"/><link linkend="heading_test_1_7.level_1">Level
+ 1</link>
+ </bridgehead>
+ <bridgehead renderas="sect2" id="heading_test_1_7.h3">
+ <phrase id="heading_test_1_7.level_2"/><link linkend="heading_test_1_7.level_2">Level
+ 2</link>
+ </bridgehead>
+ <bridgehead renderas="sect3" id="heading_test_1_7.h4">
+ <phrase id="heading_test_1_7.level_3"/><link linkend="heading_test_1_7.level_3">Level
+ 3</link>
+ </bridgehead>
+ <bridgehead renderas="sect4" id="heading_test_1_7.h5">
+ <phrase id="heading_test_1_7.level_4"/><link linkend="heading_test_1_7.level_4">Level
+ 4</link>
+ </bridgehead>
+ <bridgehead renderas="sect5" id="heading_test_1_7.h6">
+ <phrase id="heading_test_1_7.level_5"/><link linkend="heading_test_1_7.level_5">Level
+ 5</link>
+ </bridgehead>
+ <bridgehead renderas="sect6" id="heading_test_1_7.h8">
+ <phrase id="heading_test_1_7.level_6"/><link linkend="heading_test_1_7.level_6">Level
+ 6</link>
+ </bridgehead>
+ <bridgehead renderas="sect1" id="heading_test_1_7.h9">
+ <phrase id="heading_test_1_7.bold"/><link linkend="heading_test_1_7.bold"><emphasis
+ role="bold">Bold</emphasis></link>
+ </bridgehead>
+ <bridgehead renderas="sect1" id="heading_test_1_7.h10">
+ <phrase id="heading_test_1_7.comment"/><link linkend="heading_test_1_7.comment">Comment</link>
+ </bridgehead>
+ <bridgehead renderas="sect1" id="heading_test_1_7.h11">
+ <phrase id="heading_test_1_7.anchor_anchor_heading"/><link linkend="heading_test_1_7.anchor_anchor_heading"><anchor
+ id="anchor"/>Anchor heading</link>
+ </bridgehead>
+ <bridgehead renderas="sect1" id="heading_test_1_7.h12">
+ <phrase id="heading_test_1_7.link_anchor_link_heading"/><link linkend="heading_test_1_7.link_anchor_link_heading"><link
+ linkend="anchor">Link heading</link></link>
+ </bridgehead>
+ <bridgehead renderas="sect1" id="heading_test_1_7.h13">
+ <phrase id="heading_test_1_7.h1"/><link linkend="heading_test_1_7.h1">H1</link>
+ </bridgehead>
+ <section id="heading_test_1_7.s1">
+ <title><link linkend="heading_test_1_7.s1">S1</link></title>
+ <bridgehead renderas="sect3" id="heading_test_1_7.s1.h0">
+ <phrase id="heading_test_1_7.s1.h2"/><link linkend="heading_test_1_7.s1.h2">H2</link>
+ </bridgehead>
+ <section id="heading_test_1_7.s1.s2">
+ <title><link linkend="heading_test_1_7.s1.s2">S2</link></title>
+ <bridgehead renderas="sect3" id="heading_test_1_7.s1.s2.h0">
+ <phrase id="heading_test_1_7.s1.s2.h3"/><link linkend="heading_test_1_7.s1.s2.h3">H3</link>
+ </bridgehead>
+ </section>
+ <bridgehead renderas="sect2" id="heading_test_1_7.s1.h1">
+ <phrase id="heading_test_1_7.s1.h4"/><link linkend="heading_test_1_7.s1.h4">H4</link>
+ </bridgehead>
+ <section id="heading_test_1_7.s1.s3">
+ <title><link linkend="heading_test_1_7.s1.s3">S3</link></title>
+ <bridgehead renderas="sect4" id="heading_test_1_7.s1.s3.h0">
+ <phrase id="heading_test_1_7.s1.s3.h5"/><link linkend="heading_test_1_7.s1.s3.h5">H5</link>
+ </bridgehead>
+ </section>
+ <bridgehead renderas="sect2" id="heading_test_1_7.s1.h3">
+ <phrase id="heading_test_1_7.s1.h6"/><link linkend="heading_test_1_7.s1.h6">H6</link>
+ </bridgehead>
+ </section>
+ <bridgehead renderas="sect1" id="heading_test_1_7.h14">
+ <phrase id="heading_test_1_7.h7"/><link linkend="heading_test_1_7.h7">H7</link>
+ </bridgehead>
+ <bridgehead renderas="sect1" id="heading_test_1_7.h15">
+ <phrase id="heading_test_1_7.a1"/><link linkend="heading_test_1_7.a1">H1</link>
+ </bridgehead>
+ <section id="heading_test_1_7.s1_0">
+ <title><link linkend="heading_test_1_7.s1_0">S1</link></title>
+ <bridgehead renderas="sect2" id="heading_test_1_7.s1_0.h0">
+ <phrase id="heading_test_1_7.s1_0.a2"/><link linkend="heading_test_1_7.s1_0.a2">H2</link>
+ </bridgehead>
+ <section id="heading_test_1_7.s1_0.s2">
+ <title><link linkend="heading_test_1_7.s1_0.s2">S2</link></title>
+ <bridgehead renderas="sect3" id="heading_test_1_7.s1_0.s2.h0">
+ <phrase id="heading_test_1_7.s1_0.s2.a3"/><link linkend="heading_test_1_7.s1_0.s2.a3">H3</link>
+ </bridgehead>
+ </section>
+ <bridgehead renderas="sect2" id="heading_test_1_7.s1_0.h1">
+ <phrase id="heading_test_1_7.s1_0.a4"/><link linkend="heading_test_1_7.s1_0.a4">H4</link>
+ </bridgehead>
+ <section id="heading_test_1_7.s1_0.s3">
+ <title><link linkend="heading_test_1_7.s1_0.s3">S3</link></title>
+ <bridgehead renderas="sect3" id="heading_test_1_7.s1_0.s3.h0">
+ <phrase id="heading_test_1_7.s1_0.s3.a5"/><link linkend="heading_test_1_7.s1_0.s3.a5">H5</link>
+ </bridgehead>
+ </section>
+ <bridgehead renderas="sect3" id="heading_test_1_7.s1_0.h2">
+ <phrase id="heading_test_1_7.s1_0.a6"/><link linkend="heading_test_1_7.s1_0.a6">H6</link>
+ </bridgehead>
+ </section>
+ <bridgehead renderas="sect1" id="heading_test_1_7.h16">
+ <phrase id="heading_test_1_7.a7"/><link linkend="heading_test_1_7.a7">H7</link>
+ </bridgehead>
+ <bridgehead renderas="sect2" id="heading_test_1_7.h17">
+ <phrase id="heading_test_1_7.abc-2"/><link linkend="heading_test_1_7.abc-2">Template
+ Id</link>
+ </bridgehead>
+</article>

Added: trunk/tools/quickbook/test/heading-1_7.quickbook
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/tools/quickbook/test/heading-1_7.quickbook 2013-11-13 16:51:05 EST (Wed, 13 Nov 2013) (r86691)
@@ -0,0 +1,83 @@
+[article Heading Test 1.7
+[quickbook 1.7]
+]
+
+[/ Basic headers ]
+
+[heading Generic header]
+[h1 Level 1]
+[h2 Level 2]
+[h3 Level 3]
+[h4 Level 4]
+[h5 Level 5]
+[h6 Level 6]
+
+[/ Test how heading ids are generated when different types of markup are present]
+
+[h1 *Bold*]
+[h1 [/]Comment[/]]
+
+[/ Test how ids are generated for headings containing things like anchors
+ and links ]
+
+[h1 [#anchor]Anchor heading]
+[h1 [link anchor Link heading]]
+
+[/ Test how heading ids are generated inside sections]
+
+[h1 H1]
+
+[section:s1 S1]
+
+[heading H2]
+
+[section:s2 S2]
+
+[h3 H3]
+
+[endsect]
+
+[h2 H4]
+
+[section:s3 S3]
+
+[heading H5]
+
+[endsect]
+
+[h2 H6]
+
+[endsect]
+
+[h1 H7]
+
+[/ Repeat with explicit ids]
+
+[h1:a1 H1]
+
+[section:s1 S1]
+
+[h2:a2 H2]
+
+[section:s2 S2]
+
+[h3:a3 H3]
+
+[endsect]
+
+[h2:a4 H4]
+
+[section:s3 S3]
+
+[h3:a5 H5]
+
+[endsect]
+
+[heading:a6 H6]
+
+[endsect]
+
+[h1:a7 H7]
+
+[template thing[] abc]
+[heading:[thing]-2 Template Id]

Added: trunk/tools/quickbook/test/section-1_7.gold
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/tools/quickbook/test/section-1_7.gold 2013-11-13 16:51:05 EST (Wed, 13 Nov 2013) (r86691)
@@ -0,0 +1,26 @@
+<?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="section_id_1_7" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Section Id 1.7</title>
+ <section id="section_id_1_7.quickbook_section_no_id_test">
+ <title><link linkend="section_id_1_7.quickbook_section_no_id_test">Quickbook
+ section no id test</link></title>
+ </section>
+ <section id="section_id_1_7.id_test1">
+ <title><link linkend="section_id_1_7.id_test1">Quickbook section id test</link></title>
+ </section>
+ <section id="section_id_1_7.id_test2">
+ <title><link linkend="section_id_1_7.id_test2">Quickbook section id test</link></title>
+ </section>
+ <section id="section_id_1_7.id_test3_quickbook_section_id_te">
+ <title><link linkend="section_id_1_7.id_test3_quickbook_section_id_te">id_test3
+ Quickbook section id test</link></title>
+ </section>
+ <section id="section_id_1_7.--">
+ <title><link linkend="section_id_1_7.--">Quickbook section odd id test</link></title>
+ </section>
+ <section id="section_id_1_7.sect-abc">
+ <title><link linkend="section_id_1_7.sect-abc">Section with template in id</link></title>
+ </section>
+</article>

Added: trunk/tools/quickbook/test/section-1_7.quickbook
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/tools/quickbook/test/section-1_7.quickbook 2013-11-13 16:51:05 EST (Wed, 13 Nov 2013) (r86691)
@@ -0,0 +1,18 @@
+[article Section Id 1.7
+ [quickbook 1.7]
+]
+
+[section Quickbook section no id test]
+[endsect]
+[section:id_test1 Quickbook section id test]
+[endsect]
+[section :id_test2 Quickbook section id test]
+[endsect]
+[section: id_test3 Quickbook section id test]
+[endsect]
+[section:-- Quickbook section odd id test]
+[endsect]
+
+[template thing[] abc]
+[section:sect-[thing] Section with template in id]
+[endsect]

Modified: trunk/tools/quickbook/test/table-1_7.gold
==============================================================================
--- trunk/tools/quickbook/test/table-1_7.gold Wed Nov 13 16:50:29 2013 (r86690)
+++ trunk/tools/quickbook/test/table-1_7.gold 2013-11-13 16:51:05 EST (Wed, 13 Nov 2013) (r86691)
@@ -93,8 +93,7 @@
       </tbody>
     </tgroup>
   </informaltable>
- <table frame="all" id="table_tests.table5">
- <title>-table5-</title>
+ <informaltable frame="all" id="table_tests.-table5-">
     <tgroup cols="1">
       <thead>
         <row>
@@ -115,7 +114,7 @@
         </row>
       </tbody>
     </tgroup>
- </table>
+ </informaltable>
   <table frame="all" id="table_tests.title">
     <title>Title</title>
     <tgroup cols="1">
@@ -510,5 +509,12 @@
         </tbody>
       </tgroup>
     </table>
+ <table frame="all" id="table_tests.section1.id123">
+ <title>Table with template id</title>
+ <tgroup cols="0">
+ <tbody>
+ </tbody>
+ </tgroup>
+ </table>
   </section>
 </article>

Modified: trunk/tools/quickbook/test/table-1_7.quickbook
==============================================================================
--- trunk/tools/quickbook/test/table-1_7.quickbook Wed Nov 13 16:50:29 2013 (r86690)
+++ trunk/tools/quickbook/test/table-1_7.quickbook 2013-11-13 16:51:05 EST (Wed, 13 Nov 2013) (r86691)
@@ -145,4 +145,7 @@
 [[[#id2]a[#id3]]][[b]]
 ]
 
+[template id_value[] id123]
+[table:[id_value] Table with template id]
+
 [endsect]


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