Page MenuHomePhabricator

Pageviews's title parameter is impossible to generate from wiki markup {melc}
Closed, ResolvedPublic3 Estimated Story Points

Description

Pageviews analytics seems to be using its own magical page format which is not possible to recreate from the wiki markup. I'm trying to create this template: https://en.wikipedia.org/wiki/Template:Graph:PageViews

For that, I need a {{{2|{{ARTICLEPAGENAME}}}}} (parameter #2 or the current page name) to be converted to the pageview's title.
This is not possible because:

  • {{urlencode:string|wiki}} does not escape /
  • {{urlencode:string|path}} does not convert spaces to _
  • There are no generic functions to convert title to "db-style" title with underscores
  • There are no functions to do search/replace

Please add support for %20 equivalence to _

Event Timeline

Yurik raised the priority of this task from to Needs Triage.
Yurik updated the task description. (Show Details)
Yurik added projects: Analytics, Pageviews-API.
Yurik added subscribers: Yurik, Milimetric.
Milimetric set Security to None.

agreed this is important, @Yurik, but we've got a big backlog

@Umherirrender - that will generate a URL that does not escape slashes.

{{#if: {{{2|}}} | {{FULLPAGENAMEE:{{{2}}}}} | {{ARTICLEPAGENAMEE}} }} with param 2 = Википедия:Форум/Технический produces this text, which you can see has a slash in it, thus breaking pageviews api request
%D0%92%D0%B8%D0%BA%D0%B8%D0%BF%D0%B5%D0%B4%D0%B8%D1%8F:%D0%A4%D0%BE%D1%80%D1%83%D0%BC/%D0%A2%D0%B5%D1%85%D0%BD%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9

@Milimetric, we do not need to normalize any symbols other than the space. If you treat space and underscore as the same, it will all work great.

Milimetric renamed this task from Pageviews's title parameter is impossible to generate from wiki markup to Pageviews's title parameter is impossible to generate from wiki markup {melc}.Feb 17 2016, 5:00 PM

Change 271540 had a related patch set uploaded (by Milimetric):
Fix handling of encoded and spaced article titles

https://gerrit.wikimedia.org/r/271540

I give up, Herald, you win, you persistent beautiful fool, you.

@Umherirrender, the basic problem is that if current article's name contains spaces, slashes, and non-latin characters, I have not found any way to convert it to the format required by analytics - a string with path-encoded slashes and non-latin chars, plus all spaces converted to underscores.

Change 271540 merged by Milimetric:
Fix handling of encoded and spaced article titles

https://gerrit.wikimedia.org/r/271540

Milimetric renamed this task from Pageviews's title parameter is impossible to generate from wiki markup {melc} to Pageviews's title parameter is impossible to generate from wiki markup {melc} [3 pts].Feb 22 2016, 5:39 PM
Milimetric renamed this task from Pageviews's title parameter is impossible to generate from wiki markup {melc} [3 pts] to Pageviews's title parameter is impossible to generate from wiki markup {melc}.Feb 22 2016, 8:54 PM
Milimetric moved this task from In Code Review to Done on the Analytics-Kanban board.
Milimetric set the point value for this task to 3.

Works, well done!