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',
....
);
Показать файл
Открыть проект
Открытые свойства
Открытые методы
Метод |
Описание |
|
_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
_getFullClassName()
публичный Метод
Given a CSS class name, returns the class name
with language name prepended, if necessary
_getStyling()
публичный Метод
Returns class
and/or style
attribute,
optionally enclosed in a span
tag
finalize()
публичный Метод
Signals that no more tokens are available
Описание свойств
$_class_map публичное свойство
Mapping of keywords to formatting rules using class names
public array $_class_map |
Результат |
array |
|
$_doclinks публичное свойство
This is an array with keys:
- url, ex. http://php.net/%s
- target, ex. _blank, default - no target
- elements, default is array('reserved', 'identifier')
public array $_doclinks |
Результат |
array |
|
$_numbers публичное свойство
public int $_numbers |
Результат |
integer |
|
$_numbers_start публичное свойство
For numberered lines - where to start
public int $_numbers_start |
Результат |
integer |
|
$_output публичное свойство
public string $_output |
Результат |
string |
|
$_style_map публичное свойство
Mapping of keywords to formatting rules using inline styles
public array $_style_map |
Результат |
array |
|
$_tabsize публичное свойство
public int $_tabsize |
Результат |
integer |
|