-
Notifications
You must be signed in to change notification settings - Fork 0
CI_Typography
Typography Class
- Class name: CI_Typography
- Namespace:
public string $block_elements = 'address|blockquote|div|dl|fieldset|form|h\d|hr|noscript|object|ol|p|pre|script|table|ul'
Block level elements that should not be wrapped inside
tags
- Visibility: public
public string $skip_elements = 'p|pre|ol|ul|dl|object|table|h\d'
Elements that should not have
and
tags within them.
- Visibility: public
public string $inline_elements = 'a|abbr|acronym|b|bdo|big|br|button|cite|code|del|dfn|em|i|img|ins|input|label|map|kbd|q|samp|select|small|span|strong|sub|sup|textarea|tt|var'
Tags we want the parser to completely ignore when splitting the string.
- Visibility: public
public array $inner_block_required = array('blockquote')
array of block level elements that require inner content to be within another block level element
- Visibility: public
public string $last_block_element = ''
the last block element parsed
- Visibility: public
public boolean $protect_braced_quotes = FALSE
whether or not to protect quotes within { curly braces }
- Visibility: public
string CI_Typography::auto_typography($str, $reduce_linebreaks)
Auto Typography
This function converts text, making it typographically correct:
- Converts double spaces into paragraphs.
- Converts single line breaks into
tags - Converts single and double quotes into correctly facing curly quote entities.
- Converts three dots into ellipsis.
- Converts double dashes into em-dashes.
- Converts two spaces into entities
- Visibility: public
- $str mixed
- $reduce_linebreaks mixed
string CI_Typography::format_characters($str)
Format Characters
This function mainly converts double and single quotes to curly entities, but it also converts em-dashes, double spaces, and ampersands
- Visibility: public
- $str mixed
string CI_Typography::_format_newlines($str)
Format Newlines
Converts newline characters into either
tags or
- Visibility: protected
- $str mixed
string CI_Typography::_protect_characters($match)
Protect Characters
Protects special characters from being formatted later We don't want quotes converted within tags so we'll temporarily convert them to {@DQ} and {@SQ} and we don't want double dashes converted to emdash entities, so they are marked with {@DD} likewise double spaces are converted to {@NBS} to prevent entity conversion
- Visibility: protected
- $match mixed
string CI_Typography::nl2br_except_pre($str)
Convert newlines to HTML line breaks except within PRE tags
- Visibility: public
- $str mixed