@@ -19,6 +19,7 @@ struct Readme {
1919
2020enum OutputType {
2121 unset
22+ none
2223 html
2324 markdown
2425 json
@@ -151,6 +152,7 @@ fn (mut vd VDoc) write_plaintext_content(contents []doc.DocNode, mut pw strings.
151152fn (mut vd VDoc) render_doc (d doc.Doc, out Output) (string , string ) {
152153 name := vd.get_file_name (d.head.name, out)
153154 output := match out.typ {
155+ .none { '' }
154156 .html { vd.gen_html (d) }
155157 .markdown { vd.gen_markdown (d, true ) }
156158 .json { vd.gen_json (d) }
@@ -190,9 +192,11 @@ fn (mut vd VDoc) work_processor(mut work sync.Channel, mut wg sync.WaitGroup) {
190192 }
191193 vd.vprintln ('> start processing ${pdoc .d .base_path } ...' )
192194 file_name , content := vd.render_doc (pdoc.d, pdoc.out)
193- output_path := os.join_path (pdoc.out.path, file_name)
194- println ('Generating ${content .len :8 } bytes of ${pdoc .out .typ } in `${output_path }` ...' )
195- os.write_file (output_path, content) or { panic (err) }
195+ if vd.cfg.output_type != .none {
196+ output_path := os.join_path (pdoc.out.path, file_name)
197+ println ('Generating ${content .len :8 } bytes of ${pdoc .out .typ } in `${output_path }` ...' )
198+ os.write_file (output_path, content) or { panic (err) }
199+ }
196200 }
197201 wg.done ()
198202}
@@ -301,7 +305,7 @@ fn (mut vd VDoc) generate_docs_from_file() {
301305 ext := os.file_ext (out.path)
302306 out.typ = set_output_type_from_str (ext.all_after ('.' ))
303307 }
304- if cfg.include_readme && out.typ ! in [.html, .ansi, .plaintext] {
308+ if cfg.include_readme && out.typ ! in [.html, .ansi, .plaintext, . none ] {
305309 eprintln ('vdoc: Including README.md for doc generation is supported on HTML output, or when running directly in the terminal.' )
306310 exit (1 )
307311 }
0 commit comments