Class Text_Highlighter_Renderer_Html
HTML renderer
Elements of $options argument of constructor (each being optional):
- 'numbers' - Line numbering style 0 or HL_NUMBERS_TABLE or HL_NUMBERS_UL or 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', // .... );
- Text_Highlighter_Renderer
- Text_Highlighter_Renderer_Array
- Text_Highlighter_Renderer_Html
Category: Text
Copyright: 2004-2006 Andrey Demenev
License: PHP License
Author: Andrey Demenev <demenev@gmail.com>
Version: Release: 0.7.1
Link: http://pear.php.net/package/Text_Highlighter
Located at x2engine/framework/vendors/TextHighlighter/Text/Highlighter/Renderer/Html.php
public
|
|
public
|
#
_getFullClassName( string $class )
Given a CSS class name, returns the class name with language name prepended, if necessary |
public
|
|
public
string
|
|
public
string
|
#
_getStyling( string $class, mixed $span_tag = true )
Returns |
acceptToken(),
getOutput(),
preprocess()
|
__construct(),
setCurrentLanguage()
|
public
integer
|
$_numbers | 0 |
#
Line numbering style |
public
integer
|
$_numbers_start | 0 |
#
For numberered lines - where to start |
public
integer
|
$_tabsize | 4 |
#
Tab size |
public
string
|
$_output | '' |
#
Highlighted code |
public
array
|
$_style_map | array() |
#
Mapping of keywords to formatting rules using inline styles |
public
array
|
$_class_map | array(
'main' => 'hl-main',
'table' => 'hl-table',
'gutter' => 'hl-gutter',
'brackets' => 'hl-brackets',
'builtin' => 'hl-builtin',
'code' => 'hl-code',
'comment' => 'hl-comment',
'default' => 'hl-default',
'identifier' => 'hl-identifier',
'inlinedoc' => 'hl-inlinedoc',
'inlinetags' => 'hl-inlinetags',
'mlcomment' => 'hl-mlcomment',
'number' => 'hl-number',
'quotes' => 'hl-quotes',
'reserved' => 'hl-reserved',
'special' => 'hl-special',
'string' => 'hl-string',
'url' => 'hl-url',
'var' => 'hl-var',
) |
#
Mapping of keywords to formatting rules using class names |
public
array
|
$_doclinks | array() |
#
Setup for links to online documentation |
$_enumerated,
$_htmlspecialchars
|
$_language,
$_options
|