markdown2 :: MarkdownRenderer :: add_indent
Add an indentation depending onident
level
markdown2 :: MarkdownRenderer :: in_quote=
Are we currently in a blockquote?markdown2 $ MarkdownRenderer :: SELF
Type of this instance, automatically specialized in every classmarkdown2 :: MarkdownRenderer :: add_indent
Add an indentation depending onident
level
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
markdown2 :: MdRenderer :: defaultinit
markdown2 :: MdVisitor :: defaultinit
core :: Object :: defaultinit
markdown2 :: MarkdownRenderer :: in_quote=
Are we currently in a blockquote?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.
core :: Object :: output_class_name
Display class name on stdout (debug only).
# Markdown document renderer to Markdown
class MarkdownRenderer
super MdRenderer
# Markdown output under construction
private var md: Buffer is noinit
# Render `node` as Markdown
redef fun render(node) do
reset
enter_visit(node)
return md.write_to_string
end
redef fun visit(node) do node.render_md(self)
# Reset internal state
fun reset do
md = new Buffer
end
# Current indentation level
private var indent = 0
# Are we currently in a blockquote?
var in_quote = 0
# Add a `md` string to the output
fun add_raw(md: String) do self.md.append(md)
# Add a blank line to the output
fun add_line do add_raw "\n"
# Add an indentation depending on `ident` level
fun add_indent do
add_raw " " * indent
end
end
lib/markdown2/markdown_md_rendering.nit:22,1--59,3