markdown2 $ MdCodeBlock :: SELF
Type of this instance, automatically specialized in every classmarkdown2 :: markdown_html_rendering $ MdCodeBlock :: render_html
Renderself
as HTML
markdown2 :: markdown_man_rendering $ MdCodeBlock :: render_man
Renderself
as Manpage format
markdown2 $ MdCodeBlock :: to_s_attrs
Returnsself
attributes as a String
markdown2 :: MdBlock :: can_contain
Can this block containblock
?
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
markdown2 :: MdNode :: defaultinit
markdown2 :: MdBlock :: defaultinit
markdown2 :: MdCodeBlock :: defaultinit
core :: Object :: defaultinit
markdown2 :: MdBlock :: is_container=
Can this block contain other blocks?core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
markdown2 :: MdNode :: location=
Node location in original markdowncore :: Object :: output_class_name
Display class name on stdout (debug only).markdown2 :: MdNode :: post_process
Accept the visit of aMdPostProcessor
markdown2 :: MdNode :: render_raw_text
Renderself
as raw text
# A block of code (indented or fenced)
abstract class MdCodeBlock
super MdBlock
# Literal content
var literal: nullable String = null is writable
# Fence info / meta
var info: nullable String = null is writable
redef fun to_s_attrs do return "{super}, info={info or else "null"}, literal={literal or else "null"}"
end
lib/markdown2/markdown_ast.nit:223,1--234,3
redef class MdCodeBlock
redef fun render_html(v) do
var info = self.info
v.add_line
v.add_raw "<pre>"
v.add_raw "<code"
if info != null and not info.is_empty then
v.add_raw " class=\"language-{info.split(" ").first}\""
end
v.add_raw ">"
var literal = self.literal or else ""
var lines = literal.split("\n")
for i in [0..lines.length[ do
var line = lines[i]
v.add_raw v.html_escape(line, false)
if i < lines.length - 1 then
v.add_raw "\n"
end
end
v.add_raw "</code>"
v.add_raw "</pre>"
v.add_line
end
end
lib/markdown2/markdown_html_rendering.nit:202,1--225,3
redef class MdCodeBlock
redef fun render_man(v) do
v.add ".RS\n.nf\n\\f[C]"
v.add_line
var literal = self.literal
if literal != null then
var lines = literal.split("\n")
for i in [0 .. lines.length[ do
if i == lines.length - 1 then break
var line = lines[i]
v.add_code line
v.add_line
end
end
v.add "\\f[]\n.fi\n.RE"
v.add_line
end
end
lib/markdown2/markdown_man_rendering.nit:71,1--90,3