Template talk:Ln

From Wikipedia, the free encyclopedia


Documentation - Discussion

[edit] Documentation

  • {{ln}} creates a link and additional links to a page of a namespace
  • {{lnt}} creates a link to the talk page of a page

[edit] Usage

Namespace Link to page Link to talk page
Article {{la|ARTICLE}} {{lat|ARTICLE}}
Template {{lt|TEMPLATE}} {{ltt|TEMPLATE}}
Wikipedia {{lw|PAGE}} {{lwt|PAGE}}
User {{lu|PAGE}} {{lut|PAGE}}
Category {{lc|PAGE}} {{lct|PAGE}}
Image {{li|IMAGE}} {{lit|IMAGE}}
Portal {{lp|PORTAL}} {{lpt|PORTAL}}
MediaWiki {{lm|MESSAGE}} {{lmt|MESSAGE}}
Help {{lh|PAGE}} {{lht|PAGE}}

[edit] Example

Code Result
{{ln|Category|Stubs}} Category:Stubs (edit|talk|history|links|watch|logs)
{{lnt|Category|Stubs}} Category talk:Stubs (edit|category|history|links|watch|logs)
{{la|article}} Article (edit|talk|history|links|watch|logs)
{{lat|article}} Talk:Article (edit|article|history|links|watch|logs)
{{lt|tdeprecated}} Template:Tdeprecated (edit|talk|history|links|watch|logs)
{{ltt|tdeprecated}} Template talk:Tdeprecated (edit|template|history|links|watch|logs)
{{lu|example}} User:example (edit|talk|history|links|watch|logs)
{{lut|example}} User talk:Example (edit|user page|history|links|watch|logs)
{{lw|help}} Wikipedia:Help (edit|talk|history|links|watch|logs)
{{lwt|help}} Wikipedia talk:Help (edit|project page|history|links|watch|logs)
{{lc|stubs}} Category:Stubs (edit|talk|history|links|watch|logs)
{{lct|stubs}} Category talk:Stubs (edit|category|history|links|watch|logs)
{{li|Barnstar.png}} Image:Barnstar.png (edit|talk|history|links|watch|logs)
{{lit|Barnstar.png}} Image talk:Barnstar.png (edit|image|history|links|watch|logs)
{{lp|Television}} Portal:Television (edit|talk|history|links|watch|logs)
{{lpt|Television}} Portal talk:Television (edit|portal|history|links|watch|logs)
{{lm|Common.css}} MediaWiki:Common.css (edit|talk|history|links|watch|logs)
{{lmt|Common.css}} MediaWiki talk:Common.css (edit|message|history|links|watch|logs)

{{subst:ln|Category|Stubs}} results (or resulted) in this code:

{{lx|1=:{{ucfirst:Category}}:|2={{ucfirst:Stubs}}|3=:Category talk|4=talk}}

Note the important colon in 1=:, unnecessary (?) for other Lx namespaces.
Substituting both Lx and Ucfirst finally arrived at (line breaks added manually):

 <span class="plainlinksneverexpand">[[:Category:Stubs]] <tt>(</tt>
 [{{fullurl::Category:Stubs|action=edit}} edit]<tt>|</tt>
 [[:Category talk:Stubs|talk]]<tt>|</tt>
 [{{fullurl:Special:Whatlinkshere/:Category:Stubs|limit=999}} links]<tt>|</tt>
 [{{fullurl::Category:Stubs|action=history}} history]<tt>|</tt>
 [{{fullurl::Category:Stubs|action=watch}} watch]<tt>)</tt></span>

[edit] See also

[edit] Discussion


[edit] Comparison

See the Lcs, Lps, Lts, and Tlx talk pages for a comparison of the output of some similar templates. -- Omniplex 19:59, 28 March 2006 (UTC)

[edit] Monospaced

