From 4f2225a21e7ee63bec97262b7272239f4718d279 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Mon, 19 Oct 2015 18:57:57 -0400 Subject: [PATCH] src/doc: introduce option --no-render in HTML phase. Signed-off-by: Alexandre Terrasa --- src/doc/doc_phases/doc_html.nit | 7 ++++++- src/nitdoc.nit | 9 +++------ tests/nitdoc.args | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/doc/doc_phases/doc_html.nit b/src/doc/doc_phases/doc_html.nit index ebc1193..30a15c2 100644 --- a/src/doc/doc_phases/doc_html.nit +++ b/src/doc/doc_phases/doc_html.nit @@ -70,6 +70,9 @@ redef class ToolContext # FIXME redo the plugin var opt_github_gitdir = new OptionString("Git working directory used to resolve path name (ex: /home/me/mypackage/)", "--github-gitdir") + # Do not produce HTML files + var opt_no_render = new OptionBool("do not render HTML files", "--no-render") + redef init do super @@ -77,7 +80,8 @@ redef class ToolContext opt_source, opt_sharedir, opt_shareurl, opt_custom_title, opt_custom_footer, opt_custom_intro, opt_custom_brand, opt_github_upstream, opt_github_base_sha1, opt_github_gitdir, - opt_piwik_tracker, opt_piwik_site_id) + opt_piwik_tracker, opt_piwik_site_id, + opt_no_render) end redef fun process_options(args) do @@ -103,6 +107,7 @@ class RenderHTMLPhase var name_sorter = new MEntityNameSorter redef fun apply do + if ctx.opt_no_render.value then return init_output_dir for page in doc.pages.values do page.render(self, doc).write_to_file("{ctx.output_dir.to_s}/{page.html_url}") diff --git a/src/nitdoc.nit b/src/nitdoc.nit index bda79e7..1e6059b 100644 --- a/src/nitdoc.nit +++ b/src/nitdoc.nit @@ -26,7 +26,7 @@ redef class ToolContext var docphase: Phase = new Nitdoc(self, null) # File pattern used to link documentation to source code. - var opt_test = new OptionBool("do not render anything, only print test data", "--test") + var opt_test = new OptionBool("print test data", "--test") redef init do super @@ -52,11 +52,8 @@ private class Nitdoc new IntroRedefListPhase(toolcontext, doc), new LinListPhase(toolcontext, doc), new GraphPhase(toolcontext, doc), - new ReadmePhase(toolcontext, doc): DocPhase] - - if not toolcontext.opt_test.value then - phases.add new RenderHTMLPhase(toolcontext, doc) - end + new ReadmePhase(toolcontext, doc), + new RenderHTMLPhase(toolcontext, doc): DocPhase] for phase in phases do toolcontext.info("# {phase.class_name}", 1) diff --git a/tests/nitdoc.args b/tests/nitdoc.args index de4c3e4..ee5fd03 100644 --- a/tests/nitdoc.args +++ b/tests/nitdoc.args @@ -1,4 +1,4 @@ module_1.nit -d $WRITE base_attr_nullable.nit -d $WRITE --private base_attr_nullable.nit -d $WRITE ---test test_prog -d $WRITE +--no-render --test test_prog -d $WRITE -- 1.7.9.5