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:

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.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 1 2017, 10:44 PM

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

Seems resolved by the template edit

ovasileva closed this task as Resolved.Mar 2 2017, 3:12 PM
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.

TheDJ added a subscriber: TheDJ.Mar 2 2017, 4:28 PM

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.