src/doc/commands: redef `render_comment` in `commands_html` and `commands_md`
authorAlexandre Terrasa <alexandre@moz-code.org>
Sun, 10 Jun 2018 23:19:40 +0000 (19:19 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Fri, 22 Jun 2018 03:42:10 +0000 (23:42 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/doc/commands/commands_html.nit
src/doc/commands/commands_md.nit
src/doc/commands/commands_model.nit

index 7aac39a..c712e6c 100644 (file)
@@ -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
index 77ad14a..78ca986 100644 (file)
@@ -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
index abf5d7d..5b51e3f 100644 (file)
@@ -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