mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vfmt: change all '$expr' to '${expr}' (#16428)
This commit is contained in:
@@ -82,9 +82,9 @@ fn (vd VDoc) gen_json(d doc.Doc) string {
|
||||
} else {
|
||||
d.head.merge_comments_without_examples()
|
||||
}
|
||||
jw.write_string('{"module_name":"$d.head.name","description":"${escape(comments)}","contents":')
|
||||
jw.write_string('{"module_name":"${d.head.name}","description":"${escape(comments)}","contents":')
|
||||
jw.write_string(json.encode(d.contents.keys().map(d.contents[it])))
|
||||
jw.write_string(',"generator":"vdoc","time_generated":"$d.time_generated.str()"}')
|
||||
jw.write_string(',"generator":"vdoc","time_generated":"${d.time_generated.str()}"}')
|
||||
return jw.str()
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ fn (vd VDoc) gen_plaintext(d doc.Doc) string {
|
||||
content_arr := d.head.content.split(' ')
|
||||
pw.writeln('${term.bright_blue(content_arr[0])} ${term.green(content_arr[1])}\n')
|
||||
} else {
|
||||
pw.writeln('$d.head.content\n')
|
||||
pw.writeln('${d.head.content}\n')
|
||||
}
|
||||
if cfg.include_comments {
|
||||
comments := if cfg.include_examples {
|
||||
@@ -145,7 +145,7 @@ fn (vd VDoc) write_plaintext_content(contents []doc.DocNode, mut pw strings.Buil
|
||||
}
|
||||
}
|
||||
if cfg.show_loc {
|
||||
pw.writeln('Location: $cn.file_path:${cn.pos.line_nr + 1}\n')
|
||||
pw.writeln('Location: ${cn.file_path}:${cn.pos.line_nr + 1}\n')
|
||||
}
|
||||
}
|
||||
vd.write_plaintext_content(cn.children, mut pw)
|
||||
@@ -193,7 +193,7 @@ fn (vd VDoc) work_processor(mut work sync.Channel, mut wg sync.WaitGroup) {
|
||||
}
|
||||
file_name, content := vd.render_doc(pdoc.d, pdoc.out)
|
||||
output_path := os.join_path(pdoc.out.path, file_name)
|
||||
println('Generating $pdoc.out.typ in "$output_path"')
|
||||
println('Generating ${pdoc.out.typ} in "${output_path}"')
|
||||
os.write_file(output_path, content) or { panic(err) }
|
||||
}
|
||||
wg.done()
|
||||
@@ -237,7 +237,7 @@ fn (vd VDoc) get_readme(path string) string {
|
||||
return ''
|
||||
}
|
||||
readme_path := os.join_path(path, '${fname}.md')
|
||||
vd.vprintln('Reading README file from $readme_path')
|
||||
vd.vprintln('Reading README file from ${readme_path}')
|
||||
readme_contents := os.read_file(readme_path) or { '' }
|
||||
return readme_contents
|
||||
}
|
||||
@@ -287,7 +287,7 @@ fn (mut vd VDoc) generate_docs_from_file() {
|
||||
}
|
||||
manifest_path := os.join_path(dir_path, 'v.mod')
|
||||
if os.exists(manifest_path) {
|
||||
vd.vprintln('Reading v.mod info from $manifest_path')
|
||||
vd.vprintln('Reading v.mod info from ${manifest_path}')
|
||||
if manifest := vmod.from_file(manifest_path) {
|
||||
vd.manifest = manifest
|
||||
}
|
||||
@@ -313,7 +313,7 @@ fn (mut vd VDoc) generate_docs_from_file() {
|
||||
cfg.input_path,
|
||||
] }
|
||||
for dirpath in dirs {
|
||||
vd.vprintln('Generating $out.typ docs for "$dirpath"')
|
||||
vd.vprintln('Generating ${out.typ} docs for "${dirpath}"')
|
||||
mut dcs := doc.generate(dirpath, cfg.pub_only, true, cfg.platform, cfg.symbol_name) or {
|
||||
vd.emit_generate_err(err)
|
||||
exit(1)
|
||||
@@ -410,7 +410,7 @@ fn (mut vd VDoc) generate_docs_from_file() {
|
||||
|
||||
fn (vd VDoc) vprintln(str string) {
|
||||
if vd.cfg.is_verbose {
|
||||
println('vdoc: $str')
|
||||
println('vdoc: ${str}')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ fn parse_arguments(args []string) Config {
|
||||
format := cmdline.option(current_args, '-f', '')
|
||||
if format !in allowed_formats {
|
||||
allowed_str := allowed_formats.join(', ')
|
||||
eprintln('vdoc: "$format" is not a valid format. Only $allowed_str are allowed.')
|
||||
eprintln('vdoc: "${format}" is not a valid format. Only ${allowed_str} are allowed.')
|
||||
exit(1)
|
||||
}
|
||||
cfg.output_type = set_output_type_from_str(format)
|
||||
@@ -517,7 +517,7 @@ fn parse_arguments(args []string) Config {
|
||||
} 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 {
|
||||
eprintln('vdoc: $err')
|
||||
eprintln('vdoc: ${err}')
|
||||
exit(1)
|
||||
}
|
||||
cfg.input_path = mod_path
|
||||
@@ -544,6 +544,6 @@ fn main() {
|
||||
repo_url: ''
|
||||
}
|
||||
}
|
||||
vd.vprintln('Setting output type to "$cfg.output_type"')
|
||||
vd.vprintln('Setting output type to "${cfg.output_type}"')
|
||||
vd.generate_docs_from_file()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user