Fix index out of range in headline priority parsing
fuzzed - counting is hard...
This commit is contained in:
parent
20970ec872
commit
f69b043136
4 changed files with 28 additions and 3 deletions
|
@ -56,7 +56,7 @@ func (d *Document) parseHeadline(i int, parentStop stopFn) (int, Node) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(text) >= 3 && text[0:2] == "[#" && strings.Contains("ABC", text[2:3]) && text[3] == ']' {
|
if len(text) >= 4 && text[0:2] == "[#" && strings.Contains("ABC", text[2:3]) && text[3] == ']' {
|
||||||
headline.Priority = text[2:3]
|
headline.Priority = text[2:3]
|
||||||
text = strings.TrimSpace(text[4:])
|
text = strings.TrimSpace(text[4:])
|
||||||
}
|
}
|
||||||
|
|
23
org/testdata/misc.html
vendored
23
org/testdata/misc.html
vendored
|
@ -60,7 +60,17 @@
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#headline-27">Footnotes</a>
|
<li><a href="#headline-27">misc fuzz / regression / edge case</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#headline-28">index out of range in headline priority parsing</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#headline-29">[#B</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><a href="#headline-30">Footnotes</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -480,7 +490,16 @@ When inserting an image link like <img src="/home/amos/Pictures/Screenshots/img-
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h1 id="headline-27">
|
<h2 id="headline-27">
|
||||||
|
misc fuzz / regression / edge case
|
||||||
|
</h2>
|
||||||
|
<h3 id="headline-28">
|
||||||
|
index out of range in headline priority parsing
|
||||||
|
</h3>
|
||||||
|
<h4 id="headline-29">
|
||||||
|
[#B
|
||||||
|
</h4>
|
||||||
|
<h1 id="headline-30">
|
||||||
Footnotes
|
Footnotes
|
||||||
</h1>
|
</h1>
|
||||||
<div class="footnotes">
|
<div class="footnotes">
|
||||||
|
|
3
org/testdata/misc.org
vendored
3
org/testdata/misc.org
vendored
|
@ -133,6 +133,9 @@ When inserting an image link like [[/home/amos/Pictures/Screenshots/img-2017-09-
|
||||||
(shrink-window (- (window-height) 12))
|
(shrink-window (- (window-height) 12))
|
||||||
(ansi-term))
|
(ansi-term))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
** misc fuzz / regression / edge case
|
||||||
|
*** index out of range in headline priority parsing
|
||||||
|
**** [#B
|
||||||
* Footnotes
|
* Footnotes
|
||||||
|
|
||||||
[fn:1] a footnote /with/ *markup*
|
[fn:1] a footnote /with/ *markup*
|
||||||
|
|
3
org/testdata/misc.pretty_org
vendored
3
org/testdata/misc.pretty_org
vendored
|
@ -133,6 +133,9 @@ When inserting an image link like [[/home/amos/Pictures/Screenshots/img-2017-09-
|
||||||
(shrink-window (- (window-height) 12))
|
(shrink-window (- (window-height) 12))
|
||||||
(ansi-term))
|
(ansi-term))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
** misc fuzz / regression / edge case
|
||||||
|
*** index out of range in headline priority parsing
|
||||||
|
**** [#B
|
||||||
* Footnotes
|
* Footnotes
|
||||||
|
|
||||||
[fn:1] a footnote /with/ *markup*
|
[fn:1] a footnote /with/ *markup*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue