https://bugzilla.wikimedia.org/show_bug.cgi?id=66982
Bug ID: 66982 Summary: WTS code improvement: Consider moving all nowiki-indent-pre supression code to post-processing pass Product: Parsoid Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: Unprioritized Component: serializer Assignee: gwi...@wikimedia.org Reporter: ssas...@wikimedia.org CC: jforres...@wikimedia.org, ssas...@wikimedia.org Web browser: --- Mobile Platform: --- This bug is courtesy IRC discussion with gwicke about possible code cleanup/refactoring. Over time, indent-pre nowiki removal code has ended up in 3 different areas: 1. wts escapeWikitext code that checks for leading space in sol context -- this code might be redundant now given that all whitespace before text nodes is now made part of separator text and handled there. To be investigated. 2. separator makeSepIndentPreSafe code that does dom analysis to examine surrounding context of the whitespace to see if the whitespace will lead to an indent-pre or not. 3. Postprocessing nowiki removal pass that eliminates spurious nowikis added on lines that have block nodes (but this pass can be made more generic). Solution 2. will continue to have to exist for multi-line scenarios (ex: "<blockquote>\n a\n</blockquote>" which won't be handled by 3. Currently solution 2. also handles cases with " <figure>...</figure>" which serializes to " [[Image:..]]" Since solution 3. only operates on final serialized wikitext, any figure and other indent-pre suppressing tags will have been lost. So, one option is to consider adding markers for figures and others that might suppress nowikis and then strip them in phase 3. Not sure if this last piece of cleanup is necessarily any better or simpler, but it will at least centralize more of the nowiki-suppression/removal code in the last phase (as long as perf is unaffected and the same amount of work is not involved in adding the markers). -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ Wikibugs-l mailing list Wikibugs-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikibugs-l