vdoc: fix compilation
parent
8c4429c875
commit
2cf8a53eac
|
@ -285,7 +285,7 @@ fn html_highlight(code string, tb &table.Table) string {
|
||||||
} else { tok.lit }
|
} else { tok.lit }
|
||||||
return if typ in [.unone, .name] { lit } else { '<span class="token $typ">$lit</span>' }
|
return if typ in [.unone, .name] { lit } else { '<span class="token $typ">$lit</span>' }
|
||||||
}
|
}
|
||||||
s := scanner.new_scanner(code, .parse_comments, &pref.Preferences{})
|
mut s := scanner.new_scanner(code, .parse_comments, &pref.Preferences{})
|
||||||
mut tok := s.scan()
|
mut tok := s.scan()
|
||||||
mut next_tok := s.scan()
|
mut next_tok := s.scan()
|
||||||
mut buf := strings.new_builder(200)
|
mut buf := strings.new_builder(200)
|
||||||
|
@ -388,7 +388,7 @@ fn (cfg DocConfig) readme_idx() int {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_toc(cn doc.DocNode, nodes []doc.DocNode, toc &strings.Builder) {
|
fn write_toc(cn doc.DocNode, nodes []doc.DocNode, mut toc strings.Builder) {
|
||||||
toc_slug := if cn.content.len == 0 { '' } else { slug(cn.name) }
|
toc_slug := if cn.content.len == 0 { '' } else { slug(cn.name) }
|
||||||
toc.write('<li class="open"><a href="#$toc_slug">${cn.name}</a>')
|
toc.write('<li class="open"><a href="#$toc_slug">${cn.name}</a>')
|
||||||
children := nodes.find_children_of(cn.name)
|
children := nodes.find_children_of(cn.name)
|
||||||
|
@ -403,7 +403,7 @@ fn write_toc(cn doc.DocNode, nodes []doc.DocNode, toc &strings.Builder) {
|
||||||
toc.writeln('</li>')
|
toc.writeln('</li>')
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (cfg DocConfig) write_content(cn &doc.DocNode, dcs &doc.Doc, hw &strings.Builder) {
|
fn (cfg DocConfig) write_content(cn &doc.DocNode, dcs &doc.Doc, mut hw strings.Builder) {
|
||||||
base_dir := os.base_dir(os.real_path(cfg.input_path))
|
base_dir := os.base_dir(os.real_path(cfg.input_path))
|
||||||
file_path_name := if cfg.is_multi { cn.file_path.replace('$base_dir/', '') } else { os.file_name(cn.file_path) }
|
file_path_name := if cfg.is_multi { cn.file_path.replace('$base_dir/', '') } else { os.file_name(cn.file_path) }
|
||||||
src_link := get_src_link(cfg.manifest.repo_url, file_path_name, cn.pos.line)
|
src_link := get_src_link(cfg.manifest.repo_url, file_path_name, cn.pos.line)
|
||||||
|
@ -429,7 +429,7 @@ fn (cfg DocConfig) gen_html(idx int) string {
|
||||||
for cn in dcs.contents {
|
for cn in dcs.contents {
|
||||||
cfg.write_content(&cn, &dcs, &contents)
|
cfg.write_content(&cn, &dcs, &contents)
|
||||||
if cn.attrs['parent'] == 'Constants' || cn.attrs['category'] == 'Methods' { continue }
|
if cn.attrs['parent'] == 'Constants' || cn.attrs['category'] == 'Methods' { continue }
|
||||||
write_toc(cn, dcs.contents, &toc)
|
write_toc(cn, dcs.contents, mut toc)
|
||||||
} // write head
|
} // write head
|
||||||
// get resources
|
// get resources
|
||||||
doc_css := cfg.get_resource(css_js_assets[0], true)
|
doc_css := cfg.get_resource(css_js_assets[0], true)
|
||||||
|
|
Loading…
Reference in New Issue