nitc :: CardCode :: defaultinit
# A card that displays the code of a MEntity
class CardCode
super CardMEntity
autoinit(mentity, node)
# AST node to display in this card
var node: nullable ANode is writable
redef var id = "code_{super}" is lazy
redef var title = "Code"
redef fun rendering do
addn "<div id='{id}' class='card'>"
addn " <div class='card-body'>"
if node != null then
addn "<pre>"
render_code
addn "</pre>"
end
addn "<span class='text-muted'>{mentity.location}</span>"
addn " </div>"
addn "</div>"
end
private fun render_code do
var node = self.node
if node == null then return
var hl = new HtmlightVisitor
hl.show_infobox = false
hl.highlight_node node
addn hl.html
end
end
src/doc/static/static_cards.nit:387,1--421,3