Class MaRuKu::MDElement
In: lib/maruku.rb
lib/maruku/ext/div.rb
lib/maruku/ext/math/elements.rb
lib/maruku/toc.rb
lib/maruku/inspect_element.rb
lib/maruku/output/to_s.rb
lib/maruku/element.rb
lib/maruku/defaults.rb
Parent: Object

Rather than having a separate class for every possible element, Maruku has a single {MDElement} class that represents eveything in the document (paragraphs, headers, etc). The type of each element is available via \{node_type}.

Methods

Included Modules

MaRuKu Out::Markdown Out::HTML Out::Latex Strings Helpers Errors

Constants

INSPECT_FORMS = { :paragraph => ["par", :children], :footnote_reference => ["foot_ref", :footnote_id], :entity => ["entity", :entity_name], :email_address => ["email", :email], :inline_code => ["code", :raw_code], :raw_html => ["html", :raw_html], :emphasis => ["em", :children], :strong => ["strong", :children], :immediate_link => ["url", :url], :image => ["image", :children, :ref_id], :im_image => ["im_image", :children, :url, :title], :link => ["link", :children, :ref_id], :im_link => ["im_link", :children, :url, :title], :ref_definition => ["ref_def", :ref_id, :url, :title], :ial => ["ial", :ial], :li => ["li", :children, :want_my_paragraph]

Attributes

al  [RW]  An attribute list. May not be nil.

@return [AttributeList]

attributes  [RW]  The processed attributes.

For the {Maruku document root}, this contains properties listed at the beginning of the document. The properties will be downcased and any spaces will be converted to underscores. For example, if you write in the source document:

    !!!text
    Title: test document
    My property: value

    content content

Then \{attributes} will return:

    {:title => "test document", :my_property => "value"}

@return [{Symbol => String}]

children  [RW]  The child nodes of this element.

@return [Array<String or MDElement>]

doc  [RW]  The root element of the document to which this element belongs.

@return [Maruku]

meta_priv  [RW]  @private
node_type  [RW]  The type of this node (e.g. `:quote`, `:image`, `:abbr`). See {Helpers} for a list of possible values.

@return [Symbol]

Public Class methods

Public Instance methods

Iterates through each {MDElement} child node of this element. This includes deeply-nested child nodes. If `e_node_type` is specified, only yields nodes of that type.

Generate an id for headers. Assumes @children is set.

Outputs the document AST as calls to document helpers. (this should be `eval`-able to get a copy of the original element).

Iterates through each String child node of this element, replacing it with the result of the block. This includes deeply-nested child nodes.

This destructively modifies this node and its children.

@todo Make this non-destructive

Strips all formatting from the string

[Validate]