markdown2 :: MdHeading :: defaultinit
markdown2 :: MdHeading :: has_atx_trailing
Does this heading has an atx trailing in the original source?markdown2 :: MdHeading :: has_atx_trailing=
Does this heading has an atx trailing in the original source?markdown2 :: MdHeading :: is_setext=
Is this heading in the setext format in the original source?markdown2 :: markdown_html_rendering $ MdHeading :: render_html
Renderself
as HTML
markdown2 :: markdown_latex_rendering $ MdHeading :: render_latex
Renderself
as HTML
markdown2 :: markdown_man_rendering $ MdHeading :: render_man
Renderself
as Manpage format
markdown2 :: markdown_md_rendering $ MdHeading :: render_md
Renderself
as Markdown
markdown2 $ MdHeading :: 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.
core :: Object :: defaultinit
markdown2 :: MdBlock :: defaultinit
markdown2 :: MdNode :: defaultinit
markdown2 :: MdHeading :: defaultinit
markdown2 :: MdHeading :: has_atx_trailing
Does this heading has an atx trailing in the original source?markdown2 :: MdHeading :: has_atx_trailing=
Does this heading has an atx trailing in the original source?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 :: MdHeading :: is_setext=
Is this heading in the setext format in the original source?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 heading
class MdHeading
super MdBlock
# Heading level (from 1 to 6)
var level: Int
# Is this heading in the setext format in the original source?
var is_setext = false is optional
# Does this heading has an atx trailing in the original source?
var has_atx_trailing = false is optional
redef fun to_s_attrs do return "{super}, level={level}"
end
lib/markdown2/markdown_ast.nit:262,1--276,3
redef class MdHeading
redef fun render_html(v) do
v.add_line
if v.enable_heading_ids then
var id = self.id
if id == null then
id = v.strip_id(title)
v.headings[id] = self
self.id = id
end
v.add_raw "<h{level} id=\"{id}\">"
else
v.add_raw "<h{level}>"
end
visit_all(v)
v.add_raw "</h{level}>"
v.add_line
end
#
var id: nullable String = null
#
fun title: String do
var v = new RawTextVisitor
return v.render(self)
end
end
lib/markdown2/markdown_html_rendering.nit:227,1--254,3
redef class MdHeading
redef fun render_latex(v) do
var level = self.level
v.add_indent
v.add_line
if level == 1 then
v.add_raw "\\section\{"
else if level == 2 then
v.add_raw "\\subsection\{"
else if level == 3 then
v.add_raw "\\subsubsection\{"
else if level == 4 then
v.add_raw "\\paragraph\{"
else if level == 5 then
v.add_raw "\\subparagraph\{"
else
# use bold for level 6 headings
v.add_raw "\\textbf\{"
end
v.add_indent
visit_all(v)
v.add_raw "\}"
v.add_line
end
end
lib/markdown2/markdown_latex_rendering.nit:148,1--172,3
redef class MdHeading
redef fun render_man(v) do
var level = self.level
if level == 1 then
v.add ".SH "
else if level == 2 then
v.add ".SS "
else if level >= 3 then
# We use dictionary (titled paragraph) to simulate a 3rd level (or more)
v.add ".TP\n"
end
visit_all(v)
v.add_line
end
end
lib/markdown2/markdown_man_rendering.nit:92,1--107,3
redef class MdHeading
redef fun render_md(v) do
if is_setext then
visit_all(v)
var length_visitor = new TextLengthVisitor
length_visitor.enter_visit(self)
v.add_line
if level == 1 then
v.add_raw "=" * length_visitor.length
else
v.add_raw "-" * length_visitor.length
end
else
v.add_raw "#" * level
v.add_raw " "
visit_all(v)
if has_atx_trailing then
v.add_raw " "
v.add_raw "#" * level
end
end
v.add_line
end
end
lib/markdown2/markdown_md_rendering.nit:150,1--173,3