Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
+redef class CmdEntityLink
+ redef fun to_html do
+ var mentity = self.mentity
+ if mentity == null then return ""
+ return mentity.html_link(text, title).write_to_string
+ end
+end
+
redef class CmdEntityCode
redef fun to_html do
var output = render_code(node)
redef class CmdEntityCode
redef fun to_html do
var output = render_code(node)
print_html cmd.to_html
end
print_html cmd.to_html
end
+ fun test_cmd_link is test do
+ var cmd = new CmdEntityLink(test_view, mentity_name = "test_prog::Character")
+ cmd.init_command
+ print_html cmd.to_html
+ end
+
# CmdInheritance
fun test_cmd_parents is test do
# CmdInheritance
fun test_cmd_parents is test do
--- /dev/null
+<a href="test_prog_58d_58dCharacter" title="Characters can be played by both the human or the machine.">Character</a>
#
# You should redefine this method depending on the organization or your
# output.
#
# You should redefine this method depending on the organization or your
# output.
- fun html_link: Link do
- var title = null
+ fun html_link(text, title: nullable String): Link do
+ if text == null then
+ text = html_name
+ end
var mdoc = self.mdoc_or_fallback
var mdoc = self.mdoc_or_fallback
+ if title == null and mdoc != null then
title = mdoc.synopsis.html_escape
end
title = mdoc.synopsis.html_escape
end
- return new Link(html_url, html_name, title)
+ return new Link(html_url, text, title)
end
# Returns the complete MEntity declaration decorated with HTML
end
# Returns the complete MEntity declaration decorated with HTML
end
redef class MVirtualTypeProp
end
redef class MVirtualTypeProp
- redef fun html_link do return mvirtualtype.html_link
+ redef fun html_link(text, title) do return mvirtualtype.html_link(text, title)
end
redef class MVirtualTypeDef
end
redef class MVirtualTypeDef
end
redef class MClassType
end
redef class MClassType
- redef fun html_link do return mclass.html_link
+ redef fun html_link(text, title) do return mclass.html_link(text, title)
end
redef class MNullableType
end
redef class MNullableType
end
redef class MParameterType
end
redef class MParameterType
- redef fun html_link do
- return new Link("{mclass.html_url}#FT_{name.to_cmangle}", name, "formal type")
+ redef fun html_link(text, title) do
+ if text == null then text = name
+ if title == null then title = "formal type"
+ return new Link("{mclass.html_url}#FT_{name.to_cmangle}", text, title)
end
end
redef class MVirtualType
end
end
redef class MVirtualType
- redef fun html_link do return mproperty.intro.html_link
+ redef fun html_link(text, title) do return mproperty.intro.html_link(text, title)
end
redef class MSignature
end
redef class MSignature