MediaWiki REL1_31
SyntaxHighlight.php File Reference

Go to the source code of this file.

Classes

class  SyntaxHighlight
 

Functions

static buildHeadItem ( $geshi)
 Backward-compatibility shim for extensions.
 
static makeCacheKeyHash ( $code, $lexer, $options)
 Construct a cache key for the results of a Pygments invocation.
 
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 onResourceLoaderRegisterModules (&$resourceLoader)
 Conditionally register resource loader modules that depends on the VisualEditor MediaWiki extension.
 
static parseHighlightLines ( $lineSpec)
 Take an input specifying a list of lines to highlight, returning a raw list of matching line numbers.
 
static prepare ( $text, $lang)
 Backward-compatibility shim for extensions.
 
static validHighlightRange ( $start, $end)
 Validate a provided input range.
 

Function Documentation

◆ buildHeadItem()

static buildHeadItem ( $geshi)
static

Backward-compatibility shim for extensions.

Deprecated
since MW 1.25
Parameters
GeSHi$geshi
Returns
string

Definition at line 571 of file SyntaxHighlight.php.

References wfDeprecated().

◆ makeCacheKeyHash()

static makeCacheKeyHash ( $code,
$lexer,
$options )
staticprivate

Construct a cache key for the results of a Pygments invocation.

Parameters
string$codeCode to be highlighted.
string$lexerLexer name.
array$optionsOptions array.
Returns
string Cache key.

Definition at line 361 of file SyntaxHighlight.php.

References $options.

◆ onApiFormatHighlight()

static onApiFormatHighlight ( IContextSource $context,
$text,
$mime,
$format )
static

Hook to provide syntax highlighting for API pretty-printed output.

Parameters
IContextSource$context
string$text
string$mime
string$format
Since
MW 1.24
Returns
bool

Definition at line 485 of file SyntaxHighlight.php.

References $context, $mime, $out, $output, and SyntaxHighlight\highlight().

◆ onContentGetParserOutput()

static onContentGetParserOutput ( Content $content,
Title $title,
$revId,
ParserOptions $options,
$generateHtml,
ParserOutput & $output )
static

Hook into Content::getParserOutput to provide syntax highlighting for script content.

Parameters
Content$content
Title$title
int$revId
ParserOptions$options
bool$generateHtml
ParserOutput&$output
Returns
bool
Since
MW 1.21

Definition at line 429 of file SyntaxHighlight.php.

References $options, $out, $output, $wgParser, $wgTextModelsToParse, ExtensionRegistry\getInstance(), Content\getModel(), and SyntaxHighlight\highlight().

◆ onResourceLoaderRegisterModules()

static onResourceLoaderRegisterModules ( & $resourceLoader)
static

Conditionally register resource loader modules that depends on the VisualEditor MediaWiki extension.

Parameters
ResourceLoader&$resourceLoader

Definition at line 517 of file SyntaxHighlight.php.

References $resourceLoader, and ExtensionRegistry\getInstance().

◆ parseHighlightLines()

static parseHighlightLines ( $lineSpec)
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.

Parameters
string$lineSpec
Returns
int[] Line numbers.

Definition at line 375 of file SyntaxHighlight.php.

References $lines, $value, and list.

Referenced by SyntaxHighlight\highlight().

◆ prepare()

static prepare ( $text,
$lang )
static

Backward-compatibility shim for extensions.

Deprecated
since MW 1.25

Definition at line 560 of file SyntaxHighlight.php.

References $lang, and wfDeprecated().

Referenced by CurlHttpRequest\execute(), and PhpHttpRequest\execute().

◆ validHighlightRange()

static validHighlightRange ( $start,
$end )
staticprotected

Validate a provided input range.

Parameters
int$start
int$end
Returns
bool

Definition at line 403 of file SyntaxHighlight.php.