mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Poem
synced 2024-11-23 14:36:43 +00:00
Hook up Parsoid implementation of Poem
Bug: T358054 Change-Id: Iac1378b1761842e5c2b82129abb191fbf16d829c
This commit is contained in:
parent
e07bcb81c8
commit
3cc0dd4e6e
|
@ -28,5 +28,20 @@
|
|||
"AutoloadNamespaces": {
|
||||
"MediaWiki\\Extension\\Poem\\": "includes/"
|
||||
},
|
||||
"ParsoidModules": [ {
|
||||
"name": "Poem",
|
||||
"domProcessors": [
|
||||
"MediaWiki\\Extension\\Poem\\Parsoid\\PoemProcessor"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"name": "poem",
|
||||
"handler": "MediaWiki\\Extension\\Poem\\Parsoid\\Poem",
|
||||
"options": {
|
||||
"outputHasCoreMwDomSpecMarkup": true
|
||||
}
|
||||
}
|
||||
]
|
||||
} ],
|
||||
"manifest_version": 2
|
||||
}
|
||||
|
|
|
@ -1,40 +1,15 @@
|
|||
<?php
|
||||
declare( strict_types = 1 );
|
||||
|
||||
namespace Poem\Parsoid;
|
||||
namespace MediaWiki\Extension\Poem\Parsoid;
|
||||
|
||||
use Wikimedia\Parsoid\DOM\DocumentFragment;
|
||||
use Wikimedia\Parsoid\Ext\ExtensionModule;
|
||||
use Wikimedia\Parsoid\Ext\ExtensionTagHandler;
|
||||
use Wikimedia\Parsoid\Ext\ParsoidExtensionAPI;
|
||||
use Wikimedia\Parsoid\Ext\PHPUtils;
|
||||
use Wikimedia\Parsoid\Utils\DOMCompat;
|
||||
|
||||
class Poem extends ExtensionTagHandler implements ExtensionModule {
|
||||
|
||||
/** @inheritDoc */
|
||||
public function getConfig(): array {
|
||||
return [
|
||||
'name' => 'Poem',
|
||||
'domProcessors' => [
|
||||
PoemProcessor::class,
|
||||
],
|
||||
'tags' => [
|
||||
[
|
||||
'name' => 'poem',
|
||||
'handler' => self::class,
|
||||
'options' => [
|
||||
'outputHasCoreMwDomSpecMarkup' => true
|
||||
],
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function __construct( ?ParsoidExtensionAPI $extApi = null ) {
|
||||
/* The dom post processor doesn't need to use $extApi, so ignore it */
|
||||
}
|
||||
|
||||
class Poem extends ExtensionTagHandler {
|
||||
/** @inheritDoc */
|
||||
public function sourceToDom(
|
||||
ParsoidExtensionAPI $extApi, string $content, array $extArgs
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
declare( strict_types = 1 );
|
||||
|
||||
namespace Poem\Parsoid;
|
||||
namespace MediaWiki\Extension\Poem\Parsoid;
|
||||
|
||||
use Wikimedia\Parsoid\DOM\Element;
|
||||
use Wikimedia\Parsoid\DOM\Node;
|
||||
|
|
1
tests/parser/parserTests-knownFailures.json
Normal file
1
tests/parser/parserTests-knownFailures.json
Normal file
|
@ -0,0 +1 @@
|
|||
{}
|
|
@ -1,4 +1,8 @@
|
|||
!! Version 2
|
||||
!! options
|
||||
version=2
|
||||
parsoid-compatible=wt2html,wt2wt,html2wt,html2html,selser
|
||||
!! end
|
||||
|
||||
# Force the test runner to ensure the extension is loaded
|
||||
!! hooks
|
||||
poem
|
||||
|
|
Loading…
Reference in a new issue