CodeNode
extends TextNode
in package
implements
ConsumesDefaultHighlightLanguage
FinalYes
Table of Contents
Interfaces
- ConsumesDefaultHighlightLanguage
- Implement this interface on a Node to let the compiler set the default highlight language on it, as configured by the project settings or the reStructuredText `.. highlight::` directive, whenever the node does not already have an explicit language set.
Properties
- $classes : string[]
- $language : string|null
- $options : array<string, scalar|scalar[]|null>
- $value : TValue
- $caption : InlineCompoundNode|null
- $emphasizeLines : string|null
- $startingLineNumber : int|null
Methods
- __construct() : mixed
- addMetaData() : void
- Attaches data about this node that is not part of its content.
- getCaption() : InlineCompoundNode|null
- getClasses() : string[]
- getClassesString() : string
- getEmphasizeLines() : string|null
- getLanguage() : string|null
- getMetaData() : array<string, DataNode>
- getOption() : mixed
- getOptions() : array<string, scalar|scalar[]|null>
- getStartingLineNumber() : int|null
- getValue() : TValue
- hasOption() : bool
- setCaption() : void
- setClasses() : void
- Normalizes class names following the rules of identifier-normalization
- setEmphasizeLines() : void
- setLanguage() : void
- setStartingLineNumber() : void
- setValue() : void
- toString() : string
- withKeepExistingOptions() : static
- Adds $options as default options without overriding any options already set.
- withOptions() : static
- normalizeLines() : string
Properties
$classes
protected
string[]
$classes
= []
$language
protected
string|null
$language
= null
$options
protected
array<string, scalar|scalar[]|null>
$options
= []
$value
protected
TValue
$value
$caption
private
InlineCompoundNode|null
$caption
= null
$emphasizeLines
private
string|null
$emphasizeLines
= null
$startingLineNumber
private
int|null
$startingLineNumber
= null
The line number to start counting from and display, or null to hide line numbers
Methods
__construct()
public
__construct(string[] $lines[, string|null $language = null ]) : mixed
Parameters
- $lines : string[]
- $language : string|null = null
addMetaData()
Attaches data about this node that is not part of its content.
public
addMetaData(DataNode $data) : void
Rendered as a data-* attribute where the node's template asks for
it. A name that is already taken gets the new values added to the ones
it has, rather than replaced by them. DataNode
Parameters
- $data : DataNode
getCaption()
public
getCaption() : InlineCompoundNode|null
Return values
InlineCompoundNode|nullgetClasses()
public
getClasses() : string[]
Return values
string[]getClassesString()
public
getClassesString() : string
Return values
stringgetEmphasizeLines()
public
getEmphasizeLines() : string|null
Return values
string|nullgetLanguage()
public
getLanguage() : string|null
Return values
string|nullgetMetaData()
public
getMetaData() : array<string, DataNode>
Return values
array<string, DataNode> —keyed by name
getOption()
public
getOption(string $name[, TType|null $default = null ]) : mixed
Parameters
- $name : string
- $default : TType|null = null
Tags
getOptions()
public
getOptions() : array<string, scalar|scalar[]|null>
Return values
array<string, scalar|scalar[]|null>getStartingLineNumber()
public
getStartingLineNumber() : int|null
Return values
int|nullgetValue()
public
getValue() : TValue
Return values
TValuehasOption()
public
hasOption(string $name) : bool
Parameters
- $name : string
Return values
boolsetCaption()
public
setCaption(InlineCompoundNode|null $caption) : void
Parameters
- $caption : InlineCompoundNode|null
setClasses()
Normalizes class names following the rules of identifier-normalization
public
setClasses(string[] $classes) : void
Parameters
- $classes : string[]
Tags
setEmphasizeLines()
public
setEmphasizeLines(string|null $emphasizeLines) : void
Parameters
- $emphasizeLines : string|null
setLanguage()
public
setLanguage([string|null $language = null ]) : void
Parameters
- $language : string|null = null
setStartingLineNumber()
public
setStartingLineNumber(int|null $lineNumber) : void
Parameters
- $lineNumber : int|null
setValue()
public
setValue(TValue $value) : void
Parameters
- $value : TValue
toString()
public
toString() : string
Return values
stringwithKeepExistingOptions()
Adds $options as default options without overriding any options already set.
public
withKeepExistingOptions(array<string, scalar|null> $options) : static
Parameters
- $options : array<string, scalar|null>
Return values
staticwithOptions()
public
withOptions(array<string, scalar|scalar[]|null> $options) : static
Parameters
- $options : array<string, scalar|scalar[]|null>
Return values
staticnormalizeLines()
protected
static normalizeLines(string[] $lines) : string
Parameters
- $lines : string[]