Textile formatting class.
Textile formatting class.
This class transforms input text in textile format into valid XHTML strict.
The Textile class has several attributes to control the behaviour of the engine.
line-folding: Boolean indicating whether to enable line folding (enabled by default). In line folding mode, you can include newline characters in your input text. These newlines will not be used as line wraps. If line folding is off, every newline in the input text is treated as the start of a new block. This setting is compatible with other Textile implementations.The above attributes can be queried and set using the standard AnewtContainer::get and AnewtContainer::set methods.
process($text) ¶Processes the text.
This method will transform the input text into XHTML, thereby converting headers, paragraphs, lists, block quotes and other block elements into their corresponding XHTML tags. Hyperlinks, inline markup (like emphasized or strong words), images and code is also converted. Additionally, several typographic enhancements are made to inline text (curly quotes, em dashes, entity replacements, etc).
$textInput text in Textile format
Processed text in XHTML format
_normalize_text($text) [private] ¶Normalize text by cleaning up newlines and whitespace.
$textThe text string to normalize
Normalized string
_split_into_blocks($text) [private] ¶Splits text into blocks.
The input text is split into blocks that can be separately formatted. Both line folded and non-line folded text is handled, as well as lists, tables en pre-formatted code.
$textText to split into blocks
An array containing all blocks
_parse_block($text) [private] ¶Parse a block of text with optional modifiers.
$textA block of text
Associative array containing all block properties (or default values)
_parse_list($text) [private] ¶Parse a block of text into a list structure.
If this block is not a list NULL is returned.
$textThe text to parse into a list.
_process_block($text) [private] ¶Process a single block of text.
This method detects the type of block and formats it accordingly. It detects headers, paragraphs, block quotes, lists, tables and preformatted code.
$textThe input text, e.g. obtained using from _split_into_blocks.
XHTML-formatted output
_build_html_block_element($tag_name, $parsed_block) [private] ¶Build a block level HTML element with the specified properties.
$tag_nameThe name of the XHTML tag that should be created. Only a few block-level tags can be handled.
$parsed_blockA parsed block
XHTML snippet as a string
_format_paragraph($parsed_block) [private] ¶Formats a single paragraph.
This method will format a paragraph, processing several optional markup attributes.
$parsed_blockA parsed block
_format_blockquote($parsed_block) [private] ¶Format a block quote.
$parsed_blockA parsed block instance
Blockquote HTML for this block.
_format_header($parsed_block) [private] ¶Formats a header block.
This method will format a paragraph, processing several optional markup attributes.
$parsed_blockA parsed block
_format_list($items, $type=null) [private] ¶Format a list block.
_format_inline($inline) [private] ¶Format inline text.
$_saved_block_modifiers [private] ¶The block modifiers used in block continuation mode, if enabled.
AnewtContainer::_to_array()AnewtContainer::_add()AnewtContainer::delete()AnewtContainer::get()AnewtContainer::_isset()AnewtContainer::_seed()AnewtContainer::setdefault()AnewtContainer::getdefault()AnewtContainer::set()AnewtContainer::__isset()AnewtContainer::__set()AnewtContainer::__construct()AnewtContainer::is_set()AnewtContainer::add()AnewtContainer::_getdefault()AnewtContainer::__unset()AnewtContainer::seed()AnewtContainer::to_array()AnewtContainer::_get()AnewtContainer::__get()AnewtContainer::keys()AnewtContainer::clear()AnewtContainer::_keys()AnewtContainer::_set()