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',
....
);
Afficher le fichier
Open project: yiisoft/yii
Méthodes publiques
Méthodes publiques
Méthode |
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 méthode
Provides additional formatting to a keyword
_getFullClassName()
public méthode
Given a CSS class name, returns the class name
with language name prepended, if necessary
_getStyling()
public méthode
Returns class
and/or style
attribute,
optionally enclosed in a span
tag
finalize()
public méthode
Signals that no more tokens are available
Property Details
$_class_map public_oe property
Mapping of keywords to formatting rules using class names
public array $_class_map |
Résultat |
array |
|
$_doclinks public_oe property
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 |
Résultat |
array |
|
$_numbers public_oe property
public int $_numbers |
Résultat |
integer |
|
$_numbers_start public_oe property
For numberered lines - where to start
public int $_numbers_start |
Résultat |
integer |
|
$_output public_oe property
public string $_output |
Résultat |
string |
|
$_style_map public_oe property
Mapping of keywords to formatting rules using inline styles
public array $_style_map |
Résultat |
array |
|
$_tabsize public_oe property
public int $_tabsize |
Résultat |
integer |
|