|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r85128 - in trunk/tools/quickbook: src test
From: dnljms_at_[hidden]
Date: 2013-07-23 04:22:49
Author: danieljames
Date: 2013-07-23 04:22:49 EDT (Tue, 23 Jul 2013)
New Revision: 85128
URL: http://svn.boost.org/trac/boost/changeset/85128
Log:
Disallow paragraph/list markup in phrase templates.
Can still use block tags.
Added:
trunk/tools/quickbook/test/templates-1_7-fail1.quickbook (contents, props changed)
Text files modified:
trunk/tools/quickbook/src/main_grammar.cpp | 21 +++++++++------------
trunk/tools/quickbook/test/Jamfile.v2 | 1 +
trunk/tools/quickbook/test/templates-1_7-fail1.quickbook | 12 ++++++++++++
trunk/tools/quickbook/test/templates-1_7.gold | 10 +++-------
trunk/tools/quickbook/test/templates-1_7.quickbook | 2 +-
5 files changed, 26 insertions(+), 20 deletions(-)
Modified: trunk/tools/quickbook/src/main_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/main_grammar.cpp Tue Jul 23 04:22:26 2013 (r85127)
+++ trunk/tools/quickbook/src/main_grammar.cpp 2013-07-23 04:22:49 EDT (Tue, 23 Jul 2013) (r85128)
@@ -101,7 +101,7 @@
// Local members
cl::rule<scanner>
- phrase_into_blocks, top_level, indent_check,
+ template_phrase, top_level, indent_check,
paragraph_separator, inside_paragraph,
code, code_line, blank_line, hr,
inline_code, skip_inline_code,
@@ -383,7 +383,7 @@
inline_phrase =
state.values.save()
[ qbk_ver(107u)
- >> local.phrase_into_blocks
+ >> local.template_phrase
| qbk_ver(0, 107u)
>> scoped_context(element_info::in_phrase)
[*local.common]
@@ -407,18 +407,15 @@
]
;
- // Phrase content, that might turn out to be block content.
- local.phrase_into_blocks =
+ // Phrase templates can contain block tags, but can't contain
+ // syntatic blocks.
+ local.template_phrase =
scoped_context(element_info::in_top_level)
- [ scoped_still_in_block(true)
- [ *( cl::eps_p(ph::var(local.still_in_block))
- >> local.syntactic_block_item(element_info::is_block)
- )
- >> !cl::eps_p(!ph::var(local.still_in_block))
- [paragraph_action]
- ]
+ [ *( (local.paragraph_separator >> space >> cl::anychar_p)
+ [error("Paragraph in phrase template.")]
+ | local.common
+ )
]
- >> block_start
;
// Top level blocks
Modified: trunk/tools/quickbook/test/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/test/Jamfile.v2 Tue Jul 23 04:22:26 2013 (r85127)
+++ trunk/tools/quickbook/test/Jamfile.v2 2013-07-23 04:22:49 EDT (Tue, 23 Jul 2013) (r85128)
@@ -109,6 +109,7 @@
[ quickbook-test templates-1_5 ]
[ quickbook-test templates-1_6 ]
[ quickbook-test templates-1_7 ]
+ [ quickbook-error-test templates-1_7-fail1 ]
[ quickbook-test unicode_escape-1_5 ]
[ quickbook-test unmatched_element-1_5 ]
[ quickbook-test unmatched_element-1_6 ]
Added: trunk/tools/quickbook/test/templates-1_7-fail1.quickbook
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/tools/quickbook/test/templates-1_7-fail1.quickbook 2013-07-23 04:22:49 EDT (Tue, 23 Jul 2013) (r85128)
@@ -0,0 +1,12 @@
+[article Template 1.7 fail
+[quickbook 1.7]
+]
+
+[/ This should fail because it's a phrase template containing a paragraph
+ separator. ]
+
+[template fail[] Phrase content.
+
+Paragraph content.]
+
+[fail]
Modified: trunk/tools/quickbook/test/templates-1_7.gold
==============================================================================
--- trunk/tools/quickbook/test/templates-1_7.gold Tue Jul 23 04:22:26 2013 (r85127)
+++ trunk/tools/quickbook/test/templates-1_7.gold 2013-07-23 04:22:49 EDT (Tue, 23 Jul 2013) (r85128)
@@ -285,12 +285,8 @@
</tbody>
</tgroup>
</informaltable>
- <itemizedlist>
- <listitem>
- <simpara>
- A list
- </simpara>
- </listitem>
- </itemizedlist>
+ <para>
+ * Not a list
+ </para>
</section>
</article>
Modified: trunk/tools/quickbook/test/templates-1_7.quickbook
==============================================================================
--- trunk/tools/quickbook/test/templates-1_7.quickbook Tue Jul 23 04:22:26 2013 (r85127)
+++ trunk/tools/quickbook/test/templates-1_7.quickbook 2013-07-23 04:22:49 EDT (Tue, 23 Jul 2013) (r85128)
@@ -286,7 +286,7 @@
[template phrase_block4[] Text4 before [table] Text4 afterwards]
[template phrase_block5[] [table] * Not a list]
[template phrase_block6[] [table]
-* A list]
+* Not a list]
[phrase_block1][phrase_block2][phrase_block3][phrase_block4]
[phrase_block5][phrase_block6]
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