MediaWiki REL1_34
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 572 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 358 of file SyntaxHighlight.php.

◆ 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 482 of file SyntaxHighlight.php.

References $context, 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 426 of file SyntaxHighlight.php.

References $content, $title, $wgParser, $wgTextModelsToParse, ParserOutput\addModuleStyles(), SyntaxHighlight\highlight(), and ParserOutput\setText().

◆ onResourceLoaderRegisterModules()

static onResourceLoaderRegisterModules ( & $resourceLoader)
static

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

Parameters
ResourceLoader&$resourceLoader

Definition at line 514 of file SyntaxHighlight.php.

References $resourceLoader.

◆ 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 372 of file SyntaxHighlight.php.

References $lines.

Referenced by SyntaxHighlight\highlight().

◆ prepare()

static prepare ( $text,
$lang )
static

Backward-compatibility shim for extensions.

Deprecated
since MW 1.25

Definition at line 561 of file SyntaxHighlight.php.

References $lang, and wfDeprecated().

Referenced by CurlHttpRequest\execute(), GuzzleHttpRequest\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 400 of file SyntaxHighlight.php.