Parser 2011/Wikia Reverse Parser
This page is obsolete. It is being retained for archival purposes. It may document extensions or features that are obsolete and/or no longer supported. Do not rely on the information here being up-to-date. |
Wikia Editor for developers (slides) - 128 kB
Parser & ReverseParser
[edit]Wikia Editor uses slightly modified MW parser to render HTML which can be edited in visual mode (we use CK editor as a core of visual mode).
RTEParser
class extends MW parser and adds attributes containing extra data used when processing HTML back wikitext. This process is handled by ReverseParser
- it goes recursively through HTML and returns wikitext which is then stored in database.
Custom HTML attributes
[edit]List of aforementioned custom attributes (with data-rte-
prefix) can be found in README.txt file in Wikia code repository. Most of them are added by RTEParser
, few are added to the nodes created by CKeditor while modifying an article in visual mode.
Markers
[edit]In order to be able to parse template's HTML back to wikitext we add markers to the wikitext when its processed by the Preprocessor
. When marker is added we store element's (e.g. template, image) wikitext in RTEData
stack. ID of added stack item is stored inside a marker. RTEParser
finds all markers, removes them and moves data stored on the stack to HTML attributes.