Merge: Various fixes and improvements from We Broke The World
[nit.git] / src / doc / doc_model.nit
index 9080dbf..5d666c8 100644 (file)
@@ -54,7 +54,7 @@ redef class MEntity
        # URL of this entity Nitdoc page
        fun nitdoc_url: String is abstract
 
-       # A template link to the mentity `nitdoc_anchor`
+       # A template link to the mentity `nitdoc_id`
        fun tpl_anchor: TplLink do
                var tpl = new TplLink("#{nitdoc_id}", nitdoc_name)
                if mdoc != null then
@@ -107,7 +107,7 @@ redef class MEntity
                lnk.add tpl_link
                if mdoc != null then
                        lnk.add ": "
-                       lnk.add mdoc.short_comment
+                       lnk.add mdoc.short_markdown
                end
                return new TplListItem.with_content(lnk)
        end
@@ -137,7 +137,7 @@ redef class MConcern
                lnk.add tpl_anchor
                if mdoc != null then
                        lnk.add ": "
-                       lnk.add mdoc.short_comment
+                       lnk.add mdoc.short_markdown
                end
                return new TplListItem.with_content(lnk)
        end
@@ -186,7 +186,7 @@ redef class MGroup
                return "{mproject.nitdoc_id}__{nitdoc_name}"
        end
 
-       redef fun nitdoc_url do return "group_{name}.html"
+       redef fun nitdoc_url do return "group_{nitdoc_id}.html"
 
        redef fun tpl_namespace do
                var tpl = new Template
@@ -229,16 +229,7 @@ redef class MModule
                return nitdoc_name
        end
 
-       redef fun nitdoc_url do
-               var res = new FlatBuffer
-               res.append("module_")
-               var mowner = public_owner
-               if mowner != null then
-                       res.append("{public_owner.name}_")
-               end
-               res.append("{self.name}.html")
-               return res.to_s
-       end
+       redef fun nitdoc_url do return "module_{nitdoc_id}.html"
 
        redef fun tpl_declaration do
                var tpl = new Template
@@ -272,8 +263,7 @@ end
 redef class MClass
        redef fun nitdoc_name do return name.html_escape
        redef fun nitdoc_id do return "{intro_mmodule.mgroup.mproject}__{name.to_cmangle}"
-       redef fun nitdoc_url do return "class_{public_owner}_{name}.html"
-
+       redef fun nitdoc_url do return "class_{nitdoc_id}.html"
        redef fun mdoc do return intro.mdoc
 
        redef fun tpl_declaration do return intro.tpl_declaration
@@ -407,10 +397,10 @@ redef class MClassDef
                lnk.add tpl_link
                if mdoc != null then
                        lnk.add ": "
-                       lnk.add mdoc.short_comment
+                       lnk.add mdoc.short_markdown
                else if mclass.intro.mdoc != null then
                        lnk.add ": "
-                       lnk.add mclass.intro.mdoc.short_comment
+                       lnk.add mclass.intro.mdoc.short_markdown
                end
                return new TplListItem.with_content(lnk)
        end
@@ -439,7 +429,7 @@ end
 redef class MProperty
        redef fun nitdoc_name do return name.html_escape
        redef fun nitdoc_id do return "{intro_mclassdef.mclass.nitdoc_id}__{name.to_cmangle}"
-       redef fun nitdoc_url do return "proprety_{nitdoc_id}.html"
+       redef fun nitdoc_url do return "property_{nitdoc_id}.html"
 
        redef fun mdoc do return intro.mdoc
 
@@ -492,7 +482,7 @@ redef class MPropDef
                var tpl = new Template
                tpl.add mclassdef.tpl_namespace
                tpl.add "::"
-               tpl.add mproperty.name
+               tpl.add tpl_link
                return tpl
        end
 
@@ -510,14 +500,6 @@ redef class MPropDef
                return tpl
        end
 
-       redef fun tpl_title do
-               var title = new Template
-               title.add tpl_icon
-               title.add tpl_link
-               title.add tpl_signature
-               return title
-       end
-
        redef fun tpl_definition do
                var tpl = new TplDefinition
                tpl.namespace = mclassdef.tpl_namespace
@@ -557,16 +539,35 @@ redef class MPropDef
        redef fun tpl_list_item do
                var lnk = new Template
                lnk.add new TplLabel.with_classes(tpl_css_classes.to_a)
-               lnk.add tpl_link
+               var anchor = tpl_link
+               anchor.href = "{mclassdef.mclass.nitdoc_url}#{mproperty.nitdoc_id}"
+               lnk.add anchor
                if mdoc != null then
                        lnk.add ": "
-                       lnk.add mdoc.short_comment
+                       lnk.add mdoc.short_markdown
                else if mproperty.intro.mdoc != null then
                        lnk.add ": "
-                       lnk.add mproperty.intro.mdoc.short_comment
+                       lnk.add mproperty.intro.mdoc.short_markdown
                end
                return new TplListItem.with_content(lnk)
        end
+
+       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 "::"
+               var anchor = mclassdef.tpl_link
+               anchor.href = "{mclassdef.mclass.nitdoc_url}#{mproperty.nitdoc_id}"
+               lnk.add anchor
+               if mdoc != null then
+                       lnk.add ": "
+                       lnk.add mdoc.short_markdown
+               end
+               var li = new TplListItem.with_content(lnk)
+               li.css_classes.add "signature"
+               return li
+       end
 end
 
 redef class MMethod