MediaWiki master
CodeHighlighterMetadata.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Content;
4
8
21
28 public function __construct(
29 protected array $modules = [],
30 protected array $moduleStyles = [],
31 protected array $categories = [],
32 protected array $warnings = [],
33 ) {
34 }
35
36 public function addToParserOutput( ParserOutput $parserOutput ): void {
37 $parserOutput->addModules( $this->modules );
38 $parserOutput->addModuleStyles( $this->moduleStyles );
39 foreach ( $this->categories as $category ) {
40 $parserOutput->addCategory( $category );
41 }
42 foreach ( $this->warnings as $warning ) {
43 $parserOutput->addWarningMsgVal( $warning );
44 }
45 }
46
47 public function addToOutputPage( OutputPage $outputPage ): void {
48 $outputPage->addModules( $this->modules );
49 $outputPage->addModuleStyles( $this->moduleStyles );
50 }
51}
Default metadata implementation for highlighted code.
__construct(protected array $modules=[], protected array $moduleStyles=[], protected array $categories=[], protected array $warnings=[],)
addToParserOutput(ParserOutput $parserOutput)
Add this metadata to a ParserOutput.
addToOutputPage(OutputPage $outputPage)
Add this metadata to an OutputPage.
This is one of the Core classes and should be read at least once by any new developers.
addModuleStyles( $modules)
Load the styles of one or more style-only ResourceLoader modules on this page.
ParserOutput is a rendering of a Content object or a message.
addWarningMsgVal(MessageSpecifier $mv, ?string $key=null)
Add a warning to the output for this page.
addCategory( $c, $sort='')
Add a category.
Metadata needed to render highlighted code.