Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Escape | (vertical bar/pipe) in URL in Wiki Markup Template

Is it possible to escape and keep the nonstandard | character as is in an URL in a template Wiki Markup within a table?

{| class="wikitable"
|-
! Test in Table
|-
| [http://example.org/{var1}|{var2}|{var3} Example]
|}

Should render something like this in the table cell

[http://example.org/1|2|3 Example]

and link to

http://example.org/1|2|3

with the vertical bars as is and not encoded like this

http://example.org/1%7C2%7C3

The 3rd party website requires «|» in the URL, I would fix the URL handling on the server side but that is out of my hands for now. Any help on a workaround?

I tried these:

[http://example.org/1|2|3 Example] doesn't work within a table   
[http://example.org/{var1}|{var2}|{var3} Example] works in tables

but both create valid standard URLs where the vertical bar is properly URL encoded as %7C like above which I would like to prevent.

like image 505
mxfh Avatar asked May 11 '12 16:05

mxfh


People also ask

How do you escape a pipe character in a markdown table?

On GitHub, the markdown escape \| works. People jump to HTML too fast without trying escaping the markdown. As of March 2019, in Gitlab Wikis, you still need to use " | " inside the markup code. Still not supported by Bitbucket see bitbucket.org/site/master/issues/17106/…

What markup language does Wikipedia use?

The markup language called wikitext, also known as wiki markup or wikicode, consists of the syntax and keywords used by the MediaWiki software to format a page. (Note the lowercase spelling of these terms.) To learn how to see this hypertext markup, and to save an edit, see Help:Editing.


1 Answers

External links, without support from additional extensions, can only be produced by the [url description] syntax or a plain URL itself. Although as mentioned by skalee, you can use {{!}} or other methods to prevent the pipe symbol from being interpreted as part of the Wikitext syntax, the final link will always be encoded.

Without help from extensions, a quick solution would be JavaScript. (If it is on your own MediaWiki site, that would be very simple. MediaWiki:Common.js contains JavaScript that will be loaded for all users).

like image 190
BenMQ Avatar answered Oct 28 '22 15:10

BenMQ