From c7a746fc6e02cf5340b7a254bd0efb8424b30270 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Sun, 10 Jun 2018 19:19:40 -0400 Subject: [PATCH] src/doc/commands: redef `render_comment` in `commands_html` and `commands_md` Signed-off-by: Alexandre Terrasa --- src/doc/commands/commands_html.nit | 11 +++++++++++ src/doc/commands/commands_md.nit | 11 +++++++++++ src/doc/commands/commands_model.nit | 7 +------ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/doc/commands/commands_html.nit b/src/doc/commands/commands_html.nit index 7aac39a..c712e6c 100644 --- a/src/doc/commands/commands_html.nit +++ b/src/doc/commands/commands_html.nit @@ -104,6 +104,17 @@ redef class CmdComment end return tpl.write_to_string end + + redef fun render_comment do + var mdoc = self.mdoc + if mdoc == null then return null + + if format == "html" then + if full_doc then return mdoc.html_documentation + return mdoc.html_synopsis + end + return super + end end redef class CmdEntityLink diff --git a/src/doc/commands/commands_md.nit b/src/doc/commands/commands_md.nit index 77ad14a..78ca986 100644 --- a/src/doc/commands/commands_md.nit +++ b/src/doc/commands/commands_md.nit @@ -89,6 +89,17 @@ redef class CmdComment end return tpl.write_to_string end + + redef fun render_comment do + var mdoc = self.mdoc + if mdoc == null then return null + + if format == "md" then + if full_doc then return mdoc.md_documentation + return mdoc.md_synopsis + end + return super + end end redef class CmdEntityLink diff --git a/src/doc/commands/commands_model.nit b/src/doc/commands/commands_model.nit index abf5d7d..5b51e3f 100644 --- a/src/doc/commands/commands_model.nit +++ b/src/doc/commands/commands_model.nit @@ -23,7 +23,6 @@ import model::model_collect import modelize import modelbuilder import htmlight -import doc_down # Retrieve the MDoc related to a MEntity class CmdComment @@ -47,7 +46,7 @@ class CmdComment # Format to render the comment # - # Can be one of `raw` or `html`. + # Can be one of `raw`, `html` or `md`. # Default is `raw`. var format = "raw" is optional, writable @@ -74,10 +73,6 @@ class CmdComment var mdoc = self.mdoc if mdoc == null then return null - if format == "html" then - if full_doc then return mdoc.html_documentation - return mdoc.html_synopsis - end if full_doc then return mdoc.documentation return mdoc.synopsis end -- 1.7.9.5