1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vdoc: fix toc Constants link (#7810)

This commit is contained in:
Lukas Neubert 2021-01-02 19:18:17 +01:00 committed by GitHub
parent 9980de39c3
commit 38c764f0ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -462,7 +462,11 @@ fn (cfg DocConfig) readme_idx() int {
fn write_toc(dn doc.DocNode, nodes []doc.DocNode, mut toc strings.Builder) {
mut toc_slug := if dn.name.len == 0 || dn.content.len == 0 { '' } else { slug(dn.name) }
if toc_slug == '' && dn.children.len > 0 {
toc_slug = slug(dn.name + '.' + dn.children[0].name)
if dn.children[0].name == '' {
toc_slug = slug(dn.name)
} else {
toc_slug = slug(dn.name + '.' + dn.children[0].name)
}
}
if dn.name != 'Constants' {
toc.write('<li class="open"><a href="#$toc_slug">$dn.kind $dn.name</a>')