1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vdoc, v.doc: remove DocPos and use token.Position (#9429)

This commit is contained in:
Ned Palacios
2021-03-23 16:07:09 +08:00
committed by GitHub
parent e86c6e024c
commit 1d42b4cf66
5 changed files with 31 additions and 58 deletions

View File

@@ -222,13 +222,14 @@ fn (vd VDoc) write_content(cn &doc.DocNode, d &doc.Doc, mut hw strings.Builder)
} else {
os.file_name(cn.file_path)
}
src_link := get_src_link(vd.manifest.repo_url, file_path_name, cn.pos.line)
src_link := get_src_link(vd.manifest.repo_url, file_path_name, cn.pos.line_nr + 1)
if cn.content.len != 0 || (cn.name == 'Constants') {
hw.write_string(doc_node_html(cn, src_link, false, cfg.include_examples, d.table))
}
for child in cn.children {
child_file_path_name := child.file_path.replace('$base_dir/', '')
child_src_link := get_src_link(vd.manifest.repo_url, child_file_path_name, child.pos.line)
child_src_link := get_src_link(vd.manifest.repo_url, child_file_path_name,
child.pos.line_nr + 1)
hw.write_string(doc_node_html(child, child_src_link, false, cfg.include_examples,
d.table))
}

View File

@@ -124,7 +124,7 @@ fn (vd VDoc) write_plaintext_content(contents []doc.DocNode, mut pw strings.Buil
pw.writeln(comments.trim_space().split_into_lines().map(' ' + it).join('\n'))
}
if cfg.show_loc {
pw.writeln('Location: $cn.file_path:$cn.pos.line\n')
pw.writeln('Location: $cn.file_path:${cn.pos.line_nr + 1}\n')
}
}
vd.write_plaintext_content(cn.children, mut pw)