Jump to content

Help talk:Lint errors/tidy-whitespace-bug

Add topic
From mediawiki.org
Latest comment: 8 years ago by SSastry (WMF) in topic Tips to finding it?

Example fix

[edit]

See T134423#3578633 where @Dvorapa asked how to fix Šablona:Fotbalbox2. Specifically this snippet:

<span style="white-space:nowrap; display:inline;">'''{{#if: {{{skóre|}}} | {{{skóre}}} | v }}''' {{#if:{{{prodl|}}}|<span style="font-size: 85%">([[Prodloužení|prodl.]])</span> }}</span>.

Solution 1:

One simple fix would be to add a whitespace char at the end of closing </span> if the extra whitespace character won't affect rendering.

<span style="white-space:nowrap; display:inline;">'''{{#if: {{{skóre|}}} | {{{skóre}}} | v }}''' {{#if:{{{prodl|}}}|<span style="font-size: 85%">([[Prodloužení|prodl.]])</span> }}</span> . Note that single extra whitespace char at the end.

Solution 2:

Alternatively, here is the fix that preserves existing whitespace.

<span style="white-space:nowrap; display:inline;">'''{{#if: {{{skóre|}}} | {{{skóre}}} | v }}'''{{#if:{{{prodl|}}}| <span style="font-size: 85%">([[Prodloužení|prodl.]])</span>}}</span> . SSastry (WMF) (talk) 05:10, 5 September 2017 (UTC)Reply

Not useful on enWS transcluded page sets

[edit]

Looking at https://en.wikisource.org/w/index.php?title=1911_Encyclop%C3%A6dia_Britannica/Privateer&action=edit&lintid=415174 is unhelpful. If the error is occurring somewhere in the Page: namespace then it needs to be showing there.

1911 Encyclopædia Britannica/Privateer (edit | history)     SPAN + #text — billinghurst sDrewth 23:43, 11 September 2017 (UTC)Reply

As a question, is it the use of &nbsp; inside the span or abbr tags that is the issue? — billinghurst sDrewth 23:50, 11 September 2017 (UTC)Reply
Ya, we'll have to take a look at this to see how we can improve the error reporting here. I don't know offhand. I'll take a look tomorrow and get back. SSastry (WMF) (talk) 04:46, 12 September 2017 (UTC)Reply

Tips to finding it?

[edit]

Hi,

Are there any tips to finding it?

There's one page in the Hebrew Wikipedia that has it, an old village pump archive.

While it's probably not super-important to fix, I'm still curious how to find it.

Tagging @SSastry (WMF), @IKhitron. Amir E. Aharoni {{🌎🌍🌏}} 08:17, 8 October 2017 (UTC)Reply

Thanks for tagging. What is #text at all? IKhitron (talk) 10:02, 8 October 2017 (UTC)Reply
#text is a text node. Anyway, this one is harder to track because of the unclosed <div> tag in the opening template which pretty much makes all lint errors useless since it doesn't give you source offsets. We'll have to figure out if there is a non-hacky way in Parsoid we can look inside the template-wrapped content to resolve this better.
Anyway, after playing around with it, the issue is with {{ללא גלישה| כ"{{ Mediawiki:Gadget-Checkty}}" ) }}נותן. The outer template is generating a span tag with nowrap css, and ends in a whitespace (from the template argument). The following string after the argument will not break a line with Remex. But, Tidy moves the white-space out of the span tag which gives the browser an opportunity to break the line. But, in practice, for this instance, this is a problem only for not-wide-enough screens which it is for me in the parsermigration-edit view. Look for the red wikEd string in your browser. You will see that the remex view is a bit wider than Tidy. But, if I reduce the browser font-size a little bit, this difference goes away. So, this is not a big deal in this case. But, if you wanted to fix it, you can move the whitespace that is right now after the ')' to after the '}}'. But, you can ignore this as well. SSastry (WMF) (talk) 22:23, 8 October 2017 (UTC)Reply