Decorator for span elements.

Because inline comments can appear as span elements, InlineDecorator do not decorate things like paragraphs or headers.

Introduced properties

Redefined properties

redef type SELF: InlineDecorator

nitc $ InlineDecorator :: SELF

Type of this instance, automatically specialized in every class
redef fun add_code(v: PROCESSOR, block: BlockCode)

nitc $ InlineDecorator :: add_code

Render a code or fence block.
redef fun add_headline(v: PROCESSOR, block: BlockHeadline)

nitc $ InlineDecorator :: add_headline

Render a headline block with corresponding level.
redef fun add_paragraph(v: PROCESSOR, block: BlockParagraph)

nitc $ InlineDecorator :: add_paragraph

Render a paragraph block.

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type PROCESSOR: MarkdownProcessor

markdown :: Decorator :: PROCESSOR

Kind of processor used
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
private var _catalog: Catalog

nitc :: NitdocDecorator :: _catalog

The registered catalog
private var _current_mdoc: nullable MDoc

nitc :: NitdocDecorator :: _current_mdoc

The currently processed mdoc.
abstract fun add_abbr(v: PROCESSOR, name: Text, comment: Text)

markdown :: Decorator :: add_abbr

Render an abbreviation.
abstract fun add_blockquote(v: PROCESSOR, block: BlockQuote)

markdown :: Decorator :: add_blockquote

Render a blockquote.
fun add_char(v: PROCESSOR, c: Char)

markdown :: Decorator :: add_char

Render a single plain char.
abstract fun add_code(v: PROCESSOR, block: BlockCode)

markdown :: Decorator :: add_code

Render a code or fence block.
abstract fun add_em(v: PROCESSOR, text: Text)

markdown :: Decorator :: add_em

Render an emphasis text.
abstract fun add_headline(v: PROCESSOR, block: BlockHeadline)

markdown :: Decorator :: add_headline

Render a headline block with corresponding level.
abstract fun add_image(v: PROCESSOR, link: Text, name: Text, comment: nullable Text)

markdown :: Decorator :: add_image

Render an image.
abstract fun add_line_break(v: PROCESSOR)

markdown :: Decorator :: add_line_break

Render a line break
abstract fun add_listitem(v: PROCESSOR, block: BlockListItem)

markdown :: Decorator :: add_listitem

Render a list item.
abstract fun add_orderedlist(v: PROCESSOR, block: BlockOrderedList)

markdown :: Decorator :: add_orderedlist

Render an ordered list.
abstract fun add_paragraph(v: PROCESSOR, block: BlockParagraph)

markdown :: Decorator :: add_paragraph

Render a paragraph block.
abstract fun add_ruler(v: PROCESSOR, block: BlockRuler)

markdown :: Decorator :: add_ruler

Render a ruler block.
abstract fun add_span_code(v: PROCESSOR, buffer: Text, from: Int, to: Int)

markdown :: Decorator :: add_span_code

Render a code span reading from a buffer.
abstract fun add_strike(v: PROCESSOR, text: Text)

markdown :: Decorator :: add_strike

Render a strike text.
abstract fun add_strong(v: PROCESSOR, text: Text)

markdown :: Decorator :: add_strong

Render a strong text.
abstract fun add_unorderedlist(v: PROCESSOR, block: BlockUnorderedList)

markdown :: Decorator :: add_unorderedlist

Render an unordered list.
private fun allowed_id_chars=(allowed_id_chars: Array[Char])

markdown :: HTMLDecorator :: allowed_id_chars=

abstract fun append_code(v: PROCESSOR, buffer: Text, from: Int, to: Int)

markdown :: Decorator :: append_code

Render code text from buffer and escape it.
abstract fun append_value(v: PROCESSOR, value: Text)

markdown :: Decorator :: append_value

Render a text and escape it.
fun catalog: Catalog

nitc :: NitdocDecorator :: catalog

The registered catalog
protected fun catalog=(catalog: Catalog)

nitc :: NitdocDecorator :: catalog=

The registered catalog
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
private fun code_from_text(buffer: Text, from: Int, to: Int): String

nitc :: NitdocDecorator :: code_from_text

fun current_mdoc: nullable MDoc

nitc :: NitdocDecorator :: current_mdoc

The currently processed mdoc.
protected fun current_mdoc=(current_mdoc: nullable MDoc)

nitc :: NitdocDecorator :: current_mdoc=

The currently processed mdoc.
abstract fun escape_char(v: PROCESSOR, char: Char)

markdown :: Decorator :: escape_char

Render a character escape.
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
abstract fun headlines: ArrayMap[String, HeadLine]

markdown :: Decorator :: headlines

Found headlines during the processing labeled by their ids.
protected fun headlines=(headlines: ArrayMap[String, HeadLine])

markdown :: HTMLDecorator :: headlines=

init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
abstract fun strip_id(txt: String): String

markdown :: Decorator :: strip_id

Generate a new html valid id from a String.
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
private fun toolcontext=(toolcontext: ToolContext)

nitc :: NitdocDecorator :: toolcontext=

package_diagram nitc::InlineDecorator InlineDecorator nitc::NitdocDecorator NitdocDecorator nitc::InlineDecorator->nitc::NitdocDecorator markdown::HTMLDecorator HTMLDecorator nitc::NitdocDecorator->markdown::HTMLDecorator ...markdown::HTMLDecorator ... ...markdown::HTMLDecorator->markdown::HTMLDecorator nitc::CmdInlineDecorator CmdInlineDecorator nitc::CmdInlineDecorator->nitc::InlineDecorator

Ancestors

interface Decorator

markdown :: Decorator

A Decorator is used to emit mardown into a specific format.
class HTMLDecorator

markdown :: HTMLDecorator

Decorator that outputs HTML.
interface Object

core :: Object

The root of the class hierarchy.

Parents

class NitdocDecorator

nitc :: NitdocDecorator

The specific markdown decorator used internally to process MDoc object.

Children

class CmdInlineDecorator

nitc :: CmdInlineDecorator

Same as InlineDecorator but with wikilink commands handling

Class definitions

nitc $ InlineDecorator
# Decorator for span elements.
#
# Because inline comments can appear as span elements,
# InlineDecorator do not decorate things like paragraphs or headers.
class InlineDecorator
	super NitdocDecorator

	redef fun add_paragraph(v, block) do
		v.emit_in block
	end

	redef fun add_headline(v, block) do
		# save headline
		var line = block.block.first_line
		if line == null then return
		var txt = line.value
		var id = strip_id(txt)
		var lvl = block.depth
		headlines[id] = new HeadLine(id, txt, lvl)

		v.emit_in block
	end

	redef fun add_code(v, block) do
		# Try to parse code
		var ast = toolcontext.parse_something(block.block.text.to_s)
		if ast isa AError then
			v.add "<code>"
			v.emit_in block
			v.add "</code>"
			return
		end
		v.add "<code class=\"nitcode\">"
		var hl = new HtmlightVisitor
		hl.highlight_node(ast)
		v.add(hl.html)
		v.add "</code>"
	end
end
src/doc/templates/html_model.nit:514,1--552,3