markdown2 :: MdNode :: defaultinit
markdown2 :: MdNode :: location=
Node location in original markdownmarkdown2 :: MdNode :: post_process
Accept the visit of aMdPostProcessor
markdown2 :: MdNode :: render_raw_text
Renderself
as raw text
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Object :: defaultinit
markdown2 :: MdNode :: defaultinit
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
# An abstract node
abstract class MdNode
# Node location in original markdown
var location: MdLocation
# Node parent
var parent: nullable MdNode = null is writable
# First child
var first_child: nullable MdNode = null is writable
# Last child
var last_child: nullable MdNode = null is writable
# Previous node
var prev: nullable MdNode = null is writable
# Next node
var next: nullable MdNode = null is writable
# Children nodes of `self`
fun children: Array[MdNode] do
var nodes = new Array[MdNode]
var node = first_child
while node != null do
nodes.add node
node = node.next
end
return nodes
end
# Append a child to `self`
fun append_child(child: MdNode) do
child.unlink
child.parent = self
if last_child != null then
last_child.as(not null).next = child
child.prev = last_child
last_child = child
else
first_child = child
last_child = child
end
end
# Prepend a child to `self`
fun prepend_child(child: MdNode) do
child.unlink
child.parent = self
if first_child != null then
first_child.as(not null).prev = child
child.next = first_child
first_child = child
else
first_child = child
last_child = child
end
end
# Unlink `self` from its `parent`
fun unlink do
if prev != null then
prev.as(not null).next = next
else if parent != null then
parent.as(not null).first_child = next
end
if next != null then
next.as(not null).prev = prev
else if parent != null then
parent.as(not null).last_child = prev
end
parent = null
next = null
prev = null
end
# Insert `sibling` after `self`.
fun insert_after(sibling: MdNode) do
sibling.unlink
sibling.next = next
if sibling.next != null then
sibling.next.as(not null).prev = sibling
end
sibling.prev = self
next = sibling
sibling.parent = parent
if sibling.next == null then
sibling.parent.as(not null).last_child = sibling
end
end
# Insert `sibling` before `self`.
fun insert_before(sibling: MdNode) do
sibling.unlink
sibling.prev = prev
if sibling.prev != null then
sibling.prev.as(not null).next = sibling
end
sibling.next = self
prev = sibling
sibling.parent = parent
if sibling.prev == null then
sibling.parent.as(not null).first_child = sibling
end
end
# Visit all children or `self`
fun visit_all(v: MdVisitor) do
var node = first_child
while node != null do
var next = node.next
v.visit(node)
node = next
end
end
redef fun to_s do return "{super}\{{to_s_attrs}\}"
# Returns `self` attributes as a String
#
# Mainly used for debug purposes.
fun to_s_attrs: String do return "loc: {location}"
# Print `self` AST
fun debug do
var v = new MdASTPrinter
v.enter_visit(self)
end
end
lib/markdown2/markdown_ast.nit:18,1--149,3
redef class MdNode
# Return `self` as raw text
fun raw_text: String do
var v = new RawTextVisitor
return v.render(self)
end
# Render `self` as raw text
fun render_raw_text(v: RawTextVisitor) do visit_all(v)
end
lib/markdown2/markdown_rendering.nit:47,1--57,3
redef class MdNode
# Accept the visit of a `MdPostProcessor`
fun post_process(v: MdPostProcessor) do visit_all(v)
end
lib/markdown2/markdown_block_parsing.nit:1387,1--1391,3
redef class MdNode
# Render `self` as HTML
fun render_html(v: HtmlRenderer) do visit_all(v)
end
lib/markdown2/markdown_html_rendering.nit:182,1--186,3
redef class MdNode
# Render `self` as HTML
fun render_latex(v: LatexRenderer) do visit_all(v)
end
lib/markdown2/markdown_latex_rendering.nit:113,1--117,3
redef class MdNode
# Render `self` as Manpage format
fun render_man(v: ManRenderer) do visit_all(v)
end
lib/markdown2/markdown_man_rendering.nit:54,1--58,3
redef class MdNode
# Render `self` as Markdown
fun render_md(v: MarkdownRenderer) do visit_all(v)
private fun process_len(v: TextLengthVisitor) do visit_all(v)
end
lib/markdown2/markdown_md_rendering.nit:69,1--75,3