MediaWiki REL1_30
|
Static Public Member Functions | |
static | buildHeadItem ( $geshi) |
Backward-compatibility shim for extensions. | |
static | getPygmentizePath () |
static | highlight ( $code, $lang=null, $args=[]) |
Highlight a code-block using a particular lexer. | |
static | onApiFormatHighlight (IContextSource $context, $text, $mime, $format) |
Hook to provide syntax highlighting for API pretty-printed output. | |
static | onContentGetParserOutput (Content $content, Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output) |
Hook into Content::getParserOutput to provide syntax highlighting for script content. | |
static | onParserFirstCallInit (Parser &$parser) |
Register parser hook. | |
static | onResourceLoaderRegisterModules (&$resourceLoader) |
Conditionally register resource loader modules that depends on the VisualEditor MediaWiki extension. | |
static | parserHook ( $text, $args=[], $parser) |
Parser hook. | |
static | prepare ( $text, $lang) |
Backward-compatibility shim for extensions. | |
Static Protected Member Functions | |
static | parseHighlightLines ( $lineSpec) |
Take an input specifying a list of lines to highlight, returning a raw list of matching line numbers. | |
static | validHighlightRange ( $start, $end) |
Validate a provided input range. | |
Static Private Member Functions | |
static | getLexer ( $lang) |
Get the Pygments lexer name for a particular language. | |
static | makeCacheKey ( $code, $lexer, $options) |
Construct a cache key for the results of a Pygments invocation. | |
Static Private Attributes | |
static array | $mimeLexers |
Mapping of MIME-types to lexer names. | |
Definition at line 23 of file SyntaxHighlight.class.php.
|
static |
Backward-compatibility shim for extensions.
GeSHi | $geshi |
Definition at line 547 of file SyntaxHighlight.class.php.
References wfDeprecated().
|
staticprivate |
Get the Pygments lexer name for a particular language.
string | $lang | Language name. |
Definition at line 51 of file SyntaxHighlight.class.php.
References $lang, and SyntaxHighlightGeSHiCompat\getGeSHiToPygmentsMap().
Referenced by highlight().
|
static |
Definition at line 185 of file SyntaxHighlight.class.php.
|
static |
Highlight a code-block using a particular lexer.
string | $code | Code to highlight. |
string | null | $lang | Language name, or null to use plain markup. |
array | $args | Associative array of additional arguments. If it contains a 'line' key, the output will include line numbers. If it includes a 'highlight' key, the value will be parsed as a comma-separated list of lines and line-ranges to highlight. If it contains a 'start' key, the value will be used as the line at which to start highlighting. If it contains a 'inline' key, the output will not be wrapped in <div><pre/></div> . |
Definition at line 211 of file SyntaxHighlight.class.php.
References $args, $cache, $code, $lang, $lines, $options, $output, $pre, $type, getLexer(), highlight(), makeCacheKey(), parseHighlightLines(), and wfWarn().
Referenced by highlight(), onApiFormatHighlight(), onContentGetParserOutput(), and parserHook().
|
staticprivate |
Construct a cache key for the results of a Pygments invocation.
string | $code | Code to be highlighted. |
string | $lexer | Lexer name. |
array | $options | Options array. |
Definition at line 338 of file SyntaxHighlight.class.php.
References $options, and wfGlobalCacheKey().
Referenced by highlight().
|
static |
Hook to provide syntax highlighting for API pretty-printed output.
IContextSource | $context | |
string | $text | |
string | $mime | |
string | $format |
Definition at line 462 of file SyntaxHighlight.class.php.
References $context, $mime, $out, $output, and highlight().
|
static |
Hook into Content::getParserOutput to provide syntax highlighting for script content.
Definition at line 406 of file SyntaxHighlight.class.php.
References $options, $out, $output, $wgParser, $wgTextModelsToParse, ContentHandler\getContentText(), ExtensionRegistry\getInstance(), Content\getModel(), and highlight().
|
static |
Register parser hook.
$parser | Parser |
Definition at line 87 of file SyntaxHighlight.class.php.
References $parser.
|
static |
Conditionally register resource loader modules that depends on the VisualEditor MediaWiki extension.
ResourceLoader | $resourceLoader |
Definition at line 494 of file SyntaxHighlight.class.php.
References $resourceLoader, and ExtensionRegistry\getInstance().
|
staticprotected |
Take an input specifying a list of lines to highlight, returning a raw list of matching line numbers.
Input is comma-separated list of lines or line ranges.
string | $lineSpec |
Definition at line 357 of file SyntaxHighlight.class.php.
References $lines, $value, and list.
Referenced by highlight().
|
static |
Parser hook.
string | $text | |
array | $args | |
Parser | $parser |
MWException |
Definition at line 102 of file SyntaxHighlight.class.php.
References $args, $out, $parser, $wgUseTidy, and highlight().
|
static |
Backward-compatibility shim for extensions.
Definition at line 536 of file SyntaxHighlight.class.php.
References $lang, and wfDeprecated().
|
staticprotected |
Validate a provided input range.
$start | |
$end |
Definition at line 385 of file SyntaxHighlight.class.php.
|
staticprivate |
Mapping of MIME-types to lexer names.
Definition at line 39 of file SyntaxHighlight.class.php.