@@ -10,6 +10,7 @@ import v.ast
10
10
import v.token
11
11
import v.doc
12
12
import v.pref
13
+ import v.util { tabs }
13
14
14
15
const (
15
16
css_js_assets = ['doc.css' , 'normalize.css' , 'doc.js' , 'dark-mode.js' ]
@@ -249,27 +250,27 @@ fn (vd VDoc) gen_html(d doc.Doc) string {
249
250
version).replace ('{{ light_icon }}' , vd.assets['light_icon' ]).replace ('{{ dark_icon }}' ,
250
251
vd.assets['dark_icon' ]).replace ('{{ menu_icon }}' , vd.assets['menu_icon' ]).replace ('{{ head_assets }}' ,
251
252
if cfg.inline_assets {
252
- '\n ${tabs[0]} <style>' + vd.assets['doc_css' ] + ' </style>\n ${tabs[0]} <style>' +
253
- vd.assets['normalize_css' ] + ' </style>\n ${tabs[0]} <script>' +
254
- vd.assets['dark_mode_js' ] + ' </script>'
253
+ '<style>${ vd.assets['doc_css']} </style>
254
+ ${tabs(2)} <style> ${ vd.assets['normalize_css']} </style>
255
+ ${tabs(2)} <script> ${ vd.assets['dark_mode_js']} </script>'
255
256
} else {
256
- '\n ${tabs[0]} <link rel="stylesheet" href="' + vd.assets['doc_css' ] +
257
- '" /> \n ${tabs[0] } <link rel="stylesheet" href="' + vd.assets['normalize_css' ] +
258
- '" /> \n ${tabs[0] } <script src="' + vd.assets['dark_mode_js' ] + ' "></script>'
257
+ '<link rel="stylesheet" href="${ vd.assets['doc_css']} " />
258
+ ${tabs(2) } <link rel="stylesheet" href="${ vd.assets['normalize_css']} " />
259
+ ${tabs(2) } <script src="${ vd.assets['dark_mode_js']} "></script>'
259
260
}).replace ('{{ toc_links }}' , if cfg.is_multi || vd.docs.len > 1 {
260
261
modules_toc_str
261
262
} else {
262
263
symbols_toc_str
263
264
}).replace ('{{ contents }}' , contents.str ()).replace ('{{ right_content }}' , if cfg.is_multi
264
265
&& d.head.name != 'README' {
265
- '<div class="doc-toc"><ul>' + symbols_toc_str + ' </ul></div>'
266
+ '<div class="doc-toc"><ul>${ symbols_toc_str} </ul></div>'
266
267
} else {
267
268
''
268
269
}).replace ('{{ footer_content }}' , gen_footer_text (d, ! cfg.no_timestamp)).replace ('{{ footer_assets }}' ,
269
270
if cfg.inline_assets {
270
- '<script>' + vd.assets['doc_js' ] + ' </script>'
271
+ '<script>${ vd.assets['doc_js']} </script>'
271
272
} else {
272
- '<script src="' + vd.assets['doc_js' ] + ' "></script>'
273
+ '<script src="${ vd.assets['doc_js']} "></script>'
273
274
})
274
275
return result
275
276
}
@@ -407,12 +408,12 @@ fn doc_node_html(dn doc.DocNode, link string, head bool, include_examples bool,
407
408
node_id = 'readme_${node_id} '
408
409
hash_link = ' <a href="#${node_id} ">#</a>'
409
410
}
410
- dnw.writeln ('${tabs[1] } <section id="${node_id} " class="doc-node${node_class} ">' )
411
+ dnw.writeln ('${tabs(2) } <section id="${node_id} " class="doc-node${node_class} ">' )
411
412
if dn.name.len > 0 {
412
413
if dn.kind == .const_group {
413
- dnw.write_string ('${tabs[2] } <div class="title"><${head_tag} >${sym_name}${hash_link} </${head_tag} >' )
414
+ dnw.write_string ('${tabs(3) } <div class="title"><${head_tag} >${sym_name}${hash_link} </${head_tag} >' )
414
415
} else {
415
- dnw.write_string ('${tabs[2] } <div class="title"><${head_tag} >${dn.kind} ${sym_name}${hash_link} </${head_tag} >' )
416
+ dnw.write_string ('${tabs(3) } <div class="title"><${head_tag} >${dn.kind} ${sym_name}${hash_link} </${head_tag} >' )
416
417
}
417
418
if link.len != 0 {
418
419
dnw.write_string ('<a class="link" rel="noreferrer" target="_blank" href="${link} ">${link_svg} </a>' )
0 commit comments