On Fri, Feb 3, 2017 at 2:47 AM, Bri <[email protected]> wrote:
> I recently upgraded to 1.28.
> Before the update I could pass a category into a template:
>
> <includeonly>{|
> |align="center"|Also see [[{{#if: {{{term|}}}|{{{term}}}|{{{1}}}| }}]]
> |}</includeonly>
>
> But now it fails if I pass "Category:Foo" or ":Category:Foo".
>
> In the first case (with term=) it tries to assign the category to the page
> the template is on.
> In the second case it fails at the colon.
> I have tried using &#58; and making a template:colon that returns &#58; --
> both failed.
>
> I feel that I am missing something simple, but can't figure it out.
>
> -Bri
>
>
>
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

#if introduces a newline in certain circumstances, which causes
problems. However you don't even need it in your example. Try:

<includeonly>{|
|align="center"|Also see [[{{{term|{{{1}}}}}}]]
|}</includeonly>

which should fix the issue.


If you were doing a more complicated example that actually needed the
#if, you could also try putting the : outside the variable:

<includeonly>{|
|align="center"|Also see [[:{{#if: {{{term|}}}|{{{term}}}|{{{1}}}}}]]
|}</includeonly>

(I'm not really sure why the above works. I think the newline gets
suppressed if the previous line ends in a word character or something)

If you really didn't want to force a : to always be there, the last
option is to move the brackets inside the clauses of the #if:

<includeonly>{|
|align="center"|Also see {{#if: {{{term|}}}|[[{{{term}}}]]|[[{{{1}}}]]}}
|}</includeonly>

Hope that helps.

--
Brian

_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

Reply via email to