Page MenuHomePhabricator

leaction api documentation contains some weird bold parts
Closed, ResolvedPublic

Description

On https://en.wikipedia.org/w/api.php , not sure why some parts are made bold:

institution/<b>*, course/*, student/*</b>, student/add, student/remove,

online/<b>*, online/add, online/remove, campus/*, campus/add, campus/remove, instructor/*</b>,
instructor/add, instructor/remove, eparticle/<b>*, thanks/*</b>, delete/flow-delete-post,

Rest is all plain text (except the start of a section)


Version: 1.23.0
Severity: normal

Details

Reference
bz61834

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:06 AM
bzimport added a project: MediaWiki-API.
bzimport set Reference to bz61834.
bzimport added a subscriber: Unknown Object (MLST).
Reedy added a comment.Feb 23 2014, 9:08 PM

I suspect its EducationProgram actually

Using some sort of formatted output wrongly

andrew.green.df wrote:

After a quick look, I'd say it's more likely a formatter problem. The text seems to come from the EducationProgram extension's Education.php, lines 294-308, but there are no <b> tags in there. Also, all the bold text appears on lines with two or more asterisks, and includes a string ("thanks") that doesn't appear anywhere in extension code. Thanks for thinking of us, though! :)

Reedy added a comment.Feb 24 2014, 1:33 AM

Oh asterix.

Does nothing else add them with its additions to log events?

  • action=foobar *

From https://en.wikipedia.org/w/api.php:

leaction - Filter log actions to only this type. Overrides letype
One value: block/block, block/unblock, block/reblock, protect/protect, protect/modify, protect/unprotect,

protect/move_prot, upload/upload, upload/overwrite, upload/revert, import/upload, import/interwiki,
merge/merge, suppress/block, suppress/reblock, review/approve, review/approve2, review/approve-i,
review/approve2-i, review/approve-a, review/approve2-a, review/approve-ia, review/approve2-ia,
review/unapprove, review/unapprove2, rights/erevoke, gblblock/gblock, gblblock/gblock2,
gblblock/gunblock, gblblock/whitelist, gblblock/dwhitelist, gblblock/modify, globalauth/delete,
globalauth/lock, globalauth/unlock, globalauth/hide, globalauth/unhide, globalauth/lockandhid,
globalauth/setstatus, suppress/setstatus, gblrights/usergroups, gblrights/groupperms,
gblrights/groupprms2, gblrights/groupprms3, suppress/hide-afl, suppress/unhide-afl, move/move,
move/move_redir, delete/delete, delete/restore, delete/revision, delete/event, suppress/revision,
suppress/event, suppress/delete, patrol/patrol, rights/rights, rights/autopromote, stable/config,
stable/modify, stable/reset, spamblacklist/*, renameuser/renameuser, gblrights/grouprename,
gblrights/newset, gblrights/setrename, gblrights/setnewtype, gblrights/setchange,
gblrights/deleteset, abusefilter/modify, abusefilter/hit, articlefeedbackv5/protect,
articlefeedbackv5/create, articlefeedbackv5/helpful, articlefeedbackv5/undo-helpful,
articlefeedbackv5/unhelpful, articlefeedbackv5/undo-unhelpful, articlefeedbackv5/flag,
articlefeedbackv5/unflag, articlefeedbackv5/autoflag, articlefeedbackv5/clear-flags,
articlefeedbackv5/feature, articlefeedbackv5/unfeature, articlefeedbackv5/resolve,
articlefeedbackv5/unresolve, articlefeedbackv5/noaction, articlefeedbackv5/unnoaction,
articlefeedbackv5/inappropriate, articlefeedbackv5/uninappropriate, articlefeedbackv5/archive,
articlefeedbackv5/unarchive, articlefeedbackv5/hide, articlefeedbackv5/unhide,
articlefeedbackv5/autohide, suppress/request, suppress/unrequest, suppress/decline,
suppress/oversight, suppress/unoversight, massmessage/*, massmessage/send, massmessage/failure,
massmessage/skipoptout, massmessage/skipnouser, massmessage/skipbadns, pagetriage-curation/reviewed,
pagetriage-curation/unreviewed, pagetriage-curation/tag, pagetriage-curation/delete,
pagetriage-deletion/delete, institution/<b>*, course/*, student/*</b>, student/add, student/remove,
online/<b>*, online/add, online/remove, campus/*, campus/add, campus/remove, instructor/*</b>,
instructor/add, instructor/remove, eparticle/<b>*, thanks/*</b>, delete/flow-delete-post,
delete/flow-delete-topic, suppress/flow-suppress-post, suppress/flow-suppress-topic,
e/flow-flow-rev-message-edit-title, e/flow-flow-edit-title, n/flow-flow-rev-message-new-post,
n/flow-flow-new-post, e/flow-flow-rev-message-edit-post, e/flow-flow-edit-post,
r/flow-flow-rev-message-reply, r/flow-flow-reply, r/flow-flow-rev-message-restored-post,
r/flow-flow-post-restored, h/flow-flow-rev-message-hid-post, h/flow-flow-post-hidden,
d/flow-flow-rev-message-deleted-post, d/flow-flow-post-deleted,
s/flow-flow-rev-message-censored-post, s/flow-flow-post-censored,
e/flow-flow-rev-message-edit-header, e/flow-flow-edit-summary,
c/flow-flow-rev-message-create-header, c/flow-flow-create-summary, c/flow-flow-create-header,
s/flow-censor-post, s/flow-censor-topic, delete/flow-restore-post, suppress/flow-restore-post,
delete/flow-restore-topic, suppress/flow-restore-topic, newusers/newusers, newusers/create,
newusers/create2, newusers/byemail, newusers/autocreate

This seems to be a MediaWiki core API formatter issue. On lines with more than one asterisk, bolding is applied. The "spamblacklist/*" and "massmessage/*" lines are fine. The other are (greedily) highlighted, it seems.

(In reply to MZMcBride from comment #4)

A less stupid look at what I pasted: http://p.defau.lt/?CY9Ufn_TFEz_2jG32ySa4Q. Apparently a preceding ">" isn't sufficient. Bah.


if ( $this->mHelp ) {

		// make strings inside * bold
		$text = preg_replace( "#\\*[^<>\n]+\\*#", '<b>\\0</b>', $text );

}

From https://git.wikimedia.org/blob/mediawiki%2Fcore.git/d8c03733718ac9eedabad7e4fa569426a56acc31/includes%2Fapi%2FApiFormatBase.php#L276.

I think the real bug here is that things like massmessage/* shouldn't be showing up in the documentation since those are invalid log actions: https://en.wikipedia.org/w/api.php?action=query&list=logevents&leaction=massmessage/*

(In reply to Kunal Mehta (Legoktm) from comment #7)

I think the real bug here is that things like massmessage/* shouldn't be
showing up in the documentation since those are invalid log actions:
<https://en.wikipedia.org/w/api.
php?action=query&list=logevents&leaction=massmessage/*>

Is there a canonical way to get the full list of valid actions?

(In reply to Brad Jorsch from comment #8)

Is there a canonical way to get the full list of valid actions?

There is no way, except of deprecating the wildcard for log action handles, because than all actions will be shown up there.

Remove the wildcard actions with gerrit 117041

(In reply to Umherirrender from comment #9)

Remove the wildcard actions with Gerrit change #117041

Patch Set was changed to let the wilcard actions work. But the format problem still exists.

The simplest fix is to use line anchors and only allow bolding of rows with * at begin and end. But I do not know, if that will break intented highlighting.

(In reply to Umherirrender from comment #11)

The simplest fix is to use line anchors and only allow bolding of rows with

  • at begin and end. But I do not know, if that will break intented

highlighting.

Looking at a few examples, it seems that the only bit of API help text in core and WMF-deployed extensions that wouldn't be caught by a regex along the lines of /^(\s*)(\*.*\*)(\s*)$/m => "$1<b>$2</b>$3" is an instance of "*always*" in ApiQueryRandom. So I'd merge a patch that changed the regex like that.

Change 118130 had a related patch set uploaded by Umherirrender:
Adjust magic bolding in api help to only match lines inside *

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

Change 118130 merged by jenkins-bot:
Adjust magic bolding in api help to only match lines inside *

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

The fix for the bolding should be deployed to WMF wikis with 1.23wmf19, see https://www.mediawiki.org/wiki/MediaWiki_1.23/Roadmap#Schedule_for_the_deployments for the schedule.

Also, the change to the wildcard handling is going out with 1.23wmf18 (which means it's already live on mediawiki.org and the test wikis).