mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
tools: improve the output of ./v doc -m -f html vlib/
This commit is contained in:
parent
ca620f4965
commit
2a9d1b204b
3 changed files with 7 additions and 7 deletions
|
@ -79,8 +79,10 @@ fn (vd &VDoc) render_search_index(out Output) {
|
||||||
}
|
}
|
||||||
js_search_index.writeln('];\n')
|
js_search_index.writeln('];\n')
|
||||||
js_search_data.writeln('];\n')
|
js_search_data.writeln('];\n')
|
||||||
|
final := js_search_index.str() + js_search_data.str()
|
||||||
out_file_path := os.join_path(out.path, 'search_index.js')
|
out_file_path := os.join_path(out.path, 'search_index.js')
|
||||||
os.write_file(out_file_path, js_search_index.str() + js_search_data.str()) or { panic(err) }
|
println('Generating search_index.js of ${final.len:8} bytes in `${out_file_path} ...')
|
||||||
|
os.write_file(out_file_path, final) or { panic(err) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (mut vd VDoc) render_static_html(out Output) {
|
fn (mut vd VDoc) render_static_html(out Output) {
|
||||||
|
@ -115,7 +117,7 @@ fn (vd &VDoc) get_resource(name string, out Output) string {
|
||||||
} else {
|
} else {
|
||||||
output_path := os.join_path(out.path, name)
|
output_path := os.join_path(out.path, name)
|
||||||
if !os.exists(output_path) {
|
if !os.exists(output_path) {
|
||||||
println('Generating ${out.typ} in "${output_path}"')
|
println('Generating ${res.len:8} bytes of static resources in `${output_path}` ...')
|
||||||
os.write_file(output_path, res) or { panic(err) }
|
os.write_file(output_path, res) or { panic(err) }
|
||||||
}
|
}
|
||||||
return name
|
return name
|
||||||
|
|
|
@ -42,6 +42,7 @@ mut:
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
unbuffer_stdout() // avoid the need for flush_stdout() calls
|
||||||
if os.args.len < 2 || '-h' in os.args || '-help' in os.args || '--help' in os.args
|
if os.args.len < 2 || '-h' in os.args || '-help' in os.args || '--help' in os.args
|
||||||
|| os.args[1..] == ['doc', 'help'] {
|
|| os.args[1..] == ['doc', 'help'] {
|
||||||
os.system('${os.quoted_path(vexe)} help doc')
|
os.system('${os.quoted_path(vexe)} help doc')
|
||||||
|
|
|
@ -188,11 +188,9 @@ fn (mut vd VDoc) work_processor(mut work sync.Channel, mut wg sync.WaitGroup) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
vd.vprintln('> start processing ${pdoc.d.base_path} ...')
|
vd.vprintln('> start processing ${pdoc.d.base_path} ...')
|
||||||
flush_stdout()
|
|
||||||
file_name, content := vd.render_doc(pdoc.d, pdoc.out)
|
file_name, content := vd.render_doc(pdoc.d, pdoc.out)
|
||||||
output_path := os.join_path(pdoc.out.path, file_name)
|
output_path := os.join_path(pdoc.out.path, file_name)
|
||||||
println('Generating ${pdoc.out.typ} in "${output_path}"')
|
println('Generating ${content.len:8} bytes of ${pdoc.out.typ} in `${output_path}` ...')
|
||||||
flush_stdout()
|
|
||||||
os.write_file(output_path, content) or { panic(err) }
|
os.write_file(output_path, content) or { panic(err) }
|
||||||
}
|
}
|
||||||
wg.done()
|
wg.done()
|
||||||
|
@ -436,15 +434,14 @@ fn (mut vd VDoc) generate_docs_from_file() {
|
||||||
vd.render_search_index(out)
|
vd.render_search_index(out)
|
||||||
// move favicons to target directory
|
// move favicons to target directory
|
||||||
println('Copying favicons...')
|
println('Copying favicons...')
|
||||||
|
|
||||||
favicons_path := os.join_path(cfg.theme_dir, 'favicons')
|
favicons_path := os.join_path(cfg.theme_dir, 'favicons')
|
||||||
|
|
||||||
favicons := os.ls(favicons_path) or { panic(err) }
|
favicons := os.ls(favicons_path) or { panic(err) }
|
||||||
for favicon in favicons {
|
for favicon in favicons {
|
||||||
favicon_path := os.join_path(favicons_path, favicon)
|
favicon_path := os.join_path(favicons_path, favicon)
|
||||||
destination_path := os.join_path(out.path, favicon)
|
destination_path := os.join_path(out.path, favicon)
|
||||||
os.cp(favicon_path, destination_path) or { panic(err) }
|
os.cp(favicon_path, destination_path) or { panic(err) }
|
||||||
}
|
}
|
||||||
|
println('Copied ${favicons.len} icons to `${out.path}` .')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue