return "<pre>{command}</pre>"
end
end
+
+# Misc
+
+redef class CmdHtmlightVisitor
+ redef fun hrefto(mentity) do
+ if mentity isa MClassDef then return mentity.mclass.html_url
+ if mentity isa MPropDef then return mentity.mproperty.html_url
+ return mentity.html_url
+ end
+end
fun render_code(node: nullable ANode): nullable Writable do
if node == null then return null
if format == "html" then
- var hl = new HtmlightVisitor
+ var hl = new CmdHtmlightVisitor
+ hl.show_infobox = false
hl.highlight_node node
return hl.html
else if format == "ansi" then
end
end
+# Custom HtmlightVisitor for commands
+#
+# We create a new subclass so its behavior can be refined in clients without
+# breaking the main implementation.
+class CmdHtmlightVisitor
+ super HtmlightVisitor
+end
+
# Cmd that finds the source code related to an `mentity`
class CmdEntityCode
super CmdEntity