Markdown::Parser::Element - Markdown Element Object Class
my $o = Markdown::Parser::Code->new; # or $doc->add_element( $o->create_code( @_ ) );
v0.2.1
This is the base class from which all other elements inherit.
Provided with an attributes definition string such as the one below, and this will parse it and set the corresponding classes and/or id for the element.
````` {.html #codeid} <b>bold</b> `````
Returns the current object for chaining.
Provided with an element object, and this will add it to the children stack.
my $bq = $doc->create_blockquote; $bq->add_element( $doc->create_text( "Hello world" ) );
It sets the "parent" value of the object to the current object.
my $bq = $doc->create_blockquote; my $txt = $doc->create_text( "Hello world" ); $txt->add_to( $bq );
Returns a string representation of the code formatted in markdown.
It returns a plain string.
Returns a string representation of the code formatted in pod.
Returns an html representation of the code.
Sets or gets the hash object used to contain the key-value pair for attributes.
Returns a Module::Generic::Hash object.
Alias for "attr"
Returns the computed base class for this object.
This is used to enable inheriting this class Module::Parser
Sets or get the array object containing all the element contained inside the object.
Returns a Module::Generic::Array object.
Read only. Returns the current class name for this object.
Returns the closest element within an object children elements which is either anything but not non-new line element or the one specified, if found
Create a Markdown::Parser::Abbr object and return it.
Create a Markdown::Parser::Blockquote object and return it.
Create a Markdown::Parser::Bold object and return it.
Create a Markdown::Parser::Checkbox object and return it.
Create a Markdown::Parser::Code object and return it.
Create a Markdown::Parser::Emphasis object and return it.
Create a Markdown::Parser::Footnote object and return it.
Create a Markdown::Parser::FootnoteReference object and return it.
Create a Markdown::Parser::Header object and return it.
Create a Markdown::Parser::HTML object and return it.
Create a Markdown::Parser::Image object and return it.
Create a Markdown::Parser::Insertion object and return it.
Create a Markdown::Parser::Line object and return it.
Create a Markdown::Parser::LinkDefinition object and return it.
Create a Markdown::Parser::Link object and return it.
Create a Markdown::Parser::List object and return it.
Create a Markdown::Parser::ListItem object and return it.
Create a Markdown::Parser::NewLine object and return it.
Create a Markdown::Parser::Paragraph object and return it.
Create a Markdown::Parser::StrikeThrough object and return it.
Create a Markdown::Parser::Subscript object and return it.
Create a Markdown::Parser::Superscript object and return it.
Create a Markdown::Parser::Table object and return it.
Create a Markdown::Parser::TableBody object and return it.
Create a Markdown::Parser::TableCaption object and return it.
Create a Markdown::Parser::TableCell object and return it.
Create a Markdown::Parser::TableColumn object and return it.
Create a Markdown::Parser::TableHeader object and return it.
Create a Markdown::Parser::TableRow object and return it.
Create a Markdown::Parser::Text object and return it.
Sets or gets the CSS::Object object.
Get a new CSS::Object with formater set to CSS::Object::Format::Inline
Remove all the children element and returns them as an array object (Module::Generic::Array object)
Sets or gets the dictionary hash object, which is a Module::Generic::Hash object.
It is used to contain word-definition pairs.
Sets or gets a Markdown::Parser::Document object.
Empty the object of any children.
Provided with an array reference of characters to encode and a string of text or a reference to a string of text, and this will encode those characters in their html entity equivalent. For example:
< => < < => > & => &
Returns the text encoded.
Returns an array object of link objects
Provided with attributes object (Module::Generic::Hash) such as set by "attr" and this will retur a new Module::Generic::Array object of attribute name-attribute value pairs.
If "class" is set, then this will return a formatted class attribute with the class separated by comma, otherwise it returns an empty string.
class
If "id" is set, then this will return a formatted id attribute with its value set to the "id" value, otherwise it returns an empty string.
id
Provided with a link id, and this will return its corresponding value.
Sets or gets an array reference of id attribute value.
Provided with an element and this will add it to the stack of elements, right after the current object.
Returns the element object being added for chaining.
Provided with an element and this will add it to the stack of elements, right before the current object.
Returns an array object of Markdown::Parser::Link objects.
Returns a HTML::TreeBuilder object with the proper parameters set. This means ignore_unknown set to false, store_comments set to true, no_space_compacting set to true, implicit_tags set to false, implicit set to true, and tighten set to false.
Returns the object reference id generated using "refaddr" in Scalar::Util
Returns the current object package name.
Sets or gets the parent object for the current object.
The value provided must be a subclass of Markdown::Parser::Element
Provided with some html data, and this will use a HTML::Object object to parse the data.
Returns the resulting HTML::Object::Document object, which inherits from HTML::Object::Element.
Sets or get the current cursor position in the string being parsed, as a Module::Generic::Number object.
Returns the current value.
Sets or gets the raw data found using regular expression and before any processing was made. This is used essentially for debugging.
The value is stored as a Module::Generic::Scalar object.
Provided with an element object, and this will look up within all its children if it exists, and if it does, will remove it.
It returns the object removed.
When no value is provided, ie. when called in void context, this method will remove the current object from its parent.
Remove all element objects contained.
Sets or gets the tag name value as a Module::Generic::Scalar object.
Provided with an element object to wrap, and this will wrap all current elements contained using the wrapping object.
For example:
my $bq = $doc->create_blockquote; $bq->add_element( $doc->create_text( "Hello world" ) ); # Hello world is now contained within the blockquotes # Now, wrap Hello world inside a paragraph $bq->wrap( $doc->create_paragraph ); # Data would now be <p>Hello world</p>
Provided with an element object, and this will ad it to the stack of children elements.
If the value provided is just a string, it will append it to the previous text element, if any, or create one
This private method is used to create various elements. It is called from methods like "create_paragraph".
It will automatically load the module if not already loaded and instantiate an object, setting the debug value same as our current object.
Markdown::Parser
Jacques Deguest <jack@deguest.jp>
Copyright (c) 2020 DEGUEST Pte. Ltd.
You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.
To install Markdown::Parser, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Markdown::Parser
CPAN shell
perl -MCPAN -e shell install Markdown::Parser
For more information on module installation, please visit the detailed CPAN module installation guide.