Boost logo

Boost-Commit :

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


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

Log:
Ids for headings.
Added:
   trunk/tools/quickbook/test/heading_1_6.gold (contents, props changed)
   trunk/tools/quickbook/test/heading_1_6.quickbook (contents, props changed)
Text files modified:
   trunk/tools/quickbook/block.hpp | 26 ++++++++++++++++++--------
   trunk/tools/quickbook/detail/actions.cpp | 10 ++++++----
   trunk/tools/quickbook/detail/actions.hpp | 6 ++++++
   trunk/tools/quickbook/detail/actions_class.cpp | 14 +++++++-------
   trunk/tools/quickbook/doc/quickbook.qbk | 2 ++
   trunk/tools/quickbook/test/Jamfile.v2 | 1 +
   trunk/tools/quickbook/test/heading.gold | 14 ++++++++++++++
   trunk/tools/quickbook/test/heading.quickbook | 10 +++++++++-
   8 files changed, 63 insertions(+), 20 deletions(-)

Modified: trunk/tools/quickbook/block.hpp
==============================================================================
--- trunk/tools/quickbook/block.hpp (original)
+++ trunk/tools/quickbook/block.hpp 2010-08-15 12:43:40 EDT (Sun, 15 Aug 2010)
@@ -146,6 +146,15 @@
                         ]
                         ;
 
+ element_id_1_6 =
+ if_p(qbk_since(106u)) [
+ element_id
+ ]
+ .else_p [
+ eps_p [assign_a(actions.element_id)]
+ ]
+ ;
+
                 begin_section =
                        "section"
>> hard_space
@@ -161,13 +170,13 @@
                     h1 | h2 | h3 | h4 | h5 | h6 | h
                     ;
 
- h = "heading" >> hard_space >> phrase [actions.h];
- h1 = "h1" >> hard_space >> phrase [actions.h1];
- h2 = "h2" >> hard_space >> phrase [actions.h2];
- h3 = "h3" >> hard_space >> phrase [actions.h3];
- h4 = "h4" >> hard_space >> phrase [actions.h4];
- h5 = "h5" >> hard_space >> phrase [actions.h5];
- h6 = "h6" >> hard_space >> phrase [actions.h6];
+ h = "heading" >> hard_space >> element_id_1_6 >> phrase [actions.h];
+ h1 = "h1" >> hard_space >> element_id_1_6 >> phrase [actions.h1];
+ h2 = "h2" >> hard_space >> element_id_1_6 >> phrase [actions.h2];
+ h3 = "h3" >> hard_space >> element_id_1_6 >> phrase [actions.h3];
+ h4 = "h4" >> hard_space >> element_id_1_6 >> phrase [actions.h4];
+ h5 = "h5" >> hard_space >> element_id_1_6 >> phrase [actions.h5];
+ h6 = "h6" >> hard_space >> element_id_1_6 >> phrase [actions.h6];
 
                 static const bool true_ = true;
                 static const bool false_ = false;
@@ -446,7 +455,8 @@
                             xinclude, include, hard_space, eol, paragraph_end,
                             template_, template_id, template_formal_arg,
                             template_body, identifier, dummy_block, import,
- inside_paragraph, element_id, element_id_1_5;
+ inside_paragraph,
+ element_id, element_id_1_5, element_id_1_6;
 
             symbols<> paragraph_end_markups;
 

Modified: trunk/tools/quickbook/detail/actions.cpp
==============================================================================
--- trunk/tools/quickbook/detail/actions.cpp (original)
+++ trunk/tools/quickbook/detail/actions.cpp 2010-08-15 12:43:40 EDT (Sun, 15 Aug 2010)
@@ -105,8 +105,9 @@
         }
         else // version 1.3 and above
         {
- std::string id = qbk_version_n >= 106 ?
- detail::make_identifier(first, last) :
+ std::string id =
+ !element_id.empty() ? element_id :
+ qbk_version_n >= 106 ? detail::make_identifier(first, last) :
                 detail::make_identifier(str.begin(), str.end());
 
             std::string anchor =
@@ -132,8 +133,9 @@
         std::string str;
         phrase.swap(str);
 
- std::string id = qbk_version_n >= 106 ?
- detail::make_identifier(first, last) :
+ std::string id =
+ !element_id.empty() ? element_id :
+ qbk_version_n >= 106 ? detail::make_identifier(first, last) :
             detail::make_identifier(str.begin(), str.end());
 
         std::string anchor =

Modified: trunk/tools/quickbook/detail/actions.hpp
==============================================================================
--- trunk/tools/quickbook/detail/actions.hpp (original)
+++ trunk/tools/quickbook/detail/actions.hpp 2010-08-15 12:43:40 EDT (Sun, 15 Aug 2010)
@@ -116,6 +116,7 @@
         header_action(
             collector& out,
             collector& phrase,
+ std::string const& element_id,
             std::string const& library_id,
             std::string const& section_id,
             std::string const& qualified_section_id,
@@ -123,6 +124,7 @@
             std::string const& post)
         : out(out)
         , phrase(phrase)
+ , element_id(element_id)
         , library_id(library_id)
         , section_id(section_id)
         , qualified_section_id(qualified_section_id)
@@ -133,6 +135,7 @@
 
         collector& out;
         collector& phrase;
+ std::string const& element_id;
         std::string const& library_id;
         std::string const& section_id;
         std::string const& qualified_section_id;
@@ -147,12 +150,14 @@
         generic_header_action(
             collector& out,
             collector& phrase,
+ std::string const& element_id,
             std::string const& library_id,
             std::string const& section_id,
             std::string const& qualified_section_id,
             int const& section_level)
         : out(out)
         , phrase(phrase)
+ , element_id(element_id)
         , library_id(library_id)
         , section_id(section_id)
         , qualified_section_id(qualified_section_id)
@@ -162,6 +167,7 @@
 
         collector& out;
         collector& phrase;
+ std::string const& element_id;
         std::string const& library_id;
         std::string const& section_id;
         std::string const& qualified_section_id;

Modified: trunk/tools/quickbook/detail/actions_class.cpp
==============================================================================
--- trunk/tools/quickbook/detail/actions_class.cpp (original)
+++ trunk/tools/quickbook/detail/actions_class.cpp 2010-08-15 12:43:40 EDT (Sun, 15 Aug 2010)
@@ -81,13 +81,13 @@
         , inline_code(phrase, syntax_p)
         , inside_paragraph(temp_para, phrase, paragraph_pre, paragraph_post)
         , write_paragraphs(out, temp_para)
- , h(out, phrase, doc_id, section_id, qualified_section_id, section_level)
- , h1(out, phrase, doc_id, section_id, qualified_section_id, h1_pre, h1_post)
- , h2(out, phrase, doc_id, section_id, qualified_section_id, h2_pre, h2_post)
- , h3(out, phrase, doc_id, section_id, qualified_section_id, h3_pre, h3_post)
- , h4(out, phrase, doc_id, section_id, qualified_section_id, h4_pre, h4_post)
- , h5(out, phrase, doc_id, section_id, qualified_section_id, h5_pre, h5_post)
- , h6(out, phrase, doc_id, section_id, qualified_section_id, h6_pre, h6_post)
+ , h(out, phrase, element_id, doc_id, section_id, qualified_section_id, section_level)
+ , h1(out, phrase, element_id, doc_id, section_id, qualified_section_id, h1_pre, h1_post)
+ , h2(out, phrase, element_id, doc_id, section_id, qualified_section_id, h2_pre, h2_post)
+ , h3(out, phrase, element_id, doc_id, section_id, qualified_section_id, h3_pre, h3_post)
+ , h4(out, phrase, element_id, doc_id, section_id, qualified_section_id, h4_pre, h4_post)
+ , h5(out, phrase, element_id, doc_id, section_id, qualified_section_id, h5_pre, h5_post)
+ , h6(out, phrase, element_id, doc_id, section_id, qualified_section_id, h6_pre, h6_post)
         , hr(out, hr_)
         , blurb(out, temp_para, blurb_pre, blurb_post)
         , blockquote(out, temp_para, blockquote_pre, blockquote_post)

Modified: trunk/tools/quickbook/doc/quickbook.qbk
==============================================================================
--- trunk/tools/quickbook/doc/quickbook.qbk (original)
+++ trunk/tools/quickbook/doc/quickbook.qbk 2010-08-15 12:43:40 EDT (Sun, 15 Aug 2010)
@@ -222,6 +222,8 @@
 [h3 Version 1.5.3 - Boost 1.45.0]
 
 * Fix command line flag for defining macros.
+* Further work on quickbook 1.6, still not stable.
+ * Allow heading to have ids, using the syntax: `[heading:id title]`.
 
 [endsect]
 

Modified: trunk/tools/quickbook/test/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/test/Jamfile.v2 (original)
+++ trunk/tools/quickbook/test/Jamfile.v2 2010-08-15 12:43:40 EDT (Sun, 15 Aug 2010)
@@ -35,6 +35,7 @@
     [ quickbook-test section_1_4 ]
     [ quickbook-test section_1_5 ]
     [ quickbook-test heading ]
+ [ quickbook-test heading_1_6 ]
     [ quickbook-test identifier_1_5 ]
     [ quickbook-test identifier_1_6 ]
     [ quickbook-test para-test ]

Modified: trunk/tools/quickbook/test/heading.gold
==============================================================================
--- trunk/tools/quickbook/test/heading.gold (original)
+++ trunk/tools/quickbook/test/heading.gold 2010-08-15 12:43:40 EDT (Sun, 15 Aug 2010)
@@ -11,4 +11,18 @@
   <para>
     Testing headers without sections.
   </para>
+ <anchor id="header._not_an_id"/>
+ <bridgehead renderas="sect2">
+ <link linkend="header._not_an_id">:Not an Id</link>
+ </bridgehead>
+ <para>
+ Paragraph.
+ </para>
+ <anchor id="header._not_an_id_again"/>
+ <bridgehead renderas="sect3">
+ <link linkend="header._not_an_id_again">:Not an Id again</link>
+ </bridgehead>
+ <para>
+ Paragraph.
+ </para>
 </article>

Modified: trunk/tools/quickbook/test/heading.quickbook
==============================================================================
--- trunk/tools/quickbook/test/heading.quickbook (original)
+++ trunk/tools/quickbook/test/heading.quickbook 2010-08-15 12:43:40 EDT (Sun, 15 Aug 2010)
@@ -5,4 +5,12 @@
 
 [heading Header Test]
 
-Testing headers without sections.
\ No newline at end of file
+Testing headers without sections.
+
+[heading:Not an Id]
+
+Paragraph.
+
+[h3:Not an Id again]
+
+Paragraph.
\ No newline at end of file

Added: trunk/tools/quickbook/test/heading_1_6.gold
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/heading_1_6.gold 2010-08-15 12:43:40 EDT (Sun, 15 Aug 2010)
@@ -0,0 +1,28 @@
+<?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="header" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $" 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>
+ Paragraph.
+ </para>
+ <anchor id="header.heading_id"/>
+ <bridgehead renderas="sect2">
+ <link linkend="header.heading_id"> Heading with an id</link>
+ </bridgehead>
+ <para>
+ Paragraph.
+ </para>
+ <anchor id="header.heading_id2"/>
+ <bridgehead renderas="sect3">
+ <link linkend="header.heading_id2"> Heading with an id</link>
+ </bridgehead>
+ <para>
+ Paragraph.
+ </para>
+</article>

Added: trunk/tools/quickbook/test/heading_1_6.quickbook
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/heading_1_6.quickbook 2010-08-15 12:43:40 EDT (Sun, 15 Aug 2010)
@@ -0,0 +1,16 @@
+[article Header
+ [quickbook 1.6]
+ [id header]
+]
+
+[heading Header Test]
+
+Paragraph.
+
+[heading:heading_id Heading with an id]
+
+Paragraph.
+
+[h3:heading_id2 Heading with an id]
+
+Paragraph.


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