Export Page History top-editors as wikitext table
Closed, ResolvedPublic3 Story Points

Description

The old Page History (aka articleinfo) has an option to export a wikitext version of the table of top editors and some other summary information. This should be added to the XTools rewrite. The export link is in the top bar of the 'Top editors' panel.

The format is e.g.:

* [[Geffrard]]
* en.wikipedia.org
* Total revisions: 43
* Number of editors: 20
* 2017-07-10 03:08:08

<sup>1</sup> Number of edits<br />
<sup>2</sup> Average time between edits
{| class="wikitable sortable"
!Username
!#<sup>1</sup>
!Minor edits
!%
!First edit
!Latest edit
!atbe<sup>2</sup>
!Added (Bytes)	
|-
| [[User:Samwilson|Samwilson]] || 21 || 2 || 9.5 || 2012-08-21, 00:07 || 2017-03-10, 00:49 || 79.1 || 13,486
|-
| [[User:MatthewVanitas|MatthewVanitas]] || 3 || 2 || 66.7 || 2012-10-17, 18:56 || 2012-10-17, 18:57 || 0 || 0
|-
| [[User:The Anomebot2|The Anomebot2]] || 2 || 0 || 0 || 2013-01-25, 16:32 || 2013-01-25, 18:43 || 0 || 37
|-
| [[User:GreenC bot|GreenC bot]] || 1 || 1 || 100 || 2017-04-11, 23:39 || 2017-04-11, 23:39 || 0 || 0
|-
| [[User:Cj1340|Cj1340]] || 1 || 1 || 100 || 2017-01-13, 17:07 || 2017-01-13, 17:07 || 0 || 0
|-
| [[User:Dcirovic|Dcirovic]] || 1 || 1 || 100 || 2016-05-31, 02:57 || 2016-05-31, 02:57 || 0 || 27
|-
| [[User:Trappist the monk|Trappist the monk]] || 1 || 1 || 100 || 2015-09-18, 00:54 || 2015-09-18, 00:54 || 0 || 4
|-
| [[User:Yobot|Yobot]] || 1 || 1 || 100 || 2013-11-08, 10:09 || 2013-11-08, 10:09 || 0 || 7
|-
| [[User:AnomieBOT|AnomieBOT]] || 1 || 1 || 100 || 2013-10-06, 01:34 || 2013-10-06, 01:34 || 0 || 18
|-
| [[User:Bgwhite|Bgwhite]] || 1 || 1 || 100 || 2013-09-17, 17:36 || 2013-09-17, 17:36 || 0 || 1
|-
| [[User:BG19bot|BG19bot]] || 1 || 1 || 100 || 2013-01-15, 00:30 || 2013-01-15, 00:30 || 0 || 0
|-
| [[User:Legobot|Legobot]] || 1 || 1 || 100 || 2012-10-17, 19:00 || 2012-10-17, 19:00 || 0 || 0
|-
| [[User:Citation bot|Citation bot]] || 1 || 1 || 100 || 2012-10-14, 09:25 || 2012-10-14, 09:25 || 0 || 0
|-
| [[User:Mdnavman|Mdnavman]] || 1 || 0 || 0 || 2017-05-20, 22:17 || 2017-05-20, 22:17 || 0 || 19
|-
| [[User:Wavelength|Wavelength]] || 1 || 0 || 0 || 2015-09-23, 23:36 || 2015-09-23, 23:36 || 0 || 0
|-
| [[User:75.0.192.157|75.0.192.157]] || 1 || 0 || 0 || 2012-12-11, 15:15 || 2012-12-11, 15:15 || 0 || 0
|-
| [[User:Jrcrin001|Jrcrin001]] || 1 || 0 || 0 || 2012-12-11, 06:25 || 2012-12-11, 06:25 || 0 || 0
|-
| [[User:75.2.208.87|75.2.208.87]] || 1 || 0 || 0 || 2012-12-10, 14:32 || 2012-12-10, 14:32 || 0 || 0
|-
| [[User:Brad101|Brad101]] || 1 || 0 || 0 || 2012-10-18, 08:30 || 2012-10-18, 08:30 || 0 || 0
|}
Restricted Application assigned this task to Cyberpower678. · View Herald TranscriptMon, Jul 10, 3:16 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Samwilson moved this task from Backlog to Working on the XTools board.Mon, Jul 10, 3:28 AM
MusikAnimal added a subscriber: MusikAnimal.EditedMon, Jul 10, 6:15 PM

I think we should offer this for all tools, so this "Export" function should be extracted out so that you can give it any blob of structured data and have it return the markup for a wikitable. The most relevant example is the EditCounter, which currently users are copying/pasting onto the talk page of an RfA, and the formatting and alignment of the stats is all kinds of out of whack. They need an export tool!

For anywhere there is a chart, we should offer the ability to export the underlying data as CSV, JSON, or download it as a PNG. For this you can probably adapt the Pageviews Analysis code (which also uses Chart.js):
https://github.com/MusikAnimal/pageviews/blob/master/javascripts/shared/chart_helpers.js#L144-L211
https://github.com/MusikAnimal/pageviews/blob/master/javascripts/shared/pv.js#L357-L379

Ugh. I need to refine my Herald script.

Ugh. I need to refine my Herald script.

Yes please do :)

MusikAnimal removed Cyberpower678 as the assignee of this task.Mon, Jul 10, 6:28 PM
MusikAnimal added a subscriber: Cyberpower678.
Restricted Application assigned this task to Cyberpower678. · View Herald TranscriptMon, Jul 10, 6:28 PM
MusikAnimal updated the task description. (Show Details)Mon, Jul 10, 6:29 PM
MusikAnimal removed Cyberpower678 as the assignee of this task.

@MusikAnimal: During meeting today, we decided not to generalize this, but to just limit to the one table for now.

kaldari triaged this task as High priority.Wed, Jul 12, 12:12 AM
kaldari edited projects, added Community-Tech-Sprint; removed Community-Tech.
kaldari set the point value for this task to 3.
Samwilson claimed this task.

PR: https://github.com/x-tools/xtools-rebirth/pull/41

I've added a ?format=wikitext option to the Page History results, which returns the required wikitext. This seemed more robust than a pure client-side solution, and means links can go straight to the wikitext if need be (e.g. from a template). Also, the 'format' variable for rendering a template could be something that's made more general (I thought about overriding Controller:render() and adding it, but as that can come next time there's a need perhaps).

This PR also fixes a tiny unrelated bug with the HTML.

Samwilson closed this task as Resolved.

This is done and working.