Merge: Generalize instance creation service so FFI can use it
[nit.git] / src / doc / doc_model.nit
index 536cb3a..99691d1 100644 (file)
@@ -111,7 +111,7 @@ redef class MEntity
                return new TplListItem.with_content(lnk)
        end
 
-       fun tpl_css_classes: Array[String] is abstract
+       var tpl_css_classes = new Array[String]
 
        # Box title for this mentity
        fun tpl_title: Template do
@@ -257,6 +257,7 @@ redef class MClass
        redef fun mdoc_or_fallback do return intro.mdoc
 
        redef fun tpl_declaration do return intro.tpl_declaration
+       redef fun tpl_definition do return intro.tpl_definition
 
        redef fun tpl_namespace do
                var tpl = new Template
@@ -283,7 +284,7 @@ redef class MClass
                        tpl.add "["
                        var parameter_names = new Array[String]
                        for p in mparameters do
-                               parameter_names.add(p.name)
+                               parameter_names.add(p.nitdoc_name)
                        end
                        tpl.add parameter_names.join(", ")
                        tpl.add "]"
@@ -354,7 +355,7 @@ redef class MClassDef
                if not mparameters.is_empty then
                        tpl.add "["
                        for i in [0..mparameters.length[ do
-                               tpl.add "{mparameters[i].name}: "
+                               tpl.add "{mparameters[i].nitdoc_name}: "
                                tpl.add bound_mtype.arguments[i].tpl_signature
                                if i < mparameters.length - 1 then tpl.add ", "
                        end
@@ -365,7 +366,6 @@ redef class MClassDef
 
        redef fun tpl_definition do
                var tpl = new TplClassDefinition
-               tpl.namespace = tpl_namespace
                var mdoc = mdoc_or_fallback
                if mdoc != null then
                        tpl.comment = mdoc.tpl_comment
@@ -376,8 +376,8 @@ redef class MClassDef
        redef fun tpl_css_classes do
                var set = new HashSet[String]
                if is_intro then set.add "intro"
-               set.add_all mclass.intro.modifiers
-               set.add_all modifiers
+               for m in mclass.intro.modifiers do set.add m.to_cmangle
+               for m in modifiers do set.add m.to_cmangle
                return set.to_a
        end
 
@@ -385,7 +385,7 @@ redef class MClassDef
                var tpl = new Template
                for modifier in modifiers do
                        if modifier == "public" then continue
-                       tpl.add "{modifier} "
+                       tpl.add "{modifier.html_escape} "
                end
                return tpl
        end
@@ -449,7 +449,6 @@ redef class MPropDef
 
        redef fun tpl_definition do
                var tpl = new TplDefinition
-               tpl.namespace = mclassdef.tpl_namespace
                var mdoc = mdoc_or_fallback
                if mdoc != null then
                        tpl.comment = mdoc.tpl_comment
@@ -468,8 +467,8 @@ redef class MPropDef
        redef fun tpl_css_classes do
                var set = new HashSet[String]
                if is_intro then set.add "intro"
-               set.add_all mproperty.intro.modifiers
-               set.add_all modifiers
+               for m in mproperty.intro.modifiers do set.add m.to_cmangle
+               for m in modifiers do set.add m.to_cmangle
                return set.to_a
        end
 
@@ -477,7 +476,7 @@ redef class MPropDef
                var tpl = new Template
                for modifier in modifiers do
                        if modifier == "public" then continue
-                       tpl.add "{modifier} "
+                       tpl.add "{modifier.html_escape} "
                end
                return tpl
        end
@@ -533,7 +532,7 @@ redef class MMethod
                var tpl = new Template
                var params = new Array[String]
                for param in intro.msignature.mparameters do
-                       params.add param.name
+                       params.add param.name.html_escape
                end
                if not params.is_empty then
                        tpl.add "("
@@ -556,6 +555,7 @@ end
 redef class MVirtualTypeDef
        redef fun tpl_signature do
                var tpl = new Template
+               if bound == null then return tpl
                tpl.add ": "
                tpl.add bound.tpl_signature
                return tpl
@@ -596,7 +596,7 @@ end
 
 redef class MParameterType
        redef fun tpl_link do
-               return new TplLink.with_title("{mclass.nitdoc_url}#FT_{name}", name, "formal type")
+               return new TplLink.with_title("{mclass.nitdoc_url}#FT_{name.to_cmangle}", name, "formal type")
        end
        redef fun tpl_signature do return tpl_link
 end
@@ -705,7 +705,6 @@ redef class MInnerClassDef
 
        redef fun tpl_definition do
                var tpl = new TplClassDefinition
-               tpl.namespace = mclassdef.tpl_namespace
                var mdoc = mdoc_or_fallback
                if mdoc != null then
                        tpl.comment = mdoc.tpl_comment