module commands_model
import commands_base
-
-import model::model_collect
import modelize
-import modelbuilder
-import htmlight
# Retrieve the MDoc related to a MEntity
class CmdComment
var format = "raw" is optional, writable
# Render `node` depending on the selected `format`
- fun render_code(node: nullable ANode): nullable Writable do
- if node == null then return null
- if format == "html" then
- var hl = new CmdHtmlightVisitor
- hl.show_infobox = false
- hl.highlight_node node
- return hl.html
- else if format == "ansi" then
- var hl = new AnsiHighlightVisitor
- hl.highlight_node node
- return hl.result
- end
+ fun render_code(node: ANode): Writable do
return node.location.text
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