Page MenuHomePhabricator

<pre> tag incorrectly and inconsistently treated
Closed, DuplicatePublicBUG REPORT


List of steps to reproduce (step by step, including full links if applicable):

What happens?:
Start-of-line whitespace creates pre-tag formatting inside pre-tag, for some combination of whether a newline is present before <pre> or after </pre>, and behavior is dependent on view, since editing or previewing won't show the nested pre-tag formatting, only the final saved page.

What should have happened instead?:
Pre-tags should output no such formatting, or at least this should be consistent between visual editor, preview, and saved page.

This is particularly bad with the VisualEditor since one does not see the effect while editing and cannot easily insert the newlines needed before/after <pre> to avoid the saved page showing nesting of pre-tag formatting.

Event Timeline

matmarex subscribed.

Screenshot for reference:élisation_des_Réseaux_(M1_SIREN,_2022)/Activité_A&oldid=871146

image.png (2×3 px, 244 KB)

I don't understand why it would be parsed this way. (Start-of-line whitespace inside a pre-tag should never create another pre-tag, that just doesn't make sense.) I wonder if it could be a parser bug? (or a mistake in the wikitext, but it looks correct to me)

Not a bug in Parsoid. I suppose some edge case bug in some regexp in the legacy parser.

The issue seems to be in the execute() function of includes/parser/BlockLevelPass.php file.

A <pre> on the same line as an earlier closing </pre> tag or self-closing <pre/> will result in specific wikitext markup within its block to be parsed. The affected markups are: asterisk, hash, colon, semicolon, and space.

Example page: