src/doc: rename `tpl_namespace` in `html_namespace` also clean comments
authorAlexandre Terrasa <alexandre@moz-code.org>
Mon, 23 Feb 2015 19:12:37 +0000 (20:12 +0100)
committerAlexandre Terrasa <alexandre@moz-code.org>
Tue, 21 Apr 2015 12:29:27 +0000 (08:29 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/doc/doc_phases/doc_html.nit
src/doc/html_templates/html_model.nit

index a54ad8f..bd54c91 100644 (file)
@@ -534,7 +534,7 @@ redef class DocRoot
                        section.subtitle = mentity.mproject.html_declaration
                else if mentity isa MProperty then
                        section.title = "{mentity.html_name}{mentity.intro.tpl_signature.write_to_string}"
-                       section.subtitle = mentity.tpl_namespace
+                       section.subtitle = mentity.html_namespace
                        section.summary_title = mentity.html_name
                end
                render(v, doc, page, section)
@@ -575,14 +575,14 @@ redef class ConcernSection
                        title.add "from "
                        section.summary_title = "from {mmodule.html_name}"
                end
-               title.add mmodule.tpl_namespace
+               title.add mmodule.html_namespace
                section.title = title
        end
 
        private fun render_concern_other(page: MEntityPage, section: TplSection, mmodule: MModule) do
                var title = new Template
                title.add "in "
-               title.add mmodule.tpl_namespace
+               title.add mmodule.html_namespace
                section.title = title
                section.summary_title = "in {mmodule.html_name}"
        end
@@ -609,7 +609,7 @@ redef class IntroArticle
                # FIXME diff hack
                if mentity isa MProperty then
                        # intro title
-                       var ns = mentity.intro.mclassdef.mmodule.tpl_namespace
+                       var ns = mentity.intro.mclassdef.mmodule.html_namespace
                        var section = new TplSection("intro")
                        var title = new Template
                        title.add "Introduction in "
@@ -673,7 +673,7 @@ redef class DefinitionArticle
 
        private fun make_mclass_article(v: RenderHTMLPhase, page: MEntityPage): TplArticle do
                var article = mentity.tpl_article
-               article.subtitle = mentity.tpl_namespace
+               article.subtitle = mentity.html_namespace
                article.content = null
                return article
        end
@@ -686,7 +686,7 @@ redef class DefinitionArticle
                end
                var title = new Template
                title.add "in "
-               title.add mclassdef.mmodule.tpl_namespace
+               title.add mclassdef.mmodule.html_namespace
                article.subtitle = title
                return article
        end
@@ -713,7 +713,7 @@ redef class DefinitionArticle
                article.title = title
                article.title_classes.add "signature"
                article.summary_title = "{mprop.html_name}"
-               article.subtitle = mpropdef.tpl_namespace
+               article.subtitle = mpropdef.html_namespace
                if mpropdef.mdoc_or_fallback != null then
                        article.content = mpropdef.mdoc_or_fallback.tpl_comment
                end
index ebc6eff..bcfdcf5 100644 (file)
@@ -103,6 +103,17 @@ redef class MEntity
                return tpl
        end
 
+       # Returns `self` namespace decorated with HTML links.
+       #
+       # * MProject: `mproject`
+       # * MGroup: `mproject(::group)`
+       # * MModule: `mgroup::mmodule`
+       # * MClass: `mproject::mclass`
+       # * MClassDef: `mmodule::mclassdef`
+       # * MProperty: `mclass::mprop`
+       # * MPropdef: `mclassdef:mpropdef`
+       fun html_namespace: Template is abstract
+
        # A template article that briefly describe the entity
        fun tpl_short_article: TplArticle do
                var tpl = tpl_article
@@ -117,14 +128,11 @@ redef class MEntity
        fun tpl_article: TplArticle do
                var tpl = new TplArticle.with_title(nitdoc_id, tpl_title)
                tpl.title_classes.add "signature"
-               tpl.subtitle = tpl_namespace
+               tpl.subtitle = html_namespace
                tpl.summary_title = html_name
                return tpl
        end
 
-       # A template namespace
-       fun tpl_namespace: Template is abstract
-
        # A template definition of the mentity
        # include name, sysnopsys, comment and namespace
        fun tpl_definition: TplDefinition is abstract
@@ -148,7 +156,7 @@ redef class MEntity
        fun tpl_title: Template do
                var title = new Template
                title.add tpl_icon
-               title.add tpl_namespace
+               title.add html_namespace
                return title
        end
 
@@ -178,8 +186,7 @@ redef class MProject
        redef var nitdoc_id = name.to_cmangle is lazy
        redef fun nitdoc_url do return root.nitdoc_url
        redef var html_modifiers = ["project"]
-
-       redef fun tpl_namespace do return html_link
+       redef fun html_namespace do return html_link
 
        redef fun tpl_definition do
                var tpl = new TplDefinition
@@ -204,9 +211,13 @@ redef class MGroup
        redef fun nitdoc_url do return "group_{nitdoc_id}.html"
        redef var html_modifiers = ["group"]
 
-       redef fun tpl_namespace do
+       # Depends if `self` is root or not.
+       #
+       # * If root `mproject`.
+       # * Else `mproject::self`.
+       redef fun html_namespace do
                var tpl = new Template
-               tpl.add mproject.tpl_namespace
+               tpl.add mproject.html_namespace
                if mproject.root != self then
                        tpl.add "::"
                        tpl.add html_link
@@ -239,10 +250,14 @@ redef class MModule
        redef fun nitdoc_url do return "module_{nitdoc_id}.html"
        redef var html_modifiers = ["module"]
 
-       redef fun tpl_namespace do
+       # Depends if `self` belongs to a MGroup.
+       #
+       # * If mgroup `mgroup::self`.
+       # * Else `self`.
+       redef fun html_namespace do
                var tpl = new Template
                if mgroup != null then
-                       tpl.add mgroup.tpl_namespace
+                       tpl.add mgroup.html_namespace
                        tpl.add "::"
                end
                tpl.add html_link
@@ -285,17 +300,18 @@ redef class MClass
        redef fun html_modifiers do return intro.html_modifiers
        redef fun html_declaration do return intro.html_declaration
 
-       redef fun tpl_definition do return intro.tpl_definition
-
-       redef fun tpl_namespace do
+       # Returns `mproject::self`.
+       redef fun html_namespace do
                var tpl = new Template
-               tpl.add intro_mmodule.mgroup.mproject.tpl_namespace
+               tpl.add intro_mmodule.mgroup.mproject.html_namespace
                tpl.add "::<span>"
                tpl.add html_link
                tpl.add "</span>"
                return tpl
        end
 
+       redef fun tpl_definition do return intro.tpl_definition
+
        redef fun tpl_title do
                var title = new Template
                title.add tpl_icon
@@ -360,9 +376,10 @@ redef class MClassDef
                return tpl
        end
 
-       redef fun tpl_namespace do
+       # Returns `mmodule::self`
+       redef fun html_namespace do
                var tpl = new Template
-               tpl.add mmodule.tpl_namespace
+               tpl.add mmodule.html_namespace
                tpl.add "::<span>"
                tpl.add mclass.html_link
                tpl.add "</span>"
@@ -376,7 +393,7 @@ redef class MClassDef
                tpl.title_classes.add "signature"
                var title = new Template
                title.add "in "
-               title.add mmodule.tpl_namespace
+               title.add mmodule.html_namespace
                tpl.subtitle = title
                var mdoc = mdoc_or_fallback
                if mdoc != null then
@@ -441,9 +458,10 @@ redef class MProperty
        redef fun html_modifiers do return intro.html_modifiers
        redef fun html_declaration do return intro.html_declaration
 
-       redef fun tpl_namespace do
+       # Returns `mclass::self`.
+       redef fun html_namespace do
                var tpl = new Template
-               tpl.add intro_mclassdef.mclass.tpl_namespace
+               tpl.add intro_mclassdef.mclass.html_namespace
                tpl.add "::<span>"
                tpl.add intro.html_link
                tpl.add "</span>"
@@ -496,9 +514,10 @@ redef class MPropDef
                return tpl
        end
 
-       redef fun tpl_namespace do
+       # Returns `mclassdef::self`
+       redef fun html_namespace do
                var tpl = new Template
-               tpl.add mclassdef.tpl_namespace
+               tpl.add mclassdef.html_namespace
                tpl.add "::"
                tpl.add html_link
                return tpl
@@ -566,7 +585,7 @@ redef class MPropDef
        fun tpl_inheritance_item: TplListItem do
                var lnk = new Template
                lnk.add new TplLabel.with_classes(tpl_css_classes.to_a)
-               lnk.add mclassdef.mmodule.tpl_namespace
+               lnk.add mclassdef.mmodule.html_namespace
                lnk.add "::"
                var atext = mclassdef.html_link.text
                var ahref = "{mclassdef.mclass.nitdoc_url}#{mproperty.nitdoc_id}"