doc/commands: term handles `commands_ini`
[nit.git] / src / doc / commands / commands_html.nit
index ce5d89a..b2ab2a3 100644 (file)
@@ -17,6 +17,7 @@ module commands_html
 
 import commands::commands_graph
 import commands::commands_usage
+import commands::commands_ini
 
 import templates::templates_html
 import doc_down
@@ -48,7 +49,7 @@ redef class CmdEntity
        redef fun to_html do
                var mentity = self.mentity
                if mentity == null then return ""
-               return mentity.html_link
+               return mentity.html_link.write_to_string
        end
 end
 
@@ -104,14 +105,64 @@ redef class CmdComment
        end
 end
 
-redef class CmdCode
+redef class CmdEntityLink
        redef fun to_html do
-               var output = render
+               var mentity = self.mentity
+               if mentity == null then return ""
+               return mentity.html_link(text, title).write_to_string
+       end
+end
+
+redef class CmdEntityCode
+       redef fun to_html do
+               var output = render_code(node)
                if output == null then return ""
                return "<pre>{output.write_to_string}</pre>"
        end
 end
 
+redef class CmdAncestors
+       redef fun to_html do return super # FIXME lin
+end
+
+redef class CmdParents
+       redef fun to_html do return super # FIXME lin
+end
+
+redef class CmdChildren
+       redef fun to_html do return super # FIXME lin
+end
+
+redef class CmdDescendants
+       redef fun to_html do return super # FIXME lin
+end
+
+redef class CmdFeatures
+       redef fun to_html do return super # FIXME lin
+end
+
+redef class CmdLinearization
+       redef fun to_html do return super # FIXME lin
+end
+
+# Usage commands
+
+redef class CmdNew
+       redef fun to_html do return super # FIXME lin
+end
+
+redef class CmdCall
+       redef fun to_html do return super # FIXME lin
+end
+
+redef class CmdReturn
+       redef fun to_html do return super # FIXME lin
+end
+
+redef class CmdParam
+       redef fun to_html do return super # FIXME lin
+end
+
 # Graph commands
 
 redef class CmdGraph
@@ -121,3 +172,98 @@ redef class CmdGraph
                return output.write_to_string
        end
 end
+
+# Ini commands
+
+redef class CmdIniDescription
+       redef fun to_html do
+               var desc = self.desc
+               if desc == null then return ""
+
+               return "<p>{desc}</p>"
+       end
+end
+
+redef class CmdIniGitUrl
+       redef fun to_html do
+               var url = self.url
+               if url == null then return ""
+
+               return "<a href=\"{url}\">{url}</a>"
+       end
+end
+
+redef class CmdIniCloneCommand
+       redef fun to_html do
+               var command = self.command
+               if command == null then return ""
+
+               return "<pre>{command}</pre>"
+       end
+end
+
+redef class CmdIniIssuesUrl
+       redef fun to_html do
+               var url = self.url
+               if url == null then return ""
+
+               return "<a href=\"{url}\">{url}</a>"
+       end
+end
+
+redef class CmdIniMaintainer
+       redef fun to_html do
+               var name = self.maintainer
+               if name == null then return ""
+
+               return "<b>{name.html_escape}</b>"
+       end
+end
+
+redef class CmdIniContributors
+       redef fun to_html do
+               var names = self.contributors
+               if names == null or names.is_empty then return ""
+
+               var tpl = new Template
+               tpl.add "<ul>"
+               for name in names do
+                       tpl.add "<li><b>{name.html_escape}</b></li>"
+               end
+               tpl.add "</ul>"
+               return tpl.write_to_string
+       end
+end
+
+redef class CmdIniLicense
+       redef fun to_html do
+               var license = self.license
+               if license == null then return ""
+
+               return "<a href=\"https://opensource.org/licenses/{license}\">{license}</a>"
+       end
+end
+
+redef class CmdEntityFile
+
+       # URL to the file
+       #
+       # Can be refined in subtools.
+       var file_url: nullable String = file is lazy, writable
+
+       redef fun to_html do
+               var file = self.file
+               if file == null then return ""
+
+               return "<a href=\"{file_url or else ""}\">{file.basename}</a>"
+       end
+end
+
+redef class CmdEntityFileContent
+       redef fun to_html do
+               var content = self.content
+               if content == null then return ""
+
+               return "<pre>{content}</pre>"
+       end
+end