src/doc/commands/templates: rename `templates_html` in `html_model`
authorAlexandre Terrasa <alexandre@moz-code.org>
Fri, 22 Jun 2018 03:48:20 +0000 (23:48 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Fri, 22 Jun 2018 14:47:10 +0000 (10:47 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/catalog/catalog.nit
src/doc/commands/commands_html.nit
src/doc/static/static_base.nit
src/doc/static/static_cards.nit
src/doc/templates/html_model.nit [moved from src/doc/templates/templates_html.nit with 99% similarity]
src/doc/templates/templates_json.nit
src/nitcatalog.nit

index 6a12238..140278e 100644 (file)
@@ -165,24 +165,6 @@ class Person
                return email.md5.to_lower
        end
 
-       # Return a full-featured link to a person
-       fun to_html: String
-       do
-               var res = ""
-               var e = name.html_escape
-               var page = self.page
-               if page != null then
-                       res += "<a href=\"{page.html_escape}\">"
-               end
-               var gravatar = self.gravatar
-               if gravatar != null then
-                       res += "<img src=\"https://secure.gravatar.com/avatar/{gravatar}?size=20&amp;default=retro\">&nbsp;"
-               end
-               res += e
-               if page != null then res += "</a>"
-               return res
-       end
-
        # The standard representation of a person.
        #
        # ~~~
index e00a024..2d485f6 100644 (file)
@@ -22,7 +22,7 @@ import commands_main
 import commands_parser
 import commands_usage
 
-import templates::templates_html
+import templates::html_model
 intrude import markdown::wikilinks
 
 redef class DocCommand
index a7ae6bb..16f09aa 100644 (file)
@@ -18,8 +18,6 @@ module static_base
 import static_cards
 import modelize
 
-intrude import markdown::wikilinks
-
 # The model of a Nitdoc documentation
 class DocModel
 
index 9b706c5..c02f565 100644 (file)
 # Cards templates for the static documentation
 module static_cards
 
-import doc::commands::commands_graph
-import doc::commands::commands_catalog
-import doc::commands::commands_docdown
-import templates_html
+import templates::html_commands
 
 # A card that can be rendered to HTML
 #
similarity index 99%
rename from src/doc/templates/templates_html.nit
rename to src/doc/templates/html_model.nit
index d715d7b..6ec000f 100644 (file)
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # Translate mentities to html blocks.
-module templates_html
+module html_model
 
 import model::model_collect
 import catalog
@@ -370,7 +370,8 @@ redef class Person
        # Link to this person `html_url`
        fun html_link: Link do return new Link(html_url, name)
 
-       redef fun to_html do
+       # Render `self` as HTML
+       fun to_html: String do
                var tpl = new Template
                tpl.addn "<span>"
                var gravatar = self.gravatar
index e1dacf8..4c17b7f 100644 (file)
@@ -28,7 +28,7 @@ import model::model_collect
 import json::serialization_write
 import catalog
 
-import templates_html
+import html_model
 
 redef class MEntity
        serialize
index a8b3192..2a0a4a5 100644 (file)
@@ -24,7 +24,7 @@ module nitcatalog
 import loader # Scan&load packages, groups and modules
 import catalog
 
-import templates_html
+import doc::templates::html_model
 
 # A HTML page in a catalog
 #
@@ -532,6 +532,24 @@ redef class Catalog
        var piwik_site_id: Int = 1
 end
 
+redef class Person
+       redef fun to_html do
+               var res = ""
+               var e = name.html_escape
+               var page = self.page
+               if page != null then
+                       res += "<a href=\"{page.html_escape}\">"
+               end
+               var gravatar = self.gravatar
+               if gravatar != null then
+                       res += "<img src=\"https://secure.gravatar.com/avatar/{gravatar}?size=20&amp;default=retro\">&nbsp;"
+               end
+               res += e
+               if page != null then res += "</a>"
+               return res
+       end
+end
+
 var model = new Model
 var tc = new ToolContext