vdoc: fix toc Constants link (#7810)
parent
9980de39c3
commit
38c764f0ce
|
@ -462,8 +462,12 @@ fn (cfg DocConfig) readme_idx() int {
|
||||||
fn write_toc(dn doc.DocNode, nodes []doc.DocNode, mut toc strings.Builder) {
|
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) }
|
mut toc_slug := if dn.name.len == 0 || dn.content.len == 0 { '' } else { slug(dn.name) }
|
||||||
if toc_slug == '' && dn.children.len > 0 {
|
if toc_slug == '' && dn.children.len > 0 {
|
||||||
|
if dn.children[0].name == '' {
|
||||||
|
toc_slug = slug(dn.name)
|
||||||
|
} else {
|
||||||
toc_slug = slug(dn.name + '.' + dn.children[0].name)
|
toc_slug = slug(dn.name + '.' + dn.children[0].name)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if dn.name != 'Constants' {
|
if dn.name != 'Constants' {
|
||||||
toc.write('<li class="open"><a href="#$toc_slug">$dn.kind $dn.name</a>')
|
toc.write('<li class="open"><a href="#$toc_slug">$dn.kind $dn.name</a>')
|
||||||
toc.writeln(' <ul>')
|
toc.writeln(' <ul>')
|
||||||
|
|
Loading…
Reference in New Issue