Parsing/Replacing Tidy/FAQ/nl

Wat is Tidy?
Tidy (en) is programmatuur die MediaWiki op dit moment gebruikt om fouten in HTML op pagina's in een wiki op te lossen. Pagina's met foutief HTML komen vaak voor in een wiki wanneer bewerkers HTML-codes gebruiken in sjablonen of direct op de pagina. Een voorbeeld: vaak wordt een afsluitende HTML-code vergeten, zoals een  na een. Er zijn ook gevallen waarin MediaWiki zelf fouten in HTML kan maken. Tidy repareert deze fouten, maar doet ook eigen "poetswerk" waarbij het niet om fouten gaat. Het haalt bijvoorbeeld HTML-elementen zonder inhoud weg en voegt witruimte tussen HTML-codes toe, waardoor de weergave soms verandert (en). Omdat Tidy nog uitgaat van HTML4 maar op internet HTML5 gangbaar is geworden, doet het ook een paar onjuiste aanpassingen om dingen te 'repareren' die vroeger niet goed waren: hoewel je een lijst met bullets in het kopje van een tabel mag zetten, zal Tidy die zomaar daaruit halen.

Waarom vervangen? En waardoor?
De technologie van Tidy komt uit de jaren 90, toen webbrowsers niet gestandaardiseerd waren. Wat Tidy doet gaat min of meer uit van HTML4, maar spoort niet met een hedendaagse browser. Na jaren zonder actief onderhoud is Tidy nu aan een nieuw leven begonnen als "tidy-html5", dat heel anders werkt. Het oude Tidy zit niet meer in het MediaWikipakket. Zoals gezegd doet Tidy ook eigen poetswerk aan HTML, los van fouten. Dit alles maakte dat er op Phabricator veel bugs in Tidy werden gemeld en sinds in ieder geval2013 wordt al om vervanging gevraagd. HTML5 is de standaard van nu en voor HTML5 is duidelijk stap voor stap vastgelegd hoe HTML-code naar een beeld vertaald moet worden ('parsen'). Dit heeft geleid tot browsers en andere programmatuur die met elkaar overeenkomende resultaten geven. Dit beschrijving stap voor stap geeft ook precies aan hoe fouten in HTML-code moeten worden opgelost. In deze nieuwe technologische omgeving moet Tidy echt worden vervangen door een HTML5-parser die netjes volgens de standaard fouten in HTML-code oplost en een geldige, correct beschreven HTML-opmaak oplevert. Maar ondertussen hebben de Wikimediaprojecten een enorme verzameling pagina's waarvan de opmaak nog uitgaat van aanpassingen door Tidy. Het is niet doenlijk om Tidy ineens simpelweg te vervangen door bestaande HTML5-programmatuur van anderen, want die programmatuur zou de opmaak op een andere manier aanpassen en dat kan verstoren hoe de pagina's eruitzien. Daarom gaan we Tidy vervangen door eigen programmatuur gebaseerd op HTML5 met een paar Tidy-achtige aanvullingen om de overgangsproblemen zo klein mogelijk te maken. Na proeven met drie verschillende oplossingen zijn we uitgekomen op RemexHTML, een HTML5-parser gebaseerd op PHP, die we hebben aangevuld met eigen routines die sommige acties van Tidy nadoen die we nu nodig hebben. In de toekomst zou RemexHTML ook gebruikt kunnen worden om nieuwe mogelijkheden in MediaWiki in te bouwen, zoals het betrouwbaarder kunnen werken met secties, ondersteuning voor sjablonen die paarsgewijs gebruikt moeten worden en het efficiënter vernieuwen van pagina's nadat een sjabloon bewerkt is. Voor de volledigheid: ook als we tidy-html5 bleven gebruiken zouden we foutieve HTML-codes moeten aanpakken, want een deel van de aanpassingen heeft te maken met een verandering in de betekenis van HTML-codes van versie 4 naar 5. Andere overwegingen rond het beheersbaar houden van veranderingen, waaronder de hiervoor genoemde nieuwe mogelijkheden, leiden tot de keuze voor eigen programmatuur.

