mirror of
https://github.com/boostorg/quickbook.git
synced 2026-01-26 06:42:27 +00:00
Quickbook: Fix ending a 1.6 list item by a paragraph.
[SVN r75838]
This commit is contained in:
@@ -34,10 +34,18 @@ namespace quickbook
|
||||
namespace cl = boost::spirit::classic;
|
||||
|
||||
struct list_stack_item {
|
||||
bool root;
|
||||
unsigned int indent;
|
||||
unsigned int indent2;
|
||||
char mark;
|
||||
bool root; // Is this the root of the context
|
||||
// (e.g. top, template, table cell etc.)
|
||||
unsigned int indent; // Indent of list marker
|
||||
// (or paragraph if not in a list)
|
||||
unsigned int indent2; // Indent of paragraph
|
||||
char mark; // List mark, '\0' if not in a list.
|
||||
|
||||
// Example of inside a list:
|
||||
//
|
||||
// |indent
|
||||
// * List item
|
||||
// |indent2
|
||||
|
||||
list_stack_item() :
|
||||
root(true), indent(0), indent2(0), mark('\0') {}
|
||||
@@ -809,9 +817,32 @@ namespace quickbook
|
||||
|
||||
if (!list_stack.top().root && new_indent == list_stack.top().indent)
|
||||
{
|
||||
// If the paragraph is aligned with the list item's marker,
|
||||
// then end the current list item if that's aligned (or to
|
||||
// the left of) the parent's paragraph.
|
||||
//
|
||||
// i.e.
|
||||
//
|
||||
// * Level 1
|
||||
// * Level 2
|
||||
//
|
||||
// Still Level 2
|
||||
//
|
||||
// vs.
|
||||
//
|
||||
// * Level 1
|
||||
// * Level 2
|
||||
//
|
||||
// Back to Level 1
|
||||
|
||||
list_stack_item save = list_stack.top();
|
||||
list_stack.pop();
|
||||
if (new_indent == list_stack.top().indent) {
|
||||
|
||||
assert(list_stack.top().root ?
|
||||
new_indent >= list_stack.top().indent :
|
||||
new_indent > list_stack.top().indent);
|
||||
|
||||
if (new_indent <= list_stack.top().indent2) {
|
||||
actions_.end_list_item();
|
||||
actions_.end_list(save.mark);
|
||||
list_indent = list_stack.top().indent;
|
||||
|
||||
@@ -426,30 +426,49 @@
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
One
|
||||
A1
|
||||
<para>
|
||||
Two
|
||||
A2
|
||||
</para>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Three
|
||||
B1
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Four
|
||||
C1
|
||||
<para>
|
||||
Five
|
||||
C2
|
||||
</para>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>
|
||||
B2
|
||||
</para>
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Six
|
||||
D1
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
E1
|
||||
<para>
|
||||
E2
|
||||
</para>
|
||||
<para>
|
||||
E3
|
||||
</para>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>
|
||||
D2
|
||||
</para>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
@@ -105,14 +105,24 @@ Don't end list with comment 2:
|
||||
|
||||
[section Paragraphs in list items]
|
||||
|
||||
* One
|
||||
* A1
|
||||
|
||||
Two
|
||||
A2
|
||||
|
||||
* Three
|
||||
* Four
|
||||
* B1
|
||||
* C1
|
||||
|
||||
Five
|
||||
* Six
|
||||
C2
|
||||
|
||||
B2
|
||||
|
||||
* D1
|
||||
* E1
|
||||
|
||||
E2
|
||||
|
||||
E3
|
||||
|
||||
D2
|
||||
|
||||
[endsect]
|
||||
Reference in New Issue
Block a user