Fix list item parsing and headline token lvls

As headlines are always lvl (indent) 0 I thought it would be clever to abuse
the lvl field to store the headline lvl. Well, here we are - it wasn't clever.

List items only end when their parent ends or they run into something that's
not indented enough - everything else becomes part of the list item. Abusing
the token.lvl field (indent) for the headline lvl means headlines look indented
to the list item parsing logic - i.e. they become part of the list item if the
headline has a high enough lvl. That should never happen - so let's get rid of
the hack and (re-)calculate the headline lvl when we need it.
This commit is contained in:
Niklas Fasching 2020-07-22 13:49:58 +02:00
parent add727c011
commit 64b2b22270
4 changed files with 44 additions and 6 deletions

View file

@ -72,9 +72,15 @@
</li>
<li><a href="#headline-30">index out of range in explicit line break parsing</a>
</li>
<li><a href="#headline-31">list items don&#39;t end on child headline</a>
<ul>
<li><a href="#headline-32">followed by a child headline</a>
</li>
</ul>
</li>
<li><a href="#headline-31">Footnotes</a>
</ul>
</li>
<li><a href="#headline-33">Footnotes</a>
</li>
</ul>
</nav>
@ -550,10 +556,34 @@ index out of range in explicit line break parsing
<p>0\\ </p>
</div>
</div>
<div id="outline-container-headline-31" class="outline-4">
<h4 id="headline-31">
list items don&#39;t end on child headline
</h4>
<div id="outline-text-headline-31" class="outline-text-4">
<ul>
<li>
<p>a list item</p>
</li>
</ul>
<div id="outline-container-headline-32" class="outline-5">
<h5 id="headline-32">
followed by a child headline
</h5>
<div id="outline-text-headline-32" class="outline-text-5">
<ul>
<li>
<p>followed by another list item</p>
</li>
</ul>
</div>
</div>
<div id="outline-container-headline-31" class="outline-2">
<h2 id="headline-31">
</div>
</div>
</div>
</div>
<div id="outline-container-headline-33" class="outline-2">
<h2 id="headline-33">
Footnotes
</h2>
</div>

View file

@ -140,6 +140,10 @@ When inserting an image link like [[/home/amos/Pictures/Screenshots/img-2017-09-
*** index out of range in explicit line break parsing
0\\
*** list items don't end on child headline
- a list item
**** followed by a child headline
- followed by another list item
* Footnotes
[fn:1] a footnote /with/ *markup*

View file

@ -140,6 +140,10 @@ When inserting an image link like [[/home/amos/Pictures/Screenshots/img-2017-09-
*** index out of range in explicit line break parsing
0\\
*** list items don't end on child headline
- a list item
**** followed by a child headline
- followed by another list item
* Footnotes
[fn:1] a footnote /with/ *markup*