Voor andere technische details, zie phabricator.wikimedia.org/T89331 (en) of Replacing Tidy (en)'''

Wat hebben jullie tot nu toe getest
Om een beeld te krijgen van het effect van de vervanging van Tidy door op HTML5 gebaseerde programmatuur is de MediaWiki-output van beide als plaatje pixel voor pixel vergeleken, met behulp van het programmaatje "VisualDiff". Early on, we found that a common difference was minor vertical whitespace changes. In the belief that these would either not be noticeable or would be tolerable, we wrote a tool called "UprightDiff" which is able to identify vertical motion within an image and to discount such motion for the purposes of automated testing. This also let us assign a numeric score to differences and readily identify the most egregious differences. We exported a subset of about 64,000 articles (some from the recent changes stream, and rest selected randomly) from various Wikimedia wikis (40 wikis from Wikipedia, Wikisource, Wiktionary, and Wikivoyage), and rendered them with Tidy and with RemexHTML, then used "UprightDiff" to analyse the result. This takes a lot of cpu cycles, memory, and disk space, and it takes 2 days for one round of testing to complete. This limits the size of the testing corpus but we believe 64K is a sizeable sample to figure out the kind of fixes necessary.

To minimize the differences and reduce the impact of fixes that would be needed from editors, we added some additional Tidy-compatibility fixups. Since we found that self-closing tags were extremely common on wikimedia wikis, we added a compatibility fix to treat them as empty tags (i.e.  is treated as  ). We added some other compatibility passes as well. After all these fixes were in place and we repeated our tests, we found that 93.4% of pages had no changes in rendering. And, 96.9% of pages had either no pixel diffs (93.4%) or insignificant vertical whitespace shifts only (3.5% = 96.9 - 93.4). The remaining 3.1% pages (100 - 96.9) showed pixel differences that had other reasons.

Based on these tests, we identified several classes of markup errors that will render differently between the two. For one class of markup errors (self-closing tags that aren't valid in HTML5), we added a maintenance category that editors have already been using to fix up templates and pages. But, the other classes of markup errors are not easy to detect automatically at this time and editors' assistance is necessary to identify and fix them up.

What will happen? When will these changes happen?
As noted earlier, we cannot yet do a drop-in replacement of Tidy with a HTML5-based tool. We have added a maintenance category for one class of markup errors, which will help editors fix them up. To help editors identify and fix up other markup errors, we also built a ParserMigration extension that helps them compare output in production and fix markup errors. Separately, we have also built the Linter extension to to identify some of the fixes that are needed.

As of of end March 2017, we deployed the ParserMigration extensions to all wikis. The Linter extension is currently deployed on small and medium wikis. We hope to have Linter deployed to large wikis by mid May. Via these extensions, we hope to enable editors fix up pages for actually replacing Tidy in 2017. Once enough fixes are made and we are satisfied that the impact on editors and readers will be minor and tolerable, we will go ahead and replace Tidy But, we would also not like to drag this on indefinitely. So, it would be ideal if the high-priority issues identified by the Linter extension are prioritized by editors.

Separately, the Tidy-compatibility fixups (mentioned in the previous section) are meant to be in place till we replace Tidy. After that, we will start replacing these fixups gradually while relying on similar testing and tooling support.

What will editors need to do?

 * We anticipate that certain templates will need to be updated. Test results from visual diffing has some examples of templates that need to be fixed. For one class of markup errors, we expect the Linter extension (that surfaces information from Parsoid) will greatly help in identifying templates that might be source of markup errors. We don't yet know how to automatically determine all affected templates, but we expect that the list of templates and suggestions will get more complete as we learn about problems that were not caught before. Community Liaisons will reach out to template experts, regulars at technical village pumps, etc. to make sure they become aware of the necessary changes and of resources that may help them.
 * As mentioned above, to assist editors in migrating wikitext to the new rules, we have deployed the Linter and ParserMigration extensions. If you enable "ParserMigration" in your preferences, a link will be added to the toolbox of all articles, which can show the current (Tidy) and expected (RemexHTML) output side-by-side. You can preview article text changes in the same side-by-side view and see how your edits changes / fixes rendering.
 * We hope to have the Linter extension enabled on all wikis by mid-May 2017. As indicated on the help page, this identify wikitext patterns in pages and templates that need to be fixed.
 * We are thinking about other easy, sustainable ways in which we may support "gnomes" and all the Wikimedians willing to help with this effort.

Other FAQs
Q: What happens to  and similar tags if they are used in self-closed form?

A: As noted in T134423, the only valid self-closed HTML tags are:,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,  ,. Non-HTML self-closing tags (like  and  ) are not affected by this change. is a special case because while it is a HTML tag, MediaWiki treats it like an extension tag and hence remains unaffected. All other self-closing HTML tags should be fixed (and are already being fixed by editors at this time).

Since this usage is found in a lot of pages in our testing, in order to prevent unexpected rendering effects (e.g.  being treated as    and causing more text being bolded than intended), we added a fix to the parser to convert them to an empty tag (eg.   will be converted to  ). But, we don't intend to retain this fix indefinitely. So, we would like for editors to continue fixing this deprecated usage.

Q: What were the results of tests on languages other than English, or on sister projects?

A: There is nothing in what Tidy, RemexHTML do that is specific to Wikipedia or English. This project is primarily about a change from HTML4 to HTML5 semantics and getting rid of some Tidy cleanups of HTML. These changes affects all projects and languages equally, except if some projects and languages tend to have more markup errors or use more self-closed tags than others.

Q: What other changes are editors likely to see, after this replacement?

A: The effect of this replacement is primarily going to affect readers, as they may notice that the page doesn't look right (for example, excessively wide navboxes without line breaks or wrapping). However, if anything, this might lead to the rendering seen in VisualEditor to match the rendering seen outside it much more than before, since Parsoid's output has been HTML5-compliant since the beginning, and we are now moving the read output to HTML5. We do not expect any impact on VisualEditor edits, but we will promptly address any bugs reported with respect to dirty diffs. In addition, we do not plan to add any error messages or warnings displayed on pages if the markup errors are not fixed.

Q: How does the replacement relate to other projects you are working on?

A: By enabling the move to HTML5 semantics, this is one of the steps evolving markup in our corpus to keep up with web standard. We also expect to leverage this tool to support well-balanced template output. Separately, but relatedly, this will also make the output of the PHP parser (used for reads) and the output of Parsoid (used for edits in VE, Content Translation) more consistent since Parsoid already uses HTML5 semantics. One of our goals is to make the two outputs fully consistent with each other and use one parser for both reads and edits.

--The Parsing Team

Volunteers available to support this effort
''Community Liaisons invite interested Wikimedians to please add their name in the sections below and support their community engagement efforts. Thank you. As with similar past initiatives, signing up is optional.''
 * 1) I am available to test with the ParserMigration tool.
 * 2) (add your signature here)
 * 3) I am available to fix templates.
 * 4) Jonesey95 (talk) 16:10, 14 November 2016 (UTC)
 * 5) Samuele2002 (talk)
 * 6) I am available to study and discuss fixes to templates.
 * 7) Jonesey95 (talk) 16:10, 14 November 2016 (UTC)
 * 8) I am available to spread the word among my community.
 * 1) Jonesey95 (talk) 16:10, 14 November 2016 (UTC)
 * 2) I am available to spread the word among my community.