9use InvalidArgumentException;
29 private 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(
96 [
'class' =>
'mw-code mw-vue',
'dir' =>
'ltr' ],
97 "\n" . $content->getText() .
"\n"
118 $parsedComponent = $this->vueComponentParser->
parse( $content->
serialize() );
119 }
catch ( InvalidArgumentException $e ) {
121 return StatusValue::newFatal(
'vue-invalid-content', $e->getMessage() );
123 if ( $parsedComponent[
'styleLang'] ===
'less' ) {
124 return StatusValue::newFatal(
'vue-less-notsupported' );
126 return StatusValue::newGood();
const CONTENT_FORMAT_VUE
For Vue pages.
Content handler for pages with source code as content (e.g.
Content handler for Vue pages.
validateSave(Content $content, ValidationParams $validationParams)
__construct(string $modelId, Config $config, private readonly ParserFactory $parserFactory,)
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()
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.