|
| __construct (Env $env, $options) |
|
| linkHandler (Element $node) |
| Main link handler.
|
|
| languageVariantHandler (Node $node) |
|
| escapeWikitext (SerializerState $state, string $text, array $opts) |
| Escape wikitext-like strings in '$text' so that $text renders as a plain string when rendered as HTML.
|
|
| domToWikitext (array $opts, DocumentFragment $node) |
|
| htmlToWikitext (array $opts, string $html) |
|
| getAttributeKey (Element $node, string $key) |
|
| getAttributeValue (Element $node, string $key) |
|
| getAttributeValueAsShadowInfo (Element $node, string $key) |
|
| serializedImageAttrVal (Element $dataMWnode, Element $htmlAttrNode, string $key) |
|
| serializedAttrVal (Element $node, string $name) |
|
| tagNeedsEscaping (string $name) |
| Check if token needs escaping.
|
|
| wrapAngleBracket (Token $token, string $inner) |
|
| serializeHTMLTag (Element $node, bool $wrapperUnmodified) |
|
| serializeHTMLEndTag (Element $node, $wrapperUnmodified) |
|
| serializeAttributes (Element $node, Token $token, bool $isWt=false) |
|
| handleLIHackIfApplicable (Element $node) |
| FIXME: Get rid of this function after content version 2.2.0 has expired from caches.
|
|
| serializeFromParts (SerializerState $state, Element $node, array $srcParts) |
| Serialize a template from its parts.
|
|
| serializeExtensionStartTag (Element $node, SerializerState $state) |
|
| defaultExtensionHandler (Element $node, SerializerState $state) |
|
| emitWikitext (string $res, Node $node) |
| Emit non-separator wikitext that does not need to be escaped.
|
|
| serializeDOM (Node $node, bool $selserMode=false) |
| Serialize an HTML DOM.
|
|
| trace (... $args) |
|
Wikitext to HTML serializer.
Serializes a chunk of tokens or an HTML DOM to MediaWiki's wikitext flavor.
This serializer is designed to eventually
- accept arbitrary HTML and
- serialize that to wikitext in a way that round-trips back to the same HTML DOM as far as possible within the limitations of wikitext.
Not much effort has been invested so far on supporting non-Parsoid/VE-generated HTML. Some of this involves adaptively switching between wikitext and HTML representations based on the values of attributes and DOM context. A few special cases are already handled adaptively (multi-paragraph list item contents are serialized as HTML tags for example, generic A elements are serialized to HTML A tags), but in general support for this is mostly missing.
Example issue:
<h1><p>foo</p></h1> will serialize to =\nfoo\n= whereas the
correct serialized output would be: =<p>foo</p>=
What to do about this?
- add a generic 'can this HTML node be serialized to wikitext in this context' detection method and use that to adaptively switch between wikitext and HTML serialization.