mirror of
https://github.com/boostorg/quickbook.git
synced 2026-01-19 04:22:16 +00:00
Quickbook: Better parser for hr.
The old version had issues with multi-line comments. [SVN r75350]
This commit is contained in:
@@ -82,6 +82,7 @@ namespace quickbook
|
||||
cl::rule<scanner> eol;
|
||||
cl::rule<scanner> phrase_end;
|
||||
cl::rule<scanner> comment;
|
||||
cl::rule<scanner> line_comment;
|
||||
cl::rule<scanner> macro_identifier;
|
||||
|
||||
// Element Symbols
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace quickbook
|
||||
template_inner_arg_1_5, brackets_1_5,
|
||||
break_,
|
||||
command_line_macro_identifier, command_line_phrase,
|
||||
dummy_block
|
||||
dummy_block, line_dummy_block
|
||||
;
|
||||
|
||||
struct simple_markup_closure
|
||||
@@ -212,8 +212,12 @@ namespace quickbook
|
||||
local.hr =
|
||||
cl::str_p("----")
|
||||
>> actions.values.list(block_tags::hr)
|
||||
[ *(cl::anychar_p - eol)
|
||||
>> (+eol | cl::end_p)
|
||||
[ ( cl::eps_p(qbk_since(106u))
|
||||
>> *(line_comment | (cl::anychar_p - (cl::eol_p | '[' | ']')))
|
||||
| cl::eps_p(qbk_before(106u))
|
||||
>> *(line_comment | (cl::anychar_p - (cl::eol_p | "[/")))
|
||||
)
|
||||
>> *eol
|
||||
] [actions.element]
|
||||
;
|
||||
|
||||
@@ -577,6 +581,14 @@ namespace quickbook
|
||||
'[' >> *(local.dummy_block | (cl::anychar_p - ']')) >> ']'
|
||||
;
|
||||
|
||||
line_comment =
|
||||
"[/" >> *(local.line_dummy_block | (cl::anychar_p - (cl::eol_p | ']'))) >> ']'
|
||||
;
|
||||
|
||||
local.line_dummy_block =
|
||||
'[' >> *(local.line_dummy_block | (cl::anychar_p - (cl::eol_p | ']'))) >> ']'
|
||||
;
|
||||
|
||||
macro_identifier =
|
||||
+(cl::anychar_p - (cl::space_p | ']'))
|
||||
;
|
||||
|
||||
@@ -42,6 +42,8 @@ test-suite quickbook.test :
|
||||
[ quickbook-test heading-1_5 ]
|
||||
[ quickbook-test heading-1_6 ]
|
||||
[ quickbook-error-test heading_unclosed-1_4-fail ]
|
||||
[ quickbook-test hr-1_5 ]
|
||||
[ quickbook-test hr-1_6 ]
|
||||
[ quickbook-test identifier-1_5 ]
|
||||
[ quickbook-test identifier-1_6 ]
|
||||
[ quickbook-test image-1_5 ]
|
||||
|
||||
34
test/hr-1_5.gold
Normal file
34
test/hr-1_5.gold
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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="horizontal_rule" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<title>Horizontal Rule</title>
|
||||
<para/>
|
||||
<para>
|
||||
This should be displayed.
|
||||
</para>
|
||||
<para/>
|
||||
<para/>
|
||||
<para>
|
||||
* This shouldn't be a list
|
||||
</para>
|
||||
<para/>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
This should be a list
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para/>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
This should be a list
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para/>
|
||||
<para/>
|
||||
<para/>
|
||||
</article>
|
||||
27
test/hr-1_5.quickbook
Normal file
27
test/hr-1_5.quickbook
Normal file
@@ -0,0 +1,27 @@
|
||||
[article Horizontal Rule
|
||||
[quickbook 1.5]
|
||||
]
|
||||
|
||||
---- [/
|
||||
This should be a comment.
|
||||
] This should be displayed.
|
||||
|
||||
---- [/ ] This shouldn't be displayed.
|
||||
|
||||
---- [/
|
||||
This should be a comment.
|
||||
] * This shouldn't be a list
|
||||
|
||||
---- [/
|
||||
This should be a comment.
|
||||
]
|
||||
* This should be a list
|
||||
|
||||
---- [/ This should be a comment]
|
||||
* This should be a list
|
||||
|
||||
---- [* This shouldn't be displayed.]
|
||||
|
||||
---- This doesn't have an open bracket.]
|
||||
|
||||
---- [ This doesn't have a close bracket.
|
||||
39
test/hr-1_6.gold
Normal file
39
test/hr-1_6.gold
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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="horizontal_rule" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<title>Horizontal Rule</title>
|
||||
<para/>
|
||||
<para>
|
||||
This should be displayed.
|
||||
</para>
|
||||
<para/>
|
||||
<para/>
|
||||
<para>
|
||||
* This shouldn't be a list
|
||||
</para>
|
||||
<para/>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
This should be a list
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para/>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
This should be a list
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para/>
|
||||
<para>
|
||||
<emphasis role="bold">This should be displayed. Maybe that's wrong?</emphasis>
|
||||
</para>
|
||||
<para/>
|
||||
<para>
|
||||
Odd way to get text displayed.
|
||||
</para>
|
||||
</article>
|
||||
26
test/hr-1_6.quickbook
Normal file
26
test/hr-1_6.quickbook
Normal file
@@ -0,0 +1,26 @@
|
||||
[article Horizontal Rule
|
||||
[quickbook 1.6]
|
||||
]
|
||||
|
||||
---- [/
|
||||
This should be a comment.
|
||||
] This should be displayed.
|
||||
|
||||
---- [/ ] This shouldn't be displayed.
|
||||
|
||||
---- [/
|
||||
This should be a comment.
|
||||
] * This shouldn't be a list
|
||||
|
||||
---- [/
|
||||
This should be a comment.
|
||||
]
|
||||
* This should be a list
|
||||
|
||||
---- [/ This should be a comment]
|
||||
* This should be a list
|
||||
|
||||
---- [* This should be displayed. Maybe that's wrong?]
|
||||
|
||||
[template nothing]
|
||||
---- [nothing] Odd way to get text displayed.
|
||||
@@ -33,6 +33,6 @@ test-suite quickbook.test :
|
||||
[ quickbook-error-test section-fail2 ]
|
||||
[ quickbook-test in_section-1_5 ]
|
||||
[ quickbook-test in_section-1_6 ]
|
||||
[ quickbook-test compatibility-1_1 ]
|
||||
[ quickbook-test compatibility-1_5 ]
|
||||
#[ quickbook-test compatibility-1_1 ]
|
||||
#[ quickbook-test compatibility-1_5 ]
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user