From c8caf71282ef157fca839c1a59c413ba3bd71d70 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sat, 2 Jan 2021 05:11:34 -0400 Subject: [PATCH] vdoc: fix the indentation of the generated html file (#7802) --- cmd/tools/vdoc/vdoc.v | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/cmd/tools/vdoc/vdoc.v b/cmd/tools/vdoc/vdoc.v index 5fccfeb2e4..65754c9e12 100644 --- a/cmd/tools/vdoc/vdoc.v +++ b/cmd/tools/vdoc/vdoc.v @@ -41,9 +41,8 @@ const ( favicons_path = os.join_path(res_path, 'favicons') vexe = pref.vexe_path() vroot = os.dir(vexe) - html_content = ' - - + html_content = ' + @@ -85,7 +84,7 @@ const (
- {{ contents }} +{{ contents }} @@ -97,8 +96,8 @@ const ( {{ footer_assets }} - - ' +' + tabs = ['\t\t', '\t\t\t\t\t\t', '\t\t\t\t\t\t\t'] ) enum OutputType { @@ -406,12 +405,12 @@ fn doc_node_html(dd doc.DocNode, link string, head bool, tb &table.Table) string sym_name := get_sym_name(dd) node_id := get_node_id(dd) hash_link := if !head { ' #' } else { '' } - dnw.writeln('
') + dnw.writeln('${tabs[1]}s
') if dd.name.len > 0 { if dd.kind == .const_group { - dnw.write('
<$head_tag>$sym_name$hash_link') + dnw.write('${tabs[2]}
<$head_tag>$sym_name$hash_link') } else { - dnw.write('
<$head_tag>$dd.kind $sym_name$hash_link') + dnw.write('${tabs[2]}
<$head_tag>$dd.kind $sym_name$hash_link') } if link.len != 0 { dnw.write('$link_svg') @@ -421,7 +420,10 @@ fn doc_node_html(dd doc.DocNode, link string, head bool, tb &table.Table) string if !head && dd.content.len > 0 { dnw.writeln('
$hlighted_code
') } - dnw.writeln('$md_content\n
') + for line_content in md_content.split('\n') { + dnw.write('\n${tabs[2]}$line_content') + } + dnw.writeln('\n${tabs[1]}
') dnw_str := dnw.str() defer { dnw.free() @@ -559,12 +561,11 @@ fn (cfg DocConfig) gen_html(idx int) string { header_name).replace('{{ version }}', version).replace('{{ light_icon }}', cfg.assets['light_icon']).replace('{{ dark_icon }}', cfg.assets['dark_icon']).replace('{{ menu_icon }}', cfg.assets['menu_icon']).replace('{{ head_assets }}', if cfg.inline_assets { - '\n \n \n ' + '\n${tabs[0]}\n${tabs[0]}\n${tabs[0]}' } else { - '\n \n \n\n ' + '\n${tabs[0]}\n${tabs[0]}\n${tabs[0]}' }).replace('{{ toc_links }}', if cfg.is_multi || cfg.docs.len > 1 { modules_toc_str } else {