Page MenuHomePhabricator

Cannot put -{ }- into CharInsert
Closed, ResolvedPublic

Description

Author: rainman

Description:
The -{ }- characters are used in languages with variants (like Serbian wiki).

Here is the problem. The following line:
<charinsert><nowiki>-{</nowiki>+<nowiki>}-</nowiki></charinsert>

is in Parser.php replaced with:
<a onclick="insertTags('-{','}-','');return false" href="#">-{}-</a>

However, this replecement is done before $wgContLang->parserConvert() is called,
which interprets
the -{ }- characters, and deletes them, leaving:
<a onclick="insertTags('','','');return false" href="#"></a>

A dirty hack is possible in LanguageConverter::parserConvert(), however a better
solution would
be if the <nowiki> tags (or actualy the UNIQ-hack tags for nowiki) would be put
in before parserConvert(), i.e. if the charinsert would interpret <nowiki> tags
in the usual way.


Version: unspecified
Severity: normal
Platform: PC
URL: http://sr.wikipedia.org/wiki/MediaWiki:Edittools

Details

Reference
bz6500

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:22 PM
bzimport set Reference to bz6500.
bzimport added a subscriber: Unknown Object (MLST).

Well, there's a hack in MediaWiki:Edittools itself: since long time ago, we've been using <charinsert>-{-}--{{}-+-{}}--{-}-</charinsert> which isn't pretty but is effective. Does this bug really need to be fixed, because it wouldn't make much difference.

How about using entities, would that help? It seems to work on testwiki, however it might have different configuration (I don't know how language variants are set).

So something like

<charinsert>-&#x7b;+&#x7d;-</charinsert>

or escape the dashes or both.

Another approach is this (successfully used on our wiki to hack some issues):

Add <charinsert>{-+-}</charinsert> instead and put some code in MediaWiki:Common.js (just simply iterate over the links, find the one with this text and replace the onclick) which will do the replace to "-{", "}-".

EN.WP.ST47 wrote:

I performed the following test on the serbian wikipedia:

-{x}-

<nowiki>-{</nowiki>x<nowiki>}-</nowiki>

It rendered as follows:

x

-{x}-

Closing as fixed.