New trick, using monospaced <tt>(</tt> etc. results in better readable output for "(", "|", ")" adjacent to links. -- Omniplex 18:22, 28 March 2006 (UTC)

No &middot; magic in {{Lx}} please, it's converted to UTF-8 by the server not working on old browsers, see Doctl. And the example here should reflect what Lx actually does. -- Omniplex 18:44, 5 April 2006 (UTC)

[edit] Fields

At the moment {{lx}} offers edit, talk, links, history, and watch. I never needed watch, maybe because I've "add to watchlist" in my preferences. Do you use this link in practice? Otherwise I'd like to replace watch by log, something like this:
[{{fullurl:Special:Log|page={{FULLPAGENAMEE}}}} log]
Here's a test log link for Template:! (edit|talk|history|links|watch|logs), what do you think? -- Omniplex 15:36, 13 April 2006 (UTC)

I use watch from time to time, but also want log (the reason I just came here), so I'm trying to add it now.
--William Allen Simpson 21:22, 25 April 2006 (UTC)

Great, AzaToth replaced "watch" by "logs", much more interesting. -- Omniplex 06:23, 26 June 2006 (UTC)

[edit] fullurl

Locke saw a problem with it, fullurl doesn't work with e.g. spaces in the query string, in the log-case page=what ever fails. -- Omniplex 02:36, 26 April 2006 (UTC)

Heck, I saw a problem with it, and tried various remedies.
--William Allen Simpson 11:02, 27 April 2006 (UTC)
Aye, this is also a problem with {{sockpuppet}} I believe (and {{vandal}}). Both of those, IIRC, take a second parameter (the underscored name); one is used for purely cosmetic purposes, the other used to make the log link. So, for example:
{{vandal|Locke Cole|Locke_Cole}}
Which generates:
Locke Cole (talk · contribs · logs · block user · block log)
If you omit the optional second parameter, however, you end up with this:
Locke Cole (talk · contribs · logs · block user · block log)
William made a post to Wikitech-l asking about this (to which I've replied), see here. We could kludge up {{lx}} as was done with the vandal and sockpuppet templates, but I believe we should push for magic words to URL encode/decode strings. It would be cleaner/simpler in the long run. —Locke Cole • tc 03:05, 26 April 2006 (UTC)
Follow-up, I've entered a bug at bugzilla:5720. I'm starting to think it might be better if this were "fixed" by URL encoding the each parameter rather than introducing more magic words. —Locke Cole • tc 03:25, 26 April 2006 (UTC)

{{localurl: almost does what's needed, six characters "/wiki/" too much (and yes, I tested all simple tricks with dots to get rid of it, but that failed as it should - potential security hole). Query strings in URLs are almost free form, anything goes, "=" and "&" are implementaton details, no standard. But "#", space, control, ">", and a few others can be never part of a query string, that's RFC 3986 / STD 66. If fullurl "sees" a space it cannot accept it. -- Omniplex 22:51, 26 April 2006 (UTC)

I haven't tested localurl, but it should operate the same as fullurl. The entire content of the fullurl is the query part, and it handles spaces appropriately to the left of the first pipe, and then continues processing until the closing braces, but doesn't translate the spaces to underscores. This is a a bug, and further discussion on fixing it should continue at bugzilla:5720, with more detailed descriptive discussion on the mailing list.
--William Allen Simpson 10:57, 27 April 2006 (UTC)
Just a note, there is now a {{urlencode:}} magic word. {{urlencode:blah blah + % blah}} produces: blah+blah+%2B+%25+blah (and for direct page links, wikicode treats + the same as _. --> edit this page ) --Splarka (rant) 09:13, 17 June 2006 (UTC)

[edit] Limit

Is there a reason the limit is set to 999, can it be set higher? - LA @ 20:09, 13 August 2006 (UTC)

[edit] Justifying my edit

I say a what links here was between the talk and the history page. This was very disorienting compared to the standard format so I moved it and it looks like I got the code right. Now links is after history. I don't know how touchy people are with this template since it is on all the Afds now (and I think this is a very useful thing), but I think my change improved it. Anomo 02:19, 8 November 2006 (UTC)

[edit] Any opposition to my/someone adding a "Delete" link to this or the "la" template?

Now that it is being used in AfDs it would help closing admins as they could delete clear consensus articles directly from the page. Thoughts?  Glen  11:35, 8 November 2006 (UTC)

It would be fine, but it should be the very last link (rightmost) since most people are not admins and it would get in the way if it was before links that non admins could use. Anomo 22:11, 8 November 2006 (UTC)
There shouldn't be a delete button on it. Even if the discussion is unanimous, the minimum thing the admin should check is if the AfD tag is up on the article. But I propose switching edit and discuss buttons so that they match the order of the tags on top of each page. ~ trialsanderrors 00:11, 22 November 2006 (UTC)
Although {{Newdelrev}} now uses a separate parenthesis for Special:Undelete. I wonder if we can integrate this here with an #ifexist statement. ~ trialsanderrors 07:38, 17 December 2006 (UTC)

[edit] class=lx

I added "class=lx" to Template:lx for use in scripts. I realize this isn't currently defined in the stylesheet, but it allows a lot of script functionality. Any objections? Quarl (talk) 2007-01-01 22:09Z

No objection, thought you only had made a tyop, thou I wonder what scripts would need/use it. AzaToth 22:48, 1 January 2007 (UTC)
Thanks. (One script that uses it is xfdclose.js which adds a bunch of buttons for closing AFDs.) Quarl (talk) 2007-01-01 23:00Z