|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r55911 - in trunk/tools/quickbook: . detail doc test
From: daniel_james_at_[hidden]
Date: 2009-08-31 07:37:33
Author: danieljames
Date: 2009-08-31 07:37:32 EDT (Mon, 31 Aug 2009)
New Revision: 55911
URL: http://svn.boost.org/trac/boost/changeset/55911
Log:
Ignore spaces after 'section:' for quickbook 1.5+ Refs #2712
And warn when section id is empty after colon.
Added:
trunk/tools/quickbook/test/section_1_4.gold (contents, props changed)
trunk/tools/quickbook/test/section_1_4.quickbook (contents, props changed)
trunk/tools/quickbook/test/section_1_5.gold (contents, props changed)
trunk/tools/quickbook/test/section_1_5.quickbook (contents, props changed)
Text files modified:
trunk/tools/quickbook/block.hpp | 9 ++++++++-
trunk/tools/quickbook/detail/actions.cpp | 6 ++++++
trunk/tools/quickbook/detail/actions.hpp | 5 +++++
trunk/tools/quickbook/detail/actions_class.hpp | 1 +
trunk/tools/quickbook/doc/quickbook.qbk | 1 +
trunk/tools/quickbook/test/Jamfile.v2 | 2 ++
6 files changed, 23 insertions(+), 1 deletions(-)
Modified: trunk/tools/quickbook/block.hpp
==============================================================================
--- trunk/tools/quickbook/block.hpp (original)
+++ trunk/tools/quickbook/block.hpp 2009-08-31 07:37:32 EDT (Mon, 31 Aug 2009)
@@ -22,6 +22,7 @@
namespace quickbook
{
using namespace boost::spirit::classic;
+ extern unsigned qbk_version_n;
template <typename Actions, bool skip_initial_spaces = false>
struct block_grammar : grammar<block_grammar<Actions> >
@@ -125,7 +126,13 @@
begin_section =
"section"
>> hard_space
- >> (':' >> (*(alnum_p | '_')) [assign_a(actions.section_id)]
+ >> ( ':' >>
+ (
+ if_p(qbk_since(105u)) [space]
+ >> (+(alnum_p | '_')) [assign_a(actions.section_id)]
+ | eps_p [actions.section_warning]
+ [assign_a(actions.section_id)]
+ )
| eps_p [assign_a(actions.section_id)]
)
>> phrase [actions.begin_section]
Modified: trunk/tools/quickbook/detail/actions.cpp
==============================================================================
--- trunk/tools/quickbook/detail/actions.cpp (original)
+++ trunk/tools/quickbook/detail/actions.cpp 2009-08-31 07:37:32 EDT (Mon, 31 Aug 2009)
@@ -963,6 +963,12 @@
qualified_section_id.erase(n, std::string::npos);
}
}
+
+ void section_warning_action::operator()(iterator first, iterator) const
+ {
+ boost::spirit::classic::file_position const pos = first.get_position();
+ detail::outwarn(pos.file,pos.line) << "Empty section id after 'section:'.\n";
+ }
fs::path path_difference(fs::path const& outdir, fs::path const& path)
{
Modified: trunk/tools/quickbook/detail/actions.hpp
==============================================================================
--- trunk/tools/quickbook/detail/actions.hpp (original)
+++ trunk/tools/quickbook/detail/actions.hpp 2009-08-31 07:37:32 EDT (Mon, 31 Aug 2009)
@@ -705,6 +705,11 @@
std::string& qualified_section_id;
int& error_count;
};
+
+ struct section_warning_action
+ {
+ void operator()(iterator first, iterator last) const;
+ };
struct xinclude_action
{
Modified: trunk/tools/quickbook/detail/actions_class.hpp
==============================================================================
--- trunk/tools/quickbook/detail/actions_class.hpp (original)
+++ trunk/tools/quickbook/detail/actions_class.hpp 2009-08-31 07:37:32 EDT (Mon, 31 Aug 2009)
@@ -191,6 +191,7 @@
begin_section_action begin_section;
end_section_action end_section;
+ section_warning_action section_warning;
xinclude_action xinclude;
include_action include;
import_action import;
Modified: trunk/tools/quickbook/doc/quickbook.qbk
==============================================================================
--- trunk/tools/quickbook/doc/quickbook.qbk (original)
+++ trunk/tools/quickbook/doc/quickbook.qbk 2009-08-31 07:37:32 EDT (Mon, 31 Aug 2009)
@@ -177,6 +177,7 @@
* Support for python snippets.
* `teletype` source mode.
* Use static scoping in templates, should be a lot more intuitive.
+* Accept a space between `section:` and the section id.
[endsect]
Modified: trunk/tools/quickbook/test/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/test/Jamfile.v2 (original)
+++ trunk/tools/quickbook/test/Jamfile.v2 2009-08-31 07:37:32 EDT (Mon, 31 Aug 2009)
@@ -25,6 +25,8 @@
[ quickbook-test templates_1_5 ]
[ quickbook-test xinclude ]
[ quickbook-test import ]
+ [ quickbook-test section_1_4 ]
+ [ quickbook-test section_1_5 ]
[ quickbook-fail-test fail-include ]
[ quickbook-fail-test fail-import ]
[ quickbook-fail-test fail-template-arguments1 ]
Added: trunk/tools/quickbook/test/section_1_4.gold
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/section_1_4.gold 2009-08-31 07:37:32 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,22 @@
+<?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="section_id_1_4" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Section Id 1.4</title>
+ <articleinfo>
+ </articleinfo>
+ <section id="section_id_1_4.id_test1">
+ <title><link linkend="section_id_1_4.id_test1"> Quickbook section id test</link></title>
+ </section>
+ <section id="section_id_1_4.id_test2">
+ <title><link linkend="section_id_1_4.id_test2"> Quickbook section id test</link></title>
+ </section>
+ <section id="section_id_1_4._quickbook_section_no_id_test_1">
+ <title><link linkend="section_id_1_4._quickbook_section_no_id_test_1"> Quickbook
+ section no id test 1</link></title>
+ </section>
+ <section id="section_id_1_4.___quickbook_section_no_id_test_2">
+ <title><link linkend="section_id_1_4.___quickbook_section_no_id_test_2">++ Quickbook
+ section no id test 2</link></title>
+ </section>
+</article>
Added: trunk/tools/quickbook/test/section_1_4.quickbook
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/section_1_4.quickbook 2009-08-31 07:37:32 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,12 @@
+[article Section Id 1.4
+ [quickbook 1.4]
+]
+
+[section:id_test1 Quickbook section id test]
+[endsect]
+[section :id_test2 Quickbook section id test]
+[endsect]
+[section: Quickbook section no id test 1]
+[endsect]
+[section:++ Quickbook section no id test 2]
+[endsect]
\ No newline at end of file
Added: trunk/tools/quickbook/test/section_1_5.gold
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/section_1_5.gold 2009-08-31 07:37:32 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,21 @@
+<?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="section_id_1_5" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Section Id 1.5</title>
+ <articleinfo>
+ </articleinfo>
+ <section id="section_id_1_5.id_test1">
+ <title><link linkend="section_id_1_5.id_test1"> Quickbook section id test</link></title>
+ </section>
+ <section id="section_id_1_5.id_test2">
+ <title><link linkend="section_id_1_5.id_test2"> Quickbook section id test</link></title>
+ </section>
+ <section id="section_id_1_5.id_test3">
+ <title><link linkend="section_id_1_5.id_test3"> Quickbook section id test</link></title>
+ </section>
+ <section id="section_id_1_5.___quickbook_section_no_id_test">
+ <title><link linkend="section_id_1_5.___quickbook_section_no_id_test">++ Quickbook
+ section no id test</link></title>
+ </section>
+</article>
Added: trunk/tools/quickbook/test/section_1_5.quickbook
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/section_1_5.quickbook 2009-08-31 07:37:32 EDT (Mon, 31 Aug 2009)
@@ -0,0 +1,12 @@
+[article Section Id 1.5
+ [quickbook 1.5]
+]
+
+[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 no id test]
+[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