Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85590 - in trunk/tools/quickbook: doc src test/include
From: dnljms_at_[hidden]
Date: 2013-09-07 03:24:47


Author: danieljames
Date: 2013-09-07 03:24:47 EDT (Sat, 07 Sep 2013)
New Revision: 85590
URL: http://svn.boost.org/trac/boost/changeset/85590

Log:
Respect indentation at the start of a file.

Fix bug where a code block at the start of a file was not recognised.
I was actually adding this test to check that the `source_mode_unset`
mechanism in `doc_info_grammar.cpp` was working, but it ended exposing
this bug.

Added:
   trunk/tools/quickbook/test/include/source_mode-inc2.quickbook (contents, props changed)
Text files modified:
   trunk/tools/quickbook/doc/change_log.qbk | 1 +
   trunk/tools/quickbook/src/doc_info_grammar.cpp | 13 ++++++++-----
   trunk/tools/quickbook/test/include/source_mode-1_5.gold | 2 ++
   trunk/tools/quickbook/test/include/source_mode-1_5.quickbook | 3 ++-
   trunk/tools/quickbook/test/include/source_mode-1_6.gold | 2 ++
   trunk/tools/quickbook/test/include/source_mode-1_6.quickbook | 3 ++-
   trunk/tools/quickbook/test/include/source_mode-inc2.quickbook | 3 +++
   7 files changed, 20 insertions(+), 7 deletions(-)

Modified: trunk/tools/quickbook/doc/change_log.qbk
==============================================================================
--- trunk/tools/quickbook/doc/change_log.qbk Sat Sep 7 02:56:47 2013 (r85589)
+++ trunk/tools/quickbook/doc/change_log.qbk 2013-09-07 03:24:47 EDT (Sat, 07 Sep 2013) (r85590)
@@ -306,6 +306,7 @@
 * Improved markup for lists.
 * Make escaping templates with a punctuation identifier illegal.
   Escaping templates with an alphanumeric identifier is still fine.
+* Fix detection of code blocks at the start of a file.
 * 1.7 changes:
   * Make it an error to use an element in the wrong context.
   * Error if the body of a phrase element doesn't parse.

Modified: trunk/tools/quickbook/src/doc_info_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/doc_info_grammar.cpp Sat Sep 7 02:56:47 2013 (r85589)
+++ trunk/tools/quickbook/src/doc_info_grammar.cpp 2013-09-07 03:24:47 EDT (Sat, 07 Sep 2013) (r85590)
@@ -123,11 +123,14 @@
         scoped_parser<to_value_scoped_action> to_value(state);
         
         doc_info_details =
- space [ph::var(local.source_mode_unset) = true]
- >> *( local.doc_attribute
- >> space
+ cl::eps_p [ph::var(local.source_mode_unset) = true]
+ >> *( space
+ >> local.doc_attribute
+ )
+ >> !( space
+ >> local.doc_info_block
                 )
- >> !local.doc_info_block
+ >> *eol
             ;
 
         local.doc_info_block =
@@ -155,7 +158,7 @@
                     )
                 ) [state.values.sort()]
>> ( ']'
- >> (+eol | cl::end_p)
+ >> (eol | cl::end_p)
                 | cl::eps_p [error]
                 )
             ;

Modified: trunk/tools/quickbook/test/include/source_mode-1_5.gold
==============================================================================
--- trunk/tools/quickbook/test/include/source_mode-1_5.gold Sat Sep 7 02:56:47 2013 (r85589)
+++ trunk/tools/quickbook/test/include/source_mode-1_5.gold 2013-09-07 03:24:47 EDT (Sat, 07 Sep 2013) (r85590)
@@ -4,4 +4,6 @@
  xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>Souce Mode Include</title>
 <programlisting>void main() {}</programlisting>
+<programlisting>void main() {}
+</programlisting>
 </article>

Modified: trunk/tools/quickbook/test/include/source_mode-1_5.quickbook
==============================================================================
--- trunk/tools/quickbook/test/include/source_mode-1_5.quickbook Sat Sep 7 02:56:47 2013 (r85589)
+++ trunk/tools/quickbook/test/include/source_mode-1_5.quickbook 2013-09-07 03:24:47 EDT (Sat, 07 Sep 2013) (r85590)
@@ -1,3 +1,4 @@
 [article Souce Mode Include [source-mode teletype][quickbook 1.5]]
 
-[include source_mode-inc1.quickbook]
\ No newline at end of file
+[include source_mode-inc1.quickbook]
+[include source_mode-inc2.quickbook]

Modified: trunk/tools/quickbook/test/include/source_mode-1_6.gold
==============================================================================
--- trunk/tools/quickbook/test/include/source_mode-1_6.gold Sat Sep 7 02:56:47 2013 (r85589)
+++ trunk/tools/quickbook/test/include/source_mode-1_6.gold 2013-09-07 03:24:47 EDT (Sat, 07 Sep 2013) (r85590)
@@ -8,4 +8,6 @@
     <title>Source include with no source-mode</title>
 <programlisting><phrase role="keyword">void</phrase> <phrase role="identifier">main</phrase><phrase role="special">()</phrase> <phrase role="special">{}</phrase></programlisting>
   </article>
+<programlisting>void main() {}
+</programlisting>
 </article>

Modified: trunk/tools/quickbook/test/include/source_mode-1_6.quickbook
==============================================================================
--- trunk/tools/quickbook/test/include/source_mode-1_6.quickbook Sat Sep 7 02:56:47 2013 (r85589)
+++ trunk/tools/quickbook/test/include/source_mode-1_6.quickbook 2013-09-07 03:24:47 EDT (Sat, 07 Sep 2013) (r85590)
@@ -1,4 +1,5 @@
 [source-mode teletype][quickbook 1.6]
 [article Souce Mode Include]
 
-[include source_mode-inc1.quickbook]
\ No newline at end of file
+[include source_mode-inc1.quickbook]
+[include source_mode-inc2.quickbook]

Added: trunk/tools/quickbook/test/include/source_mode-inc2.quickbook
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/tools/quickbook/test/include/source_mode-inc2.quickbook 2013-09-07 03:24:47 EDT (Sat, 07 Sep 2013) (r85590)
@@ -0,0 +1,3 @@
+[/ Source include with no source-mode, and no docinfo.]
+
+ void main() {}


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