Last modified: 2007-08-02 21:17:23 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T12757, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 10757 - Problem with wikilinks in template Parameter
Problem with wikilinks in template Parameter
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
Templates (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-07-30 22:33 UTC by blauerflummi
Modified: 2007-08-02 21:17 UTC (History)
3 users (show)

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


Attachments

Description blauerflummi 2007-07-30 22:33:52 UTC
There is a Problem with wikilinks in template parameters. I wanted to use the template http://de.wikipedia.org/wiki/Vorlage:Infobox_Bahnhof

Some of the parameters add  [[ and ]] to the parameter text in order to automatically generate wikilinks. I want to use the parameter Art, to display two links. Therefore I tried the parameter text" Link1]] , [[Link2". the brakets in the beginning and the end should be inserted automatically, as you can see in the source  code:

{{#if: {{{Art|}}} |
! [[Bahnhof#Bahnhofsarten|Art]]
{{!}}
[[{{{Art|}}}]]
}}

However, the result is not as supposed. Instead, the layout gets totally messed up, as you can see here: http://de.wikipedia.org/wiki/Benutzer:Blauerflummi/Testseite_Infobox_Bahnhof_2 (Use the version history, to see, what it should look like.

What is the reason for this problem, and how can It be solved?
Comment 1 Thomas "Tango" Dalton 2007-07-30 23:18:15 UTC
I think the parser is getting confused when it sees the end of a wikilink without being able to find the start of it, and it never realises that it is in a template parameter, so ends up not parsing anything at all and just outputs the wikitext. It's possible the parser could be altered to work better in this situation, but I doubt it would be easy. I think your best bet is to alter the template (perhaps add an alternative parameter which doesn't have [[ and ]] added to it).
Comment 2 Steve Sanbeg 2007-07-31 22:54:55 UTC
The problem is that once the parser starts parsing the [[, then the | is used for that.  The solution is to delay parsing the link until after the template is parsed.  I've already fixed the example page listed; this behavior is inherent in the syntax, so changing the parser wouldn't help.

Comment 3 TMg 2007-08-02 18:34:54 UTC
This is not a parser bug. Simple change the template:

{{#ifexist: {{{Art}}} | [[{{{Art}}}]] | {{{Art}}} }}

Then almost all kinds of parameter text can be used:

Art = Link1
Art = [[Link1]]
Art = [[Link1]], [[Link2]]
Comment 4 Thomas "Tango" Dalton 2007-08-02 21:17:23 UTC
That's not perfect - really you want an #isAValidPageName rather than #ifexist, otherwise you won't get redlinks for pages that could exist but don't.

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


Navigation
Links