import model::model_collect
import doc::doc_down
import html::bootstrap
+import catalog
redef class MEntity
end
redef class MPackage
- redef fun html_url do return "package_{html_id}.html"
redef fun html_namespace do return html_link
redef fun html_icon do return new BSIcon("book", ["text-muted"])
redef var css_classes = ["public"]
end
redef class MGroup
- redef fun html_url do return "group_{html_id}.html"
redef fun html_icon do return new BSIcon("folder-close", ["text-muted"])
redef fun html_namespace do
end
redef class MModule
- redef fun html_url do return "module_{html_id}.html"
redef fun html_icon do return new BSIcon("file", ["text-muted"])
redef fun html_namespace do
end
redef class MClass
- redef fun html_url do return "class_{html_id}.html"
redef fun html_icon do return new BSIcon("stop", css_classes)
redef fun html_signature(short) do return intro.html_signature(short)
redef fun css_classes do return super + [visibility.to_s]
end
redef class MClassDef
- redef fun html_url do return "{mclass.html_url}#{html_id}"
redef fun css_classes do return super + mclass.css_classes
redef fun html_namespace do
end
redef class MProperty
- redef fun html_url do return "property_{html_id}.html"
redef fun html_declaration do return intro.html_declaration
redef fun html_signature(short) do return intro.html_signature(short)
redef fun html_icon do return new BSIcon("tag", css_classes)
end
redef class MPropDef
- redef fun html_url do return "{mproperty.html_url}#{html_id}"
redef fun css_classes do return super + mproperty.css_classes
redef fun html_namespace do
if mproperty.is_root_init and new_msignature != null then
return new_msignature.html_signature(short)
end
- return msignature.as(not null).html_signature(short)
+ var msignature = self.msignature
+ if msignature == null then return new Template
+ return msignature.html_signature(short)
end
end
return tpl
end
end
+
+redef class Person
+
+ # HTML uniq id
+ fun html_id: String do return name.to_cmangle
+
+ # HTML default URL
+ #
+ # Should be redefined in clients.
+ fun html_url: String do return "person_{html_id}.html"
+
+ # Link to this person `html_url`
+ fun html_link: Link do return new Link(html_url, name)
+
+ redef fun to_html do
+ var tpl = new Template
+ tpl.addn "<span>"
+ var gravatar = self.gravatar
+ if gravatar != null then
+ tpl.addn "<img class='avatar' src='https://secure.gravatar.com/avatar/{gravatar}?size=14&default=retro' />"
+ end
+ tpl.addn html_link
+ tpl.addn "</span>"
+ return tpl.write_to_string
+ end
+end