import html_components
import html::bootstrap
import ordered_tree
+import model::model_collect
redef class MEntity
- # ID used as a HTML unique ID and in file names.
- #
- # **Must** match the following (POSIX ERE) regular expression:
- #
- # ~~~POSIX ERE
- # ^[A-Za-z_][A-Za-z0-9._-]*$
- # ~~~
- #
- # That way, the ID is always a valid URI component and a valid XML name.
- fun nitdoc_id: String is abstract
-
# URL of this entity’s Nitdoc page.
fun nitdoc_url: String is abstract
redef fun css_classes do
var set = new HashSet[String]
if is_intro then set.add "intro"
- for m in mclass.intro.modifiers do set.add m.to_cmangle
- for m in modifiers do set.add m.to_cmangle
+ for m in mclass.intro.collect_modifiers do set.add m.to_cmangle
+ for m in collect_modifiers do set.add m.to_cmangle
return set.to_a
end
end
redef fun css_classes do
var set = new HashSet[String]
if is_intro then set.add "intro"
- for m in mproperty.intro.modifiers do set.add m.to_cmangle
- for m in modifiers do set.add m.to_cmangle
+ for m in mproperty.intro.collect_modifiers do set.add m.to_cmangle
+ for m in collect_modifiers do set.add m.to_cmangle
return set.to_a
end
end
# FIXME annotation should be handled in their own way
redef fun html_modifiers do
+ if mproperty.is_init then
+ var res = new Array[String]
+ if mproperty.visibility != public_visibility then
+ res.add mproperty.visibility.to_s
+ end
+ return res
+ end
var res = super
if is_abstract then
res.add "abstract"
else if is_intern then
res.add "intern"
end
+ res.add "fun"
+ return res
+ end
+
+ redef fun html_declaration do
if mproperty.is_init then
- res.add "init"
- else
- res.add "fun"
+ var tpl = new Template
+ tpl.add "<span>"
+ tpl.add html_modifiers.join(" ")
+ tpl.add " "
+ tpl.add html_link
+ tpl.add html_signature
+ tpl.add "</span>"
+ return tpl
end
- return res
+ return super
+ end
+
+ redef fun html_short_signature do
+ if mproperty.is_root_init and new_msignature != null then
+ return new_msignature.html_short_signature
+ end
+ return msignature.html_short_signature
end
- redef fun html_short_signature do return msignature.html_short_signature
- redef fun html_signature do return msignature.html_signature
+ redef fun html_signature do
+ if mproperty.is_root_init and new_msignature != null then
+ return new_msignature.html_signature
+ end
+ return msignature.html_signature
+ end
end
redef class MVirtualTypeProp