diff --git a/cmd/tools/vcomplete.v b/cmd/tools/vcomplete.v index cd4bb61c84..985a601643 100644 --- a/cmd/tools/vcomplete.v +++ b/cmd/tools/vcomplete.v @@ -203,6 +203,7 @@ const ( '-pos', '-no-timestamp', '-inline-assets', + '-theme-dir', '-open', '-p', '-s', diff --git a/cmd/tools/vdoc/html.v b/cmd/tools/vdoc/html.v index aa5c90ec14..574e13b52a 100644 --- a/cmd/tools/vdoc/html.v +++ b/cmd/tools/vdoc/html.v @@ -13,69 +13,8 @@ import v.pref const ( css_js_assets = ['doc.css', 'normalize.css', 'doc.js', 'dark-mode.js'] - res_path = os.resource_abs_path('resources') - favicons_path = os.join_path(res_path, 'favicons') + default_theme = os.resource_abs_path('theme') link_svg = '' - html_content = ' - - - - - - {{ title }} | vdoc - - - - - - - - - - - - {{ head_assets }} - - -
Skip to content
-
- -
-
-
-{{ contents }} - -
- {{ right_content }} -
-
-
- {{ footer_assets }} - - -' ) enum HighlightTokenTyp { @@ -150,7 +89,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(res_path, name) + path := os.join_path(cfg.theme_dir, name) mut res := os.read_file(path) or { panic('vdoc: could not read $path') } /* if minify { @@ -301,8 +240,9 @@ fn (vd VDoc) gen_html(d doc.Doc) string { } modules_toc_str := modules_toc.str() symbols_toc_str := symbols_toc.str() - result := 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 }}', + result := (os.read_file(os.join_path(cfg.theme_dir, 'index.html')) or { panic(err) }).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 { '\n${tabs[0]}\n${tabs[0]}