AnewtTextile class

Textile formatting class.

Class Overview

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.

The above attributes can be queried and set using the standard AnewtContainer::get and AnewtContainer::set methods.

Public Methods

AnewtTextile()

Constructor method.

Initialises the default settings.

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).

Parameters

$text

Input text in Textile format

Return value

Processed text in XHTML format

Private Methods

_normalize_text($text) [private]

Normalize text by cleaning up newlines and whitespace.

Parameters

$text

The text string to normalize

Return value

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.

Parameters

$text

Text to split into blocks

Return value

An array containing all blocks

_parse_block($text) [private]

Parse a block of text with optional modifiers.

Parameters

$text

A block of text

Return value

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.

Parameters

$text

The 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.

Parameters

$text

The input text, e.g. obtained using from _split_into_blocks.

Return value

XHTML-formatted output

_build_html_block_element($tag_name, $parsed_block) [private]

Build a block level HTML element with the specified properties.

Parameters

$tag_name

The name of the XHTML tag that should be created. Only a few block-level tags can be handled.

$parsed_block

A parsed block

Return value

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.

Parameters

$parsed_block

A parsed block

_format_blockquote($parsed_block) [private]

Format a block quote.

Parameters

$parsed_block

A parsed block instance

Return value

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.

Parameters

$parsed_block

A parsed block

_format_list($items, $type=null) [private]

Format a list block.

_format_inline($inline) [private]

Format inline text.

Private Attributes

$_saved_block_modifiers [private]

The block modifiers used in block continuation mode, if enabled.

Inheritance

Base Classes

Inherited members