19use Wikimedia\Minify\CSSMin;
29 private readonly array $textModelsToParse;
46 return CssContent::class;
67 return new $class(
'/* #REDIRECT */@import ' . CSSMin::buildUrlValue(
$url ) .
';' );
74 '@phan-var CssContent $content';
77 if ( !$this->userOptionsLookup->getBoolOption( $pstParams->
getUser(),
'pst-cssjs' ) ) {
80 $popts->setPreSaveTransform(
false );
83 $text = $content->getText();
84 $pst = $this->parserFactory->getInstance()->preSaveTransform(
92 return new $class( $pst );
103 '@phan-var CssContent $content';
104 if ( in_array( $content->
getModel(), $this->textModelsToParse ) ) {
106 $output = $this->parserFactory->getInstance()
110 WikiPage::makeParserOptionsFromTitleAndModel(
124 classes: [
'mw-css' ],
125 includeLineNumbers:
true,
126 includeLineLinks:
true,
128 $html = $highlightOutput->getHtml();
129 $highlightOutput->getMetadata()->addToParserOutput( $output );
142class_alias( CssContentHandler::class,
'CssContentHandler' );
const CONTENT_FORMAT_CSS
For CSS pages.
Content handler for pages with source code as content (e.g.
Service for syntax highlighting.
Content handler for CSS pages.
preSaveTransform(Content $content, PreSaveTransformParams $pstParams)
Returns a $content object with pre-save transformations applied (or the same object if no transformat...
supportsRedirects()
Returns true if this content model supports redirects.This default implementation returns false....
fillParserOutput(Content $content, ContentParseParams $cpoParams, ParserOutput &$output)
Fills the provided ParserOutput object with information derived from the content.Unless $generateHtml...
__construct(string $modelId, Config $config, private readonly ParserFactory $parserFactory, private readonly UserOptionsLookup $userOptionsLookup, private readonly CodeHighlighter $codeHighlighter,)
makeRedirectContent(Title $destination, $text='')
Create a redirect that is also valid CSS.
A class containing constants representing the names of configuration variables.
const TextModelsToParse
Name constant for the TextModelsToParse setting, for use with Config::get()
Base representation for an editable wiki page.
Content objects represent page content, e.g.
getModel()
Get the content model ID.