mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vfmt: shorten main.const_name to just const_name
This commit is contained in:
@@ -131,10 +131,10 @@ fn (vd VDoc) render_search_index(out Output) {
|
||||
|
||||
fn (mut vd VDoc) render_static_html(out Output) {
|
||||
vd.assets = {
|
||||
'doc_css': vd.get_resource(main.css_js_assets[0], out)
|
||||
'normalize_css': vd.get_resource(main.css_js_assets[1], out)
|
||||
'doc_js': vd.get_resource(main.css_js_assets[2], out)
|
||||
'dark_mode_js': vd.get_resource(main.css_js_assets[3], out)
|
||||
'doc_css': vd.get_resource(css_js_assets[0], out)
|
||||
'normalize_css': vd.get_resource(css_js_assets[1], out)
|
||||
'doc_js': vd.get_resource(css_js_assets[2], out)
|
||||
'dark_mode_js': vd.get_resource(css_js_assets[3], out)
|
||||
'light_icon': vd.get_resource('light.svg', out)
|
||||
'dark_icon': vd.get_resource('dark.svg', out)
|
||||
'menu_icon': vd.get_resource('menu.svg', out)
|
||||
@@ -144,7 +144,7 @@ fn (mut vd VDoc) render_static_html(out Output) {
|
||||
|
||||
fn (vd VDoc) get_resource(name string, out Output) string {
|
||||
cfg := vd.cfg
|
||||
path := os.join_path(main.res_path, name)
|
||||
path := os.join_path(res_path, name)
|
||||
mut res := os.read_file(path) or { panic('vdoc: could not read $path') }
|
||||
/*
|
||||
if minify {
|
||||
@@ -294,7 +294,7 @@ fn (vd VDoc) gen_html(d doc.Doc) string {
|
||||
symbols_toc_str := symbols_toc.str()
|
||||
modules_toc.free()
|
||||
symbols_toc.free()
|
||||
return main.html_content.replace('{{ title }}', d.head.name).replace('{{ head_name }}',
|
||||
return html_content.replace('{{ title }}', d.head.name).replace('{{ head_name }}',
|
||||
header_name).replace('{{ version }}', version).replace('{{ light_icon }}', vd.assets['light_icon']).replace('{{ dark_icon }}',
|
||||
vd.assets['dark_icon']).replace('{{ menu_icon }}', vd.assets['menu_icon']).replace('{{ head_assets }}',
|
||||
if cfg.inline_assets {
|
||||
@@ -452,7 +452,7 @@ fn doc_node_html(dn doc.DocNode, link string, head bool, include_examples bool,
|
||||
dnw.write('${tabs[2]}<div class="title"><$head_tag>$dn.kind $sym_name$hash_link</$head_tag>')
|
||||
}
|
||||
if link.len != 0 {
|
||||
dnw.write('<a class="link" rel="noreferrer" target="_blank" href="$link">$main.link_svg</a>')
|
||||
dnw.write('<a class="link" rel="noreferrer" target="_blank" href="$link">$link_svg</a>')
|
||||
}
|
||||
dnw.write('</div>')
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ fn (mut vd VDoc) generate_docs_from_file() {
|
||||
exit(1)
|
||||
}
|
||||
dir_path := if cfg.is_vlib {
|
||||
main.vroot
|
||||
vroot
|
||||
} else if os.is_dir(cfg.input_path) {
|
||||
cfg.input_path
|
||||
} else {
|
||||
@@ -404,8 +404,8 @@ fn parse_arguments(args []string) Config {
|
||||
}
|
||||
'-f' {
|
||||
format := cmdline.option(current_args, '-f', '')
|
||||
if format !in main.allowed_formats {
|
||||
allowed_str := main.allowed_formats.join(', ')
|
||||
if format !in allowed_formats {
|
||||
allowed_str := allowed_formats.join(', ')
|
||||
eprintln('vdoc: "$format" is not a valid format. Only $allowed_str are allowed.')
|
||||
exit(1)
|
||||
}
|
||||
@@ -472,7 +472,7 @@ fn parse_arguments(args []string) Config {
|
||||
if cfg.input_path.trim_right('/') == 'vlib' {
|
||||
cfg.is_vlib = true
|
||||
cfg.is_multi = true
|
||||
cfg.input_path = os.join_path(main.vroot, 'vlib')
|
||||
cfg.input_path = os.join_path(vroot, 'vlib')
|
||||
} else if !is_path {
|
||||
// TODO vd.vprintln('Input "$cfg.input_path" is not a valid path. Looking for modules named "$cfg.input_path"...')
|
||||
mod_path := doc.lookup_module(cfg.input_path) or {
|
||||
@@ -486,7 +486,7 @@ fn parse_arguments(args []string) Config {
|
||||
|
||||
fn main() {
|
||||
if os.args.len < 2 || '-h' in os.args || '--help' in os.args || os.args[1..] == ['doc', 'help'] {
|
||||
os.system('$main.vexe help doc')
|
||||
os.system('$vexe help doc')
|
||||
exit(0)
|
||||
}
|
||||
args := os.args[2..].clone()
|
||||
|
||||
Reference in New Issue
Block a user