Page MenuHomePhabricator

Preview text for a specific article using local Template:Fødd on nnwiki is in <pre> tags
Open, LowPublic

Description

Seems like it is a template that trigger the behavior.

screenshot-preview-2020-05-19.png (1×1 px, 405 KB)

w:nn:Kjartan Fløgstad

Template used: https://nn.wikipedia.org/wiki/Mal:Fødd

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Removing Wikipedia-Preview (see its description) and adding Page-Previews.

Page content is:

'''Kjartan Fløgstad''' {{fødd|7. juni|1944|Fløgstad, Kjartan}} er ein norsk forfattar fødd i [[industristad]]en [[Sauda]] i [[Rogaland]]. Han har skrive [[dikt]], [[roman]]ar og [[sakprosa]].
Aklapper renamed this task from Preview at nnwiki fails to Preview text for a specific article on nnwiki is in <pre> tags.May 19 2020, 9:56 PM

Summaries are generated by the page content service but this looks like an issue with the article?
I see the source text in the edit mode too:

Screen Shot 2020-05-19 at 5.08.05 PM.png (1×2 px, 708 KB)

Same in Parsoid output: https://nn.wikipedia.org/api/rest_v1/page/html/Kjartan_Fl%C3%B8gstad/3214441. Well, seeing it in VE was a big hint already. I suspect something related to the fødd template, most likely the 3rd parameter. If I remove the 3rd parameter then the problem goes away: with the 3rd parameter --> without. The Parsoid team can figure this out better.

Aklapper renamed this task from Preview text for a specific article on nnwiki is in <pre> tags to Preview text for a specific article using local Template:Fødd on nnwiki is in <pre> tags.May 20 2020, 9:40 AM
Aklapper updated the task description. (Show Details)

{{fødd|7. juni|1944|Fløgstad, Kjartan}} expands to

<span>fødd&nbsp;[[7. juni]]&nbsp;[[1944]]</span>[[kategori:fødde den 7. juni]][[kategori:fødde i 1944]]
{{DEFAULTSORT:Fløgstad, Kjartan}}

So, the newline break after the defaultsort causes {{fødd|7. juni|1944|Fløgstad, Kjartan}} er ... to split right before er ... which now renders as a <pre>..</pre>. Without the 3rd parameter, the defaultsort line is not there and so the problem doesn't show up.

I think in the legacy / core parser, category / and other metadata lines are just completely deleted and so the newlines disappear. This is somewhat of a known edge case. We'll see what we can do about it. But a temporary ugly workround is to break the line in source after the template call like this:

'''Kjartan Fløgstad''' {{fødd|7. juni|1944|Fløgstad, Kjartan}}
er ein norsk forfattar fødd i [[industristad]]en [[Sauda]] i [[Rogaland]]. Han har skrive [[dikt]], [[roman]]ar og [[sakprosa]].

Well, looks like it is not entirely that: https://nn.wikipedia.org/wiki/Brukar:SSastry_(WMF)/Sandbox shows that there is something else going on with that template because unlike what I said there, when I explicit add the defaultsort line there, it behaves differently. Time to look at the template source.

I cannot tell immediately. Will have to investigate more. This looks like some edge case for sure.

It's still unclear to me why this results in a render of <pre>..</pre>.

Parsoid effectively is seeing a\n b which is the wikitext behavior to render lines starting with whitespace in pre tags. So, in that example b renders as <pre>b</pre>

There is no newline in the code, so this must happen during expansion outside what is visible for the editors.

The community has chosen to move the parenthesis out of the template and into wikitext. That makes the problem go away. It still should be fixed somehow, but it is a quick-fix and solves the problem at nnwiki.

Templates with these problems are w:nn:Mal:Levde, w:nn:Mal:Levde-lua, w:nn:Mal:Fødd, w:nn:Mal:Fødd-lua and w:nn:Mal:Død

LGoto triaged this task as Low priority.May 21 2020, 6:09 PM
LGoto moved this task from Needs Triage to Known Differences on the Parsoid board.