diff --git a/cmd/tools/vdoc.v b/cmd/tools/vdoc.v
index cba1766f7e..ece7982303 100644
--- a/cmd/tools/vdoc.v
+++ b/cmd/tools/vdoc.v
@@ -109,6 +109,7 @@ mut:
open_docs bool
server_port int = 8046
inline_assets bool
+ no_timestamp bool
output_path string
input_path string
symbol_name string
@@ -456,7 +457,6 @@ fn (cfg DocConfig) write_content(cn &doc.DocNode, dcs &doc.Doc, mut hw strings.B
fn (cfg DocConfig) gen_html(idx int) string {
dcs := cfg.docs[idx]
- time_gen := '$dcs.time_generated.day $dcs.time_generated.smonth() $dcs.time_generated.year $dcs.time_generated.hhmmss()'
mut toc := strings.new_builder(200)
mut toc2 := strings.new_builder(200)
mut contents := strings.new_builder(200)
@@ -532,7 +532,7 @@ fn (cfg DocConfig) gen_html(idx int) string {
'
'
} else {
''
- }).replace('{{ footer_content }}', 'Powered by vdoc. Generated on: $time_gen').replace('{{ footer_assets }}',
+ }).replace('{{ footer_content }}', cfg.gen_footer_text(idx)).replace('{{ footer_assets }}',
if cfg.inline_assets {
''
} else {
@@ -577,10 +577,22 @@ fn (cfg DocConfig) gen_markdown(idx int, with_toc bool) string {
cw.writeln('```v\n$cn.content\n```$cn.comment\n')
cw.writeln('[\[Return to contents\]](#Contents)\n')
}
- cw.writeln('#### Generated by vdoc. Last generated: $dcs.time_generated.str()')
+ footer_text := cfg.gen_footer_text(idx)
+ cw.writeln('#### $footer_text')
return hw.str() + '\n' + cw.str()
}
+fn (cfg DocConfig) gen_footer_text(idx int) string {
+ current_doc := cfg.docs[idx]
+ footer_text := 'Powered by vdoc.'
+ if cfg.no_timestamp {
+ return footer_text
+ }
+ generated_time := current_doc.time_generated
+ time_str := '$generated_time.day $generated_time.smonth() $generated_time.year $generated_time.hhmmss()'
+ return '$footer_text Generated on: $time_str'
+}
+
fn (cfg DocConfig) render_doc(doc doc.Doc, i int) (string, string) {
// since builtin is generated first, ignore it
mut name := if ('vlib' in cfg.input_path &&
@@ -1034,6 +1046,9 @@ fn main() {
cfg.output_type = .html
}
}
+ '-no-timestamp' {
+ cfg.no_timestamp = true
+ }
'-readme' {
cfg.include_readme = true
}
diff --git a/cmd/v/help/doc.txt b/cmd/v/help/doc.txt
index 9f00fb5f53..727e8e4b3e 100644
--- a/cmd/v/help/doc.txt
+++ b/cmd/v/help/doc.txt
@@ -23,6 +23,7 @@ Options:
-v Enables verbose logging. For debugging purposes.
-filename Specifies the specific file to document.
-pos Specifies the position. Used with `-filename`.
+ -no-timestamp Omit timestamp in the output file.
For HTML mode:
-inline-assets Embeds the contents of the CSS and JS assets into the webpage directly.