9use InvalidArgumentException;
28 private readonly array $textModelsToParse;
46 return VueContent::class;
52 return new $class(
"<template>\n</template>\n\n<script>\n</script>\n\n<style>\n</style>\n" );
75 '@phan-var VueContent $content';
76 if ( in_array( $content->
getModel(), $this->textModelsToParse ) ) {
78 $output = $this->parserFactory->getInstance()->parse(
81 WikiPage::makeParserOptionsFromTitleAndModel(
95 classes: [
'mw-vue' ],
96 includeLineNumbers:
true,
97 includeLineLinks:
true,
99 $html = $highlightOutput->getHtml();
100 $highlightOutput->getMetadata()->addToParserOutput( $output );
120 $parsedComponent = $this->vueComponentParser->
parse( $content->
serialize() );
121 }
catch ( InvalidArgumentException $e ) {
123 return StatusValue::newFatal(
'vue-invalid-content', $e->getMessage() );
125 if ( $parsedComponent[
'styleLang'] ===
'less' ) {
126 return StatusValue::newFatal(
'vue-less-notsupported' );
128 return StatusValue::newGood();
const CONTENT_FORMAT_VUE
For Vue pages.
Content handler for pages with source code as content (e.g.
Service for syntax highlighting.
Content handler for Vue pages.
validateSave(Content $content, ValidationParams $validationParams)
__construct(string $modelId, Config $config, private readonly ParserFactory $parserFactory, private readonly CodeHighlighter $codeHighlighter,)
makeEmptyContent()
Creates an empty TextContent object.1.21Content A new TextContent object with empty text.
fillParserOutput(Content $content, ContentParseParams $cpoParams, ParserOutput &$output)
Fills the provided ParserOutput object with information derived from the content.
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.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Content objects represent page content, e.g.
serialize( $format=null)
Serialize this Content object.
getModel()
Get the content model ID.