diff options
author | Helder Pereira <helfper@gmail.com> | 2020-09-09 22:41:53 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-09-10 21:53:13 +0200 |
commit | 6a848cbc3a2487c8b015e715c2de44aef6051080 (patch) | |
tree | 22a0c560ec21765be91a310c8008813348ae3160 /markup/tableofcontents | |
parent | 746ba803afee8f0f56ee0655cc55087f1822d39c (diff) |
markup/asciidocext: Fix AsciiDoc TOC with code
Fixes #7649
Diffstat (limited to 'markup/tableofcontents')
-rw-r--r-- | markup/tableofcontents/tableofcontents.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/markup/tableofcontents/tableofcontents.go b/markup/tableofcontents/tableofcontents.go index 780310083..9f1124233 100644 --- a/markup/tableofcontents/tableofcontents.go +++ b/markup/tableofcontents/tableofcontents.go @@ -40,19 +40,19 @@ type Root struct { } // AddAt adds the header into the given location. -func (toc *Root) AddAt(h Header, y, x int) { - for i := len(toc.Headers); i <= y; i++ { +func (toc *Root) AddAt(h Header, row, level int) { + for i := len(toc.Headers); i <= row; i++ { toc.Headers = append(toc.Headers, Header{}) } - if x == 0 { - toc.Headers[y] = h + if level == 0 { + toc.Headers[row] = h return } - header := &toc.Headers[y] + header := &toc.Headers[row] - for i := 1; i < x; i++ { + for i := 1; i < level; i++ { if len(header.Headers) == 0 { header.Headers = append(header.Headers, Header{}) } |