Template talk:projectlink

From Wiktionary, the free dictionary
Latest comment: 1 year ago by Dunderdool in topic Capitalizing
Jump to navigation Jump to search

Documentation[edit]

Synopsis[edit]

This template is used for linking to pages on our sister projects (Wikipedia, Wikisource, and so on).

For example, this Wiki code:

* {{projectlink|pedia|Φυ|Μβαρ|lang=el|sc=Grek}}

produces this output:

{{pedialite|…}} is a shortcut to {{projectlink|pedia|…}}.

Parameters[edit]

This template's parameters are as follows:

  1. required The sister project, most commonly pedia (for Wikipedia) or species (for Wikispecies). There are also a few special values, such as dab (for Wikipedia disambiguation pages) and cat (for Wikipedia category pages). For a full list of possibilities, see Special:Prefixindex/Template:PL: (where the part after the PL: in a template-name is a possible value here; struck-through template-names indicate redirects).
  2. The name of the page on the sister project; defaults to the name of the current Wiktionary entry, but with an initial capital if applicable.
  3. The text that should be displayed on the link; defaults to the name of the page on the sister project.
lang=
The language-code for the sister project; defaults to en.
sc=
The script-template that the link text should be wrapped in, if any. Otherwise it is bold.

Discussion[edit]

Sidebar link[edit]

Should the sidebar link produce a capitalized article title, for consistency with the in-body link? —RuakhTALK 08:49, 21 November 2007 (UTC)Reply

Yes, probably. It isn't using quite the same code, and probably should (use ucfirst: if the display is {1} or {PAGENAME}, not if the display is {2} (parameters to the PL template, these are {2} and {3} respectively to {projectlink}); this requires carefully editing the individual PL templates; I'll do that but not right now (;-) Robert Ullmann 09:47, 21 November 2007 (UTC)Reply

Wikipedia default[edit]

Is the fact that {{{1}}} defaults to pedia being used at all? Because I think that parameter should simply be made fully mandatory, rather than the current quasi-mandatory sometimes-work,-sometimes-not we have now. It's not like logically an editor should expect a template called "projectlink" to link to Wikipedia, anyway. —RuakhTALK 08:49, 21 November 2007 (UTC)Reply

I was emulating the existing function in {projectlinks}, but I agree. The existing calls need to be looked at; we just got an XML dump so that isn't too hard, even if there are too many to just use what-links-here. Robert Ullmann 09:47, 21 November 2007 (UTC)Reply
There were three (;-). Fixed. Removed the default from the template. Robert Ullmann 11:53, 21 November 2007 (UTC)Reply
Thanks! :-) —RuakhTALK 20:33, 21 November 2007 (UTC)Reply

Centralizing code.[edit]

Currently, there's a lot of duplicate code among the various {{PL:*}} templates. Specifically, I believe that all the code is the same for determining the link target and the link text, except of course for the project prefix in the link target, and the application of {{ucfirst:}}. It seems that rather than simply passing through {{{2}}} and {{{3}}} as 1= and 2=, it would make sense for this template to handle all the details itself. The only annoying thing is that it will somehow need to indicate to the sub-template whether the 2= was an explicit {{{3}}} or a computed one, since the sub-templates that use {{ucfirst:}} won't want to force-capitalize an explicitly-provided value. I think the simplest way is for this template to compute both a 2= and a uc2=, and different sub-templates can choose which they want. It's a bit of pointless overhead, but I think the maintenance benefits will be worth it. (Another benefit is that we can then incorporate the handling of {{{sc}}} into this template, so sub-templates won't need to worry about it at all.)

So, should I go ahead with that change?

RuakhTALK 02:25, 13 April 2008 (UTC)Reply

function "Projectlinks" use on other skins.[edit]

Hello, i was wondering if the function on "Projectlinks" works on other skins. I'd like to use it, but my wiki doesn't use Vector or Monobook. Thank you, and i apologize if this is in the wrong place. Bud0011 07:29, 16 December 2010 (UTC).Reply

Optional italics[edit]

Could this be fitted with an optional "i" parameter so that italics could be specified for the taxonomic names that are supposed to appear in italics? The kinds of names are all virus names and all taxonomic names at the rank of genus and below. Special (manual for now) provision needs to be made for names that include "subsp.", "var.", "morph"/"morpha", "subg.", and similar.

The same need applies to {{specieslite}}, {{pedia}}/{{pedialite}}, {{commonslite}}, {{wikispecies}}, {{wikipedia}}, {{commons}}, and {{commonscat}}.

I could try to do this myself, but my template foo is weak, the template architecture is more complicated than I understand, and the templates are widely transcluded. I am doing this for various "reference" templates used for taxon names, which are both simpler in architecture and less widely transcluded. DCDuring TALK 17:56, 27 January 2015 (UTC)Reply

Make sidebar link match {{wikipedia}}[edit]

This has annoyed me for a while. {{wikipedia}} formats the sidebar links with the language code in superscript, like this Wikipedia: he, rather than he.Wikipedia. I think we should change this template to match because the first format is better looking and more clear. I propose replacing lines 27-35 at Template:projectlink/Wikipedia (which is protected) with:

  Add caption to it
  -->Wikipedia {{#if:{{{lang|}}}|<sup>{{#invoke:wikimedia languages/templates|getByCodeWithFallback|{{{lang}}}|getCode}}</sup>}}<!-- 

  Add page title to it if differs from current page title
  -->{{#ifeq:{{lc:{{#if:{{{dab|}}}|{{{dab}}}|{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{dab|}}}|{{{dab}}}|{{ucfirst:{{PAGENAME}}}}}}}}}}}}|{{lc:{{PAGENAME}}}}||<!--

  --><nowiki>:</nowiki> {{#if:{{{dab|}}}|{{{dab}}}|{{#if:{{{1|}}}|{{{1}}}|{{#if:{{{dab|}}}|{{{dab}}}|{{ucfirst:{{PAGENAME}}}}}}}}}}}}]]<!--

--></span><!--

Enosh (talk) 10:16, 11 May 2016 (UTC)Reply

 Done thanks to Codecat and the Luacisation of project link templates. —Enosh (talk) 14:08, 21 October 2016 (UTC)Reply

End point[edit]

The end point in the result on Wikipedia.Wikipedia of the template makes it unusable in the middle of a sentence. --DominiqueM (talk) 12:34, 26 January 2019 (UTC)Reply

Capitalizing[edit]

The default for 1911 needs to be uppercase, because sequin links to the lowercase. Dunderdool (talk) 18:35, 9 July 2022 (UTC)Reply

I checked and no Wikisource subpage of 1911 Encyclopædia Britannica begins with a lowercase letter, except for one exception that we probably won't need to link to. Therefore, it seems like making initial-uppercase the default wouldn't break anything. 98.170.164.88 18:41, 9 July 2022 (UTC)Reply
Also, we can probably cut the Gordian knot entirely but not linking to EB. WP started kicking their asses years ago! Dunderdool (talk) 19:27, 10 July 2022 (UTC)Reply