Template talk:Lw
Add topicAppearance
Latest comment: 11 years ago by Sidelight12
I found a good compromise for this template:
- {{lw|Unknown|}} should show "Unknown"
- {{lw|Unknown}} should show "w:Unknown"
- {{lw|Colloquium}} points to wikiversity:Colloquium, as "Colloquium"
Sidelight12 Talk 02:24, 14 December 2012 (UTC)
- I agree. Default behavior would be to show the w:, add a second parameter to hide the w:. I haven't experimented with empty parameters yet. I'm not sure if there's a way to tell the difference between a missing parameter and an empty one. It might need to be something like {{lw|Unknown|-}}. The - could be any character, but documenting it as a minus makes it clear that it is subtracting the w:. Let me know if you need help with the coding. -- Dave Braunschweig (talk) 04:03, 14 December 2012 (UTC)
- For other types of links it works. [[w:Colliquium|]] shows up as Colliquium. I finally learned the whole word doesn't have to be retyped, which I was trying to get around. This template and using the | after links solves the problems very well. I could try. Sidelight12 Talk 13:07, 14 December 2012 (UTC)
- I put this in the sandbox, the | with spaces around it needs to be turned into a variable: {{#ifexists:{{{1|}}}|{{{1|}}}|[[w:{{{1|}}}|{{#ifexpr:{{{1|}}} | |w:{{{1|}}}|{{{1|}}} }}]]}} Sidelight12 Talk 17:20, 14 December 2012 (UTC)
- I noticed a -1 removes a string and m:Help:Extension:ParserFunctions#Stripping whitespace which don't seem necessary. I think it should be "|]]" to remove the "w:" like the other link templates so the difference doesn't have to be remembered and looked up each time it is used. Also, customized text is unnecessary for this template for simplicity. Sidelight12 Talk 14:15, 14 December 2012 (UTC)
Sidelight12 Talk 16:18, 14 December 2012 (UTC)
- Now adjusted to support either a single parameter or a two parameter format. The single parameter format displays the leading w:. The two parameter format does not display the leading w:. Content for the second parameter is ignored. It is only checked for existence. Enjoy! -- Dave Braunschweig (talk) 01:09, 15 December 2012 (UTC)
- That's perfect. Sidelight12 Talk 11:29, 16 December 2012 (UTC)