Last modified: 2011-03-13 18:04:27 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 3527 - [[x||y|z]] (or similar) as a shortcut for [[xy|xz]]
[[x||y|z]] (or similar) as a shortcut for [[xy|xz]]
Product: MediaWiki
Classification: Unclassified
Page editing (Other open bugs)
All All
: Lowest enhancement with 7 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
: 3523 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2005-09-21 12:16 UTC by Metello Bordin
Modified: 2011-03-13 18:04 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---

diff for Parser.php 1.5rc4 (941 bytes, patch)
2005-09-21 16:16 UTC, Metello Bordin

Description Metello Bordin 2005-09-21 12:16:33 UTC
It would be an improvement if links like [[supereroe|supereroi]] (translated:
[[superhero|superheros]]) could be created with this syntax [[superero||e|i]].
This feature would be useful for non-english languages, in which plurals are not
made with a suffix.
Comment 1 Metello Bordin 2005-09-21 12:22:56 UTC
I have a suggestion to implement this improvement. In "Parser.php" file,
"pstPass2" function, add "$p5 = "/\[\[({$tc}+)\\|\\|({$np}+)\|({$np})]]/";" near
2976th line, then  six lines later add "$text = preg_replace( $p5,
'[[\\1\\2|\\1\\3]]', $text );". I tried and it works.
Comment 2 Filip Maljkovic [Dungodung] 2005-09-21 13:31:39 UTC
It doesn't work on 1.5beta3 nor 1.5rc3. Tested and not working
Comment 3 Metello Bordin 2005-09-21 16:04:59 UTC
Try this:
Add (without ") "$p5 = "/\[\[({$np}+)\\|\\|({$np}+)\\|({$np}+)]]/";" to line
2900 of "includes/parser.php", after "$p4...."
Then add "$text = preg_replace( $p5, '[[\\1\\2|\\1\\3]]', $text );" to line
2906, BEFORE "$text = preg_replace( $p4, ...".
In my installation it works, try [[Main Pag||e|es]].
Comment 4 Metello Bordin 2005-09-21 16:16:04 UTC
Created attachment 909 [details]
diff for Parser.php 1.5rc4
Comment 5 Filip Maljkovic [Dungodung] 2005-09-21 16:51:41 UTC
The matter is: I put it in the exact same spots, but the problem was: the line

$p5 = "/\[\[({$np}+)\\|\\|({$np}+)\\|({$np}+)]]/";

is different from

$p5 = "/\[\[({$tc}+)\\|\\|({$np}+)\|({$np})]]/";

by 2 characters. (The two lines are from your two different posts)
It works now, so thanks. :)
Comment 6 Filip Maljkovic [Dungodung] 2005-09-21 16:58:19 UTC
Oh and to thank you for this "extension" overall. I'm Serbian and we could find
it really useful, so thanks in the name of the Wikipedias from the Balkan. I
hope this gets implemented as quickly as possible.
Comment 7 Filip Maljkovic [Dungodung] 2005-09-21 17:30:53 UTC
I've encountered a minor glitch with the code. Namely, when the new markup is
saved and when you go to reedit the article, old markup style shows. So, if I
write [[foo||bar|foo]] and save it and then go to the edit box again,
<nowiki>[[foobar|foofoo]]</nowiki> shows, which can be good, but also can't.
Comment 8 Ævar Arnfjörð Bjarmason 2005-09-21 17:39:43 UTC
Changed the summary to actually give an idea of what the bug is about.
Comment 9 Metello Bordin 2005-09-21 18:19:17 UTC
It's not a glitch, but it's the way it works MediaWiki, it's the same for [[foo
(bar)|]], after you save it, it became [[foo (bar)|foo]]
Comment 10 Filip Maljkovic [Dungodung] 2005-09-21 21:02:34 UTC
In my opinion, both should be left in their original form even after the reedit
(they should stay [[foo (bar)|]] and [[foo||bar|bat]]).
Comment 11 Filip Maljkovic [Dungodung] 2005-09-21 21:16:55 UTC
*** Bug 3523 has been marked as a duplicate of this bug. ***
Comment 12 Brion Vibber 2005-09-21 21:55:23 UTC
I'm pretty leery of doing this as a pre-save transform; they're not 
discoverable for users (since they don't appear in page source) and are hard 
to figure out and debug when something happens unexpectedly since output 
doesn't show in the preview edit box.

Also I'm not sure about the double-pipe. In general we should avoid using 
different numbers of adjacent symbols to mean different things, as it's 
tricky to parse. (Sadly we already have a bunch of those!)
Comment 13 Rob Church 2005-09-21 22:01:46 UTC
I agree, this will get somewhat confusing.
Comment 14 Metello Bordin 2005-09-22 12:13:46 UTC
Doing this as a pre-save transform is the easiest way to do it and it follows
the [[foo (bar)|]]  syntax.

The double-pipe is the first symbol used to trasform links, i realy can't
introduce new syntax in [[ ]].

Btw, i think that if we must make it in a more difficult way, it will be
implemented in a long time, whereas it is a very little and simple improvement.
Comment 15 Brion Vibber 2005-09-22 17:59:04 UTC
The plus side of a pre-save transform is that if we decide to change or dump it, already-written pages don't 
have compatibility problems.

So, if there's broad agreement for a trial run we could try this. I still am not too fond of the double |s though, 
it's kinda weird.
Comment 16 Filip Maljkovic [Dungodung] 2005-09-22 19:13:46 UTC
But still doable. :)
Comment 17 Metello Bordin 2005-09-23 16:52:21 UTC
I agree ;)
Comment 18 Mark 2005-09-23 17:26:11 UTC
1) Why do we need a double-pipe? Why not just [[x|y|z]]???
2) Why does it need to be a pre-save transform? Why can't it be whatever [[x]]y
is (ie, a rendering thing)?
Comment 19 Metello Bordin 2005-09-23 18:38:37 UTC
1) isn't [[x|y|z]] already taken? I saw it but i can't remeber where...
2) because it is only a trick, a sort of macro, to avoid typing too much, once
is used it done. Then beacuse "if we decide to change or dump it,
already-written pages don't
have compatibility problems."
Comment 20 Andrius Ramanauskas 2005-09-24 06:01:36 UTC
I'd propose something like [[x|-en|-ing]] or similar as [[x||y|z]] is not very intuitive format, but in general anything like 
that would be very helpfull in some languages (at least in Lithuanian ti would be very nice to have)
Comment 21 Metello Bordin 2005-09-24 09:55:53 UTC
[[x|-en|-ing]] is more intuitive, i agree whith Andrius.
Comment 22 Rowan Collins [IMSoP] 2005-09-24 14:54:11 UTC
*** Bug 3523 has been marked as a duplicate of this bug. ***
Comment 23 Brion Vibber 2006-06-03 23:46:19 UTC
Doesn't appear to be much support or interest in this; 
unnecessary markup complication; similar use of markup is 
proposed for other users, will probably want to keep it open 
for more important things.

WONTFIXing this for now.

Note You need to log in before you can comment on or make changes to this bug.