PHP Класс 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', .... );
Автор: Andrey Demenev ([email protected])
Наследование: extends Text_Highlighter_Renderer_Array
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$_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

Открытые методы

Метод Описание
_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

Описание методов

_decorate() публичный Метод

Provides additional formatting to a keyword
public _decorate ( string $content, $key = false ) : string
$content string Keyword
Результат string Keyword with additional formatting

_getFullClassName() публичный Метод

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

_getStyling() публичный Метод

Returns class and/or style attribute, optionally enclosed in a span tag
public _getStyling ( string $class, $span_tag = true ) : string
$class string Class name
Результат string span tag or just a class and/or style attributes

finalize() публичный Метод

Signals that no more tokens are available
public finalize ( )

reset() публичный Метод

Resets renderer state
public reset ( )

Описание свойств

$_class_map публичное свойство

Mapping of keywords to formatting rules using class names
public array $_class_map
Результат array

$_numbers публичное свойство

Line numbering style
public int $_numbers
Результат integer

$_numbers_start публичное свойство

For numberered lines - where to start
public int $_numbers_start
Результат integer

$_output публичное свойство

Highlighted code
public string $_output
Результат string

$_style_map публичное свойство

Mapping of keywords to formatting rules using inline styles
public array $_style_map
Результат array

$_tabsize публичное свойство

Tab size
public int $_tabsize
Результат integer