Do not include excluded headlines when calculating headline index

This commit is contained in:
Niklas Fasching 2024-08-20 15:22:59 +02:00
parent d4f684b248
commit 7bc6100fc7
3 changed files with 20 additions and 21 deletions

View file

@ -43,9 +43,6 @@ func lexHeadline(line string) (token, bool) {
func (d *Document) parseHeadline(i int, parentStop stopFn) (int, Node) {
t, headline := d.tokens[i], Headline{}
headline.Lvl = len(t.matches[1])
headline.Index = d.addHeadline(&headline)
text := t.content
todoKeywords := trimFastTags(
strings.FieldsFunc(d.Get("TODO"), func(r rune) bool { return unicode.IsSpace(r) || r == '|' }),
@ -67,7 +64,7 @@ func (d *Document) parseHeadline(i int, parentStop stopFn) (int, Node) {
text = m[1]
headline.Tags = strings.FieldsFunc(m[2], func(r rune) bool { return r == ':' })
}
headline.Index = d.addHeadline(&headline)
headline.Title = d.parseInline(text)
stop := func(d *Document, i int) bool {