|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r64829 - in trunk/tools/quickbook: . doc test
From: daniel_james_at_[hidden]
Date: 2010-08-15 12:46:24
Author: danieljames
Date: 2010-08-15 12:46:18 EDT (Sun, 15 Aug 2010)
New Revision: 64829
URL: http://svn.boost.org/trac/boost/changeset/64829
Log:
Better parser for code blocks.
* A line containing a comment with no identation will now end a code
block.
* Code blocks no longer need to be followed by a blank line.
Added:
trunk/tools/quickbook/test/code-block.gold (contents, props changed)
trunk/tools/quickbook/test/code-block.quickbook (contents, props changed)
Text files modified:
trunk/tools/quickbook/block.hpp | 13 ++++++++-----
trunk/tools/quickbook/doc/quickbook.qbk | 3 +++
trunk/tools/quickbook/test/Jamfile.v2 | 1 +
3 files changed, 12 insertions(+), 5 deletions(-)
Modified: trunk/tools/quickbook/block.hpp
==============================================================================
--- trunk/tools/quickbook/block.hpp (original)
+++ trunk/tools/quickbook/block.hpp 2010-08-15 12:46:18 EDT (Sun, 15 Aug 2010)
@@ -384,14 +384,17 @@
code =
(
code_line
- >> *(*eol >> code_line)
+ >> *(*blank_line >> code_line)
) [actions.code]
- >> +eol
+ >> *eol
;
code_line =
- ((ch_p(' ') | '\t'))
- >> *(anychar_p - eol) >> eol
+ blank_p >> *(anychar_p - eol_p) >> eol_p
+ ;
+
+ blank_line =
+ *blank_p >> eol_p
;
list =
@@ -446,7 +449,7 @@
bool no_eols;
- rule<Scanner> start_, blocks, block_markup, code, code_line,
+ rule<Scanner> start_, blocks, block_markup, code, code_line, blank_line,
paragraph, space, blank, comment, headings, h, h1, h2,
h3, h4, h5, h6, hr, blurb, blockquote, admonition,
phrase, list, phrase_end, ordered_list, def_macro,
Modified: trunk/tools/quickbook/doc/quickbook.qbk
==============================================================================
--- trunk/tools/quickbook/doc/quickbook.qbk (original)
+++ trunk/tools/quickbook/doc/quickbook.qbk 2010-08-15 12:46:18 EDT (Sun, 15 Aug 2010)
@@ -222,6 +222,9 @@
[h3 Version 1.5.3 - Boost 1.45.0]
* Fix command line flag for defining macros.
+* Fix a couple of issues with the code block parser:
+ * A comment with no indentation will now end a code block.
+ * Code blocks no longer have to be followed by a blank line.
* Further work on quickbook 1.6, still not stable.
* Allow heading to have ids, using the syntax: `[heading:id title]`.
Modified: trunk/tools/quickbook/test/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/test/Jamfile.v2 (original)
+++ trunk/tools/quickbook/test/Jamfile.v2 2010-08-15 12:46:18 EDT (Sun, 15 Aug 2010)
@@ -12,6 +12,7 @@
test-suite quickbook.test :
[ quickbook-test quickbook-manual ]
+ [ quickbook-test code-block ]
[ quickbook-test code-block-1 ]
[ quickbook-test code-block-2 ]
[ quickbook-test code-block-3 ]
Added: trunk/tools/quickbook/test/code-block.gold
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/code-block.gold 2010-08-15 12:46:18 EDT (Sun, 15 Aug 2010)
@@ -0,0 +1,45 @@
+<?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="indented_code_blocks" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Indented code blocks</title>
+ <articleinfo>
+ </articleinfo>
+ <para>
+ In a paragraph. Still in a paragraph.
+ </para>
+
+<programlisting>In a code block.
+</programlisting>
+ <para>
+ Back in a paragraph.
+ </para>
+
+<programlisting> Code block line 1.
+Code block line 2.
+ Code block line 3.
+</programlisting>
+ <para>
+ Paragraph.
+ </para>
+
+<programlisting>Code block with no trailing blank lines.
+</programlisting>
+ <para>
+ Paragraph.
+ </para>
+ <anchor id="indented_code_blocks.code_blocks_separated_by_comment"/>
+ <bridgehead renderas="sect2">
+ <link linkend="indented_code_blocks.code_blocks_separated_by_comment">Code blocks
+ separated by comment</link>
+ </bridgehead>
+
+<programlisting>First code block.
+</programlisting>
+
+<programlisting>Second code block.
+[/ Comment in second code block]
+Still second code block.
+[/ Comment trailing second code block]
+</programlisting>
+</article>
Added: trunk/tools/quickbook/test/code-block.quickbook
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/code-block.quickbook 2010-08-15 12:46:18 EDT (Sun, 15 Aug 2010)
@@ -0,0 +1,29 @@
+[article Indented code blocks
+ [quickbook 1.5]
+ [source-mode teletype]
+]
+
+In a paragraph.
+ Still in a paragraph.
+
+ In a code block.
+
+Back in a paragraph.
+
+ Code block line 1.
+ Code block line 2.
+ Code block line 3.
+
+Paragraph.
+
+ Code block with no trailing blank lines.
+Paragraph.
+
+[heading Code blocks separated by comment]
+
+ First code block.
+[/ Comment]
+ Second code block.
+ [/ Comment in second code block]
+ Still second code block.
+ [/ Comment trailing second code block]
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