: Mediawiki: How to escape '=' in Template parameter values I want to pass an URL to my Mediawiki template as a parameter, but if it contains =, it treats the URL as a named parameter. Therefore,
I want to pass an URL to my Mediawiki template as a parameter, but if it contains =, it treats the URL as a named parameter. Therefore, the following does not find and replace the template parameter {{{1}}}:
{{MyUrl www.example.com/abstract.cfm?uri=aa-123456}}
Escaping = with %3D leads to problems of passing the link in the browser (Chrome) — the server responds with 404.
Also, installing extensions on this Mediawiki server is not recommended. Can this be done in Vanilla Mediawiki?
More posts by @Murray155
1 Comments
Sorted by latest first Latest Oldest Best
The workarounds:
Explicitly preceed the argument with the (numerical) parameter name in the call to template, like this:
{MyUrl|1=http://www.example.com/abstract.cfm?uri=aa-123456}}
Another solution: one can create a symbolic name for the parameter. Then the template may look something like this:
See here: [{{{link}}} (link)]
And the call like this:
{MyUrl|link=http://www.example.com/abstract.cfm?uri=aa-123456}}
Combine the solutions to accept both named and ordered parameters for when there is no '=' sign there. The template (notice the empty string after '|' as a default value so that only one parameter is used):
See here: [{{{link|}}}{{{1|}}} (link)]
This can be used with the call using 'link' above and also like this:
{MyUrl www.example.com/no/equal/signs/}}
Note, that the "combined" approach is not recommended due to inconsistency in parameter usage, unless there are too many calls across the wiki to the template using the ordered parameters, making it impractical to change all calls to the named parameter approach.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.