diff --git a/extension.json b/extension.json index 349d9bbd..5f3e1818 100644 --- a/extension.json +++ b/extension.json @@ -7,7 +7,7 @@ ], "url": "https://github.com/Universal-Omega/PortableInfobox", "descriptionmsg": "portable-infobox-desc", - "version": "0.8", + "version": "1.0", "type": "parserhook", "license-name": "GPL-3.0-or-later", "requires": { @@ -15,7 +15,11 @@ }, "config": { "AllInfoboxesExcludedSubpages": { - "value": [ "doc", "draft", "test" ] + "value": [ + "doc", + "draft", + "test" + ] }, "PortableInfoboxCacheRenderers": { "value": false @@ -125,5 +129,6 @@ "APIListModules": { "allinfoboxes": "PortableInfobox\\Controllers\\ApiQueryAllInfoboxes" }, + "ParsoidModules": [ "PortableInfobox\\Parsoid\\InfoboxTag" ], "manifest_version": 2 -} +} \ No newline at end of file diff --git a/includes/Parsoid/InfoboxTag.php b/includes/Parsoid/InfoboxTag.php new file mode 100644 index 00000000..4888b87f --- /dev/null +++ b/includes/Parsoid/InfoboxTag.php @@ -0,0 +1,57 @@ + 'PortableInfobox', + 'tags' => [ + [ + 'name' => 'infobox', + 'handler' => self::class + ] + ], + 'domProcessors' => [ + 'PortableInfobox\\Parsoid\\PortableInfoboxDOMProcessor' + ] + ]; + } + + /** + * @inheritDoc + */ + public function sourceToDom( ParsoidExtensionAPI $api, string $src, array $args ) + { + $domFragments = $api->extTagToDOM( $args, $src, [ + 'wrapperTag' => 'aside', + 'parseOpts' => [ + 'extTag' => 'infobox', + 'context' => 'inline' + ] + ]); + + + // this is a bit messed up as these methods are deprecated, but the documentation + // for the replacement methods doesn't exist or make sense + // this is commented out at present, as these scripts and styles will be added + // by the legacy parser (might need it here to stick these in the parser cache also?) + $api->getMetadata()->addModules( [ 'ext.PortableInfobox.scripts' ] ); + $api->getMetadata()->addModuleStyles( [ 'ext.PortableInfobox.styles' ] ); + + // return this back. At this point, we have constructed the outer tag (