PHP Class Text_Highlighter_Renderer_Html, yii

Elements of $options argument of constructor (each being optional): - 'numbers' - Line numbering style 0 or {@link HL_NUMBERS_TABLE} or {@link HL_NUMBERS_UL} or {@link HL_NUMBERS_OL} - 'numbers_start' - starting number for numbered lines - 'tabsize' - Tab size - 'style_map' - Mapping of keywords to formatting rules using inline styles - 'class_map' - Mapping of keywords to formatting rules using class names - 'doclinks' - array that has keys "url", "target" and "elements", used for generating links to online documentation - 'use_language' - class names will be prefixed with language, like "php-reserved" or "css-code" Example of setting documentation links: $options['doclinks'] = array( 'url' => 'http://php.net/%s', 'target' => '_blank', 'elements' => array('reserved', 'identifier') ); Example of setting class names map: $options['class_map'] = array( 'main' => 'my-main', 'table' => 'my-table', 'gutter' => 'my-gutter', 'brackets' => 'my-brackets', 'builtin' => 'my-builtin', 'code' => 'my-code', 'comment' => 'my-comment', 'default' => 'my-default', 'identifier' => 'my-identifier', 'inlinedoc' => 'my-inlinedoc', 'inlinetags' => 'my-inlinetags', 'mlcomment' => 'my-mlcomment', 'number' => 'my-number', 'quotes' => 'my-quotes', 'reserved' => 'my-reserved', 'special' => 'my-special', 'string' => 'my-string', 'url' => 'my-url', 'var' => 'my-var', ); Example of setting styles mapping: $options['style_map'] = array( 'main' => 'color: black', 'table' => 'border: 1px solid black', 'gutter' => 'background-color: yellow', 'brackets' => 'color: blue', 'builtin' => 'color: red', 'code' => 'color: green', 'comment' => 'color: orange', .... );
Inheritance: extends Text_Highlighter_Renderer_Array
Mostrar archivo Open project: yiisoft/yii

Public Properties

Property Type Description
$_class_map array Mapping of keywords to formatting rules using class names
$_doclinks array This is an array with keys: - url, ex. http://php.net/%s - target, ex. _blank, default - no target - elements, default is array('reserved', 'identifier')
$_numbers integer Line numbering style
$_numbers_start integer For numberered lines - where to start
$_output string Highlighted code
$_style_map array Mapping of keywords to formatting rules using inline styles
$_tabsize integer Tab size

Public Methods

Method Description
_decorate ( string $content, $key = false ) : string Provides additional formatting to a keyword
_getFullClassName ( string $class ) Given a CSS class name, returns the class name with language name prepended, if necessary
_getStyling ( string $class, $span_tag = true ) : string Returns class and/or style attribute, optionally enclosed in a span tag
finalize ( ) Signals that no more tokens are available
reset ( ) Resets renderer state

Method Details

_decorate() public method

Provides additional formatting to a keyword
public _decorate ( string $content, $key = false ) : string
$content string Keyword
return string Keyword with additional formatting

_getFullClassName() public method

Given a CSS class name, returns the class name with language name prepended, if necessary
public _getFullClassName ( string $class )
$class string Token class

_getStyling() public method

Returns class and/or style attribute, optionally enclosed in a span tag
public _getStyling ( string $class, $span_tag = true ) : string
$class string Class name
return string span tag or just a class and/or style attributes

finalize() public method

Signals that no more tokens are available
public finalize ( )

reset() public method

Resets renderer state
public reset ( )

Property Details

$_class_map public_oe property

Mapping of keywords to formatting rules using class names
public array $_class_map
return array

$_numbers public_oe property

Line numbering style
public int $_numbers
return integer

$_numbers_start public_oe property

For numberered lines - where to start
public int $_numbers_start
return integer

$_output public_oe property

Highlighted code
public string $_output
return string

$_style_map public_oe property

Mapping of keywords to formatting rules using inline styles
public array $_style_map
return array

$_tabsize public_oe property

Tab size
public int $_tabsize
return integer