Page MenuHomePhabricator

Text Extracts used in Page Previews shows strange characters from template
Closed, ResolvedPublic

Description

When viewing a page preview that contains the {{nts}} template in the opening section Page Previews displays unwanted characters from the transcoded template instead of the expected number.

{{nts|2,887,974 }}

Steps to reproduce:
Enable Page Previews beta feature
Visit a page that contains a link to Kiev such as https://en.wikipedia.org/wiki/Hyman_Kaplan
Hover over the link to Kiev.

Results:

Screen Shot 2017-03-01 at 4.24.31 PM.png (377×588 px, 242 KB)

Expected behavior:
Just the desired output, in this example, "2,887,974"

The API result for the Kiev page on English Wikipedia:
https://en.wikipedia.org/w/api.php?action=query&prop=extracts&exchars=3000&titles=Kiev

Shows the HTML

<span>7006288797400000000\u2660</span>2,887,974

Note: I'm also seeing the strange preview in Safari's autocompletion suggestions.

Screen Shot 2017-03-01 at 4.33.29 PM.png (157×734 px, 48 KB)

Event Timeline

Maybe something in the template missing a "noprint" class, like this?

Seems resolved by the template edit

Screen Shot 2017-03-02 at 4.04.26 PM.png (318×504 px, 213 KB)

ovasileva claimed this task.

Article edit, that is.

We'll have a look into having a generic class for hiding things from extracts, instead of using the class for hiding things for printing.

This looks a lot like T131923: de.wikipedia.org prefixes geocoordinates for some articles using api interface btw.

Currently ignored classes are defined by site configuration, but that doesn't really scale I think. Either that configuration should be moved to on-wiki json blob, something like VE has for Citoid and the charinsert panel for instance, or indeed a separate classname or something.

And no matter what, as being user generated content, you will always have some of this, the point is giving the community influence on fixing that where required.

Here, it wasn't even really needed.