vdoc: hide README toc entry without readme (#8841)

pull/8859/head
Lukas Neubert 2021-02-20 15:03:10 +01:00 committed by GitHub
parent 329e3938d9
commit 901aa83e65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -515,6 +515,9 @@ fn write_toc(dn doc.DocNode, mut toc strings.Builder) {
}
}
if is_module_readme(dn) {
if dn.comments.len == 0 || (dn.comments.len > 0 && dn.comments[0].text.len == 0) {
return
}
toc.write('<li class="open"><a href="#readme_$toc_slug">README</a>')
} else if dn.name != 'Constants' {
toc.write('<li class="open"><a href="#$toc_slug">$dn.kind $dn.name</a>')