Parsoid
A bidirectional parser between wikitext and HTML5
|
See tests/parser/ParserTestParserHook.php in core. More...
Public Member Functions | ||||||||||
sourceToDom (ParsoidExtensionAPI $extApi, string $content, array $args) | ||||||||||
Convert an extension tag's content to "prepared and loaded" DOM.
| ||||||||||
processAttributeEmbeddedHTML (ParsoidExtensionAPI $extApi, Element $elt, Closure $proc) | ||||||||||
Extensions might embed HTML in attributes in their own custom representation (whether in data-mw or elsewhere).Core Parsoid will need a way to traverse such content. This method is a way for extension tag handlers to provide this functionality. Parsoid will only call this method if the tag's config sets the options['wt2html']['embedsHTMLInAttributes'] property to true.
| ||||||||||
domToWikitext (ParsoidExtensionAPI $extApi, Element $node, bool $wrapperUnmodified) | ||||||||||
Serialize a DOM node created by this extension to wikitext.
| ||||||||||
getConfig () | ||||||||||
Return information about this extension module.FIXME: Add more expected fields or create a class for this FIXME: The 'name' is expected to be the same as the name defined at the top level of extension.json.
| ||||||||||
Public Member Functions inherited from Wikimedia\Parsoid\Ext\ExtensionTagHandler | ||||||||||
lintHandler (ParsoidExtensionAPI $extApi, Element $rootNode, callable $defaultHandler) | ||||||||||
Lint handler for this extension. | ||||||||||
diffHandler (ParsoidExtensionAPI $extApi, callable $domDiff, Element $origNode, Element $editedNode) | ||||||||||
XXX: Experimental. | ||||||||||
See tests/parser/ParserTestParserHook.php in core.
Wikimedia\Parsoid\ParserTests\ParserHook::domToWikitext | ( | ParsoidExtensionAPI | $extApi, |
Element | $node, | ||
bool | $wrapperUnmodified ) |
Serialize a DOM node created by this extension to wikitext.
ParsoidExtensionAPI | $extApi | |
Element | $node | A node in a "prepared and loaded" document. |
bool | $wrapperUnmodified |
Reimplemented from Wikimedia\Parsoid\Ext\ExtensionTagHandler.
Wikimedia\Parsoid\ParserTests\ParserHook::getConfig | ( | ) |
Return information about this extension module.FIXME: Add more expected fields or create a class for this FIXME: The 'name' is expected to be the same as the name defined at the top level of extension.json.
Implements Wikimedia\Parsoid\Ext\ExtensionModule.
Wikimedia\Parsoid\ParserTests\ParserHook::processAttributeEmbeddedHTML | ( | ParsoidExtensionAPI | $extApi, |
Element | $elt, | ||
Closure | $proc ) |
Extensions might embed HTML in attributes in their own custom representation (whether in data-mw or elsewhere).Core Parsoid will need a way to traverse such content. This method is a way for extension tag handlers to provide this functionality. Parsoid will only call this method if the tag's config sets the options['wt2html']['embedsHTMLInAttributes'] property to true.
ParsoidExtensionAPI | $extApi | |
Element | $elt | The node whose data attributes need to be examined |
Closure | $proc | The processor that will process the embedded HTML Signature: (string) -> string This processor will be provided the HTML string as input and is expected to return a possibly modified string. |
Reimplemented from Wikimedia\Parsoid\Ext\ExtensionTagHandler.
Wikimedia\Parsoid\ParserTests\ParserHook::sourceToDom | ( | ParsoidExtensionAPI | $extApi, |
string | $content, | ||
array | $args ) |
Convert an extension tag's content to "prepared and loaded" DOM.
ParsoidExtensionAPI | $extApi | |
string | $src | Extension tag content |
array | $extArgs | Extension tag arguments The extension tag arguments should be treated as opaque objects and any necessary inspection should be handled through the API. |
DocumentFragment
if returning some parsed content false
to fallback to the default handler for the content null
to drop the instance completelyReimplemented from Wikimedia\Parsoid\Ext\ExtensionTagHandler.