Page MenuHomePhabricator

Please create %%wordcount%%, %%linkcount%%, %%imagecount%%, %%categorycount%%, %%interwikicount%%
Closed, ResolvedPublic


These variables are already displayed in the Start tab's 'Page statistics' box. Having them as keywords, like %%pagetitle%%, would be very helpful (particularly %%wordcount%%).

Event Timeline

Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptJul 6 2016, 12:18 PM
Reedy added a subscriber: Reedy.Jul 6 2016, 12:20 PM

Why would you want to substitute them in?

Mostly due to this comment (to help find pages potentially mis-classified as non-stubs via %%wordcount%%).

Reedy added a comment.Jul 7 2016, 10:24 AM

Why would you want them in the page though?

Tom.Reding added a comment.EditedJul 10 2016, 12:32 PM

I'd add %%wordcount%% (or whichever keyword) temporarily to the page to assist with processing. If greater than some #, or some # of digits, I skip the page. If less than some #, or some # of digits, I operate on the page.

This will probably require re-parsing the page, but it is doable. It would be useful if keywords (temporary or permanent) placed by the custom module were evaluated. That way, I could temp-add %%wordcount%% via the custom module, then use the advanced rules to evaluate it. Currently, for example, if I add %%pagename%% via both the custom module and via advanced rules, only the advanced rules' instance is evaluated. Is that on purpose?

I could workaround this entirely (not to obviate this request though) by calculating wordcount directly in the custom module by copying the relevant code. Would that be possible and, if so, could you point me to it?

Reedy added a comment.Jul 10 2016, 2:02 PM

Tools.WordCount(articleText) in a CustomModule should work

Well shit, that's great! Indeed it does!

Tom.Reding closed this task as Resolved.Jul 10 2016, 2:28 PM
Tom.Reding claimed this task.