mediawiki-extensions-Syntax.../includes/ParsoidExt.php
Subramanya Sastry 0eef7add67 Add Parsoid support for syntaxhighlight
* Added Parsoid config, and refactored code slightly to
  add native Parsoid handlers for parser tags exposed
  by this extension.
* Enabled parsoid mode testing on the test file.
* Added html/parsoid sections on a few tests.
* Marked rest of tests as wt2html and wt2wt only since
  html2wt and html2html will fail without a html/parsoid section
  and there is no real benefit to adding them to all tests.
* Added a couple tests to the known failures list:
  - One is because of T299103.
  - The other is because Parsoid always emits attributes in the
    form <tag .. foo="bar"..> instead of just <tag ... foo ..>
    Since Parsoid needs to accept this format that is present on
    wikis, I added a html/parsoid section for this test and
    added the failures to the known failures list.

Bug: T272939
Change-Id: Ie30aa6b082d4fc43c73296ff2ed6cb8c3873f48f
2022-08-08 20:07:46 -04:00

40 lines
903 B
PHP

<?php
declare( strict_types = 1 );
namespace MediaWiki\SyntaxHighlight;
use Wikimedia\Parsoid\Ext\ExtensionModule;
class ParsoidExt implements ExtensionModule {
/** @inheritDoc */
public function getConfig(): array {
return [
'name' => 'SyntaxHighlight',
'tags' => [
[
'name' => 'source',
'handler' => SyntaxHighlight::class,
'options' => [
// Strip nowiki markers from #tag parser-function arguments.
// This will be used to resolve T299103.
// This is primarily a b/c flag in Parsoid.
'stripNowiki' => true
]
],
[
'name' => 'syntaxhighlight',
'handler' => SyntaxHighlight::class,
'options' => [
// Strip nowiki markers from #tag parser-function arguments.
// This will be used to resolve T299103.
// This is primarily a b/c flag in Parsoid.
'stripNowiki' => true
]
]
]
];
}
}