Template talk:Source

Latest comment: 4 years ago by Pi zero in topic Edit request - broken source templates

Edit request - pub target


{{edit protected}}


  1. Copy https://en.wikinews.org/w/index.php?title=Template%3ASource%2Fsandbox&type=revision&diff=4519394&oldid=4517961
  2. Protect Template:Source/pub

This change will migrate the handling of linking to the publisher to a new sub template, Template:Source/pub.


  • If no {{{pub|{{{publisher|}}}}}} is provided, no publisher is shown, and no category is added (same as current behaviour)
  • If {{{pub|{{{publisher|}}}}}} is provided, and either no {{{pubtarget|}}} is provided, or the one provided is not equal to none, a link is generated (same as current behaviour)
  • If, and only if, {{{pub|{{{publisher|}}}}}} is provided and the {{{pubtarget}}} parameter is set to none, the published field will not link to the publisher using Template:W. Some publishers simply don't have an article on enwiki, and the link is useless. If the link is disabled, the page will also be added to Category:Articles with source templates without publication links, unless the {{{nocat}}} parameter is provided.

So far, I've found five articles where the publication link should be disabled:

  1. Ayatollah Rafsanjani commemorates Iran-Iraq battle victory, w:Red Bolivia
  2. Freshwater lakes in Texas show signs of extreme drought, w:Disaster News Network
  3. Black spot on Jupiter is impact site, says NASA, w:Jupiter.samba.org
  4. Heavy lift Delta IV rocket launch problems, w:EARTHtimes
  5. Apple introduces new iPod with video playback capabilities, w:The Mac Observer

Using an example from the first article (with the categorization suppressed):


|title=Rafsanjani says Iran's past glories should not be ignored 
|author=Islamic Republic News Agency
|pub=Red Bolivia
|date=May 18, 2007}}



|title=Rafsanjani says Iran's past glories should not be ignored 
|author=Islamic Republic News Agency
|pub=Red Bolivia
|date=May 18, 2007}}

will produce

(and obviously, if the nocat parameter weren't passed, the page would be categorized). The category is provided so that users can check from time to time if an article has been created, and if so remove the pubtarget=none parameter.

Let me know if there are any questions. Pinging Pi zero (t · c · b). Thanks, --DannyS712 (talk) 21:44, 6 October 2019 (UTC)Reply

Also, please ping me once is this implemented (or declined) - I have another feature to add --DannyS712 (talk) 00:54, 12 October 2019 (UTC)Reply
@DannyS712: Well... I did deploy this. Two notes, though.
  • I changed the subtemplate to use no instead of none. It's not too late to change, of course. But in all the cases I recall where we've had a field specifying a link with a non-blank special value to suppress the link, the special value has been no, and it seemed like a good idea to use the same convention everywhere. (The ones I can think of atm are on {{topic cat}}.)
  • I'm glad there's a tracking cat; I'm not entirely sure whether this is a good idea, as there's a certain logic in insisting on a link and thus strongly motivating folks to find a suitable target.
--Pi zero (talk) 14:26, 21 October 2019 (UTC)Reply
@Pi zero: thanks - can you apply the |pubtarget=no parameter to the 5 sources listed about where the publisher doesn't have an article? Thanks, --DannyS712 (talk) 17:30, 21 October 2019 (UTC)Reply
Yeah, I did those five. And yet I still feel we're missing something here, some reason why perhaps we shouldn't be delinking these. (Well, if there is a reason, or something subtly different we should be doing, we've now got the infrastructure for it.) --Pi zero (talk) 18:55, 21 October 2019 (UTC)Reply
I've isolated the no case in {{source/pub/no}}, and for the moment I've got it wired to link despite the request not to. It just doesn't feel right to not link those, like we're cutting ourselves off from things; a diminishing of situational awareness, the opposite of what we should be striving for. We've always managed in the past; but, it's wired now so we can request no-link, and the handling of such requests can be adjusted (in whatever way we can imagine) without affecting articles that don't make such a request. --Pi zero (talk) 17:15, 6 November 2019 (UTC)Reply

Edit request - cleanup


{{edit protected}}

Please copy this edit made to Template:Source/sandbox2. The results (testcases) can be seen at Template talk:Source/sandbox2; there is no difference to the functionality or output of the template. The change simply removes 2 extra template calls (1 to the `if` parser function, and 1 to the `author` parameter) by combining the two parts that depend on if an author is provided.

Ping @Pi zero: can you take a look? Unlike the request above, this change makes the template less complicated, and has no effect on the template's result, so it should be pretty easy to examine. Thanks, --DannyS712 (talk) 03:53, 17 October 2019 (UTC)Reply

Done. --Pi zero (talk) 15:11, 21 October 2019 (UTC)Reply

Edit request - parser function cleanup


{{edit protected}}

Please copy Special:Diff/4524098 from the sandbox. This replace

{{#ifeq:{{NAMESPACE}}|Template||{{#if:{{{url|}}}{{{nocat|}}}||[[Category:Articles with broken source templates]]}}}}


{{#if:{{{url|}}}{{{nocat|}}}||{{#ifeq:{{NAMESPACE}}|Template||[[Category:Articles with broken source templates]]}}}}

which functions to switch the order of checks. Since it is far more likely that a url (or a nocat) parameter will be provided than that the template will be used in template space, it reduces the number of parser calls needed:

  • Currently: If not in template space, then check if parameters are passed, then add the category
  • New: If parameters are not passed, then check namespace, then add the category

There should be no functional change in the template's output. @Pi zero: can you take a look? Thanks, --DannyS712 (talk) 17:35, 21 October 2019 (UTC)Reply

Done. --Pi zero (talk) 19:11, 21 October 2019 (UTC)Reply

Edit request - subscription required


{{edit protected}} Please


Current: {{{subscription}}} parameter doesn't exist

New: If {{{subscription}}} is provided, and it equals "required", a new sub-template, Template:Source/subscription, is transcluded.

The sub template's output is just: Template:Source/subscription

The creation of a separate sub-template, however, rather than implementing this within the source template itself, is to mirror the point of Template:Source/fixauthor - to also create a way to track the use of the parameter - only articles that cite sources that require subscriptions will transclude the sub-template.

Test cases are available at Template talk:Source/sandbox - most of the examples was taken from a currently published article, demonstrating the variety of methods that "subscription required" was conveyed - this will also serve to standardize the practice.

@Pi zero: can you take a look? Thanks, --DannyS712 (talk) 18:09, 23 October 2019 (UTC)Reply

@DannyS712: I don't think we should do this, because we don't want to support subscription-only sources. All of those articles are extremely ancient; we have had an explicit policy against pay-to-read sources for a very, very long time. --Pi zero (talk) 01:23, 24 October 2019 (UTC)Reply
I understand that that is the current policy, but we should have a (standard) way of noting that a subscription is needed (eg I have cited the NYT, which generally requires one) - including it would also serve as a flag for reviewers that the source is paywalled --DannyS712 (talk) 01:26, 24 October 2019 (UTC)Reply
@DannyS712: We're not talking about some minor technicality here. There should not be a way to indicate this; it's not okay, and we must not imply otherwise. --Pi zero (talk) 01:39, 24 October 2019 (UTC)Reply
Okay --DannyS712 (talk) 01:41, 24 October 2019 (UTC)Reply
  Not done withdrawn --DannyS712 (talk) 02:27, 24 October 2019 (UTC)Reply

Edit request - ucauthor



Please add NBA as an allowed all caps author. See Celtics lose, extend streak, where it is converted to "Nba" rather than rendering as "NBA". Thanks, --DannyS712 (talk) 07:02, 4 March 2020 (UTC)Reply

  Done --Pi zero (talk) 00:19, 7 March 2020 (UTC)Reply

Edit request - broken source templates


Please copy Special:Diff/4549661 so that only articles are categorized as "Articles with broken source templates", rather than all non-template namespaces. Category:Articles with broken source templates is less useful when there are more user pages in it. Thanks, --DannyS712 (talk) 07:18, 4 March 2020 (UTC)Reply

Perhaps we should take a moment to consider this. The purpose of the category is to locate pages with this problem. Should we perhaps have a list of namespaces where it isn't to be reported? Just eliminating userspace would cut out a lot of permanent entries. I also note that a DPL can easily list all pages in the category in a particular namespace (such as ns:0). --Pi zero (talk) 00:33, 7 March 2020 (UTC)Reply
If we want the category to not be just articles, it should be renamed --DannyS712 (talk) 00:39, 7 March 2020 (UTC)Reply
Renaming seems a lot of trouble for just a few odd cases; I would expect most such pages to be "articles", in a broad sense. The ones in userspace are mostly "articles", broadly speaking. --Pi zero (talk) 00:52, 7 March 2020 (UTC)Reply
I'm planning to factor out a subtemplate /nourl for this case, so subsequent changes to handling of that case won't affect twenty thousand pages. --Pi zero (talk) 21:05, 7 March 2020 (UTC)Reply
Did that. {{source/nourl}} --Pi zero (talk) 21:35, 7 March 2020 (UTC)Reply
@Pi zero: thanks, but can you change | Template|User = to be 2 separate lines so that its clearer? --DannyS712 (talk) 23:23, 7 March 2020 (UTC)Reply
Tweaked. --Pi zero (talk) 23:30, 7 March 2020 (UTC)Reply
@Pi zero: pretty sure the default needs to go last --DannyS712 (talk) 23:31, 7 March 2020 (UTC)Reply
Does it? There was some documentation I was looking at today that said using the #default notation it could go anywhere; which doesn't necessarily mean it's true, of course. I thought it might be clearer that it doesn't apply to those other spaces if it wasn't below them. --Pi zero (talk) 23:35, 7 March 2020 (UTC)Reply
Trying an experiment on the side, it seems to work. --Pi zero (talk) 23:38, 7 March 2020 (UTC)Reply

Although I don't think the name of the category should be considered a problem for other pages showing up there, it would be nice to get permanent items off the list somehow. Without creating some other sort of potential later problem. Further thought is indicated. --Pi zero (talk) 02:50, 8 March 2020 (UTC)Reply

Having taken a look at an item on the list, I found another problem.   Coding something really quick --DannyS712 (talk) 02:54, 8 March 2020 (UTC)Reply
@Pi zero: if you look at A 1-year long strike against FMC Novamed: Women workers allege unfair treatment, the last reference is missing a url. But, the template still tries to render a link. So, please: protect Template:Source/notbroken, and then copy Special:Diff/4550519. This moves all handling of non-broken links to a new subtemplate
  1. If a url is provided, render the current "[{{{url}}} {{{title}}}]"
  2. If a url is not provided, render "{{{title}}}"
  3. If a url is not provided, and nocat is not provided, call Template:Source/nourl.
Thanks, --DannyS712 (talk) 03:03, 8 March 2020 (UTC)Reply
I'd noticed that problematic format. Separating the handling into a subtemplate is an interesting approach, though it increases the number of template calls for something that substantially every source citation uses; it's awfully tempting though, to sort out separate logical concerns. For the actual handling by the subtemplate, though, I'm dubious. I'd suggest, in most cases a missing url is an error and should look wrong. There are a few cases where it's deliberate and should look neat. And then I'm also unsure whether there's something else we're missing here. --Pi zero (talk) 03:33, 8 March 2020 (UTC)Reply
I agree that it should display an error or something, but until we decide what to do, the proposed is better than the status quo (imo) --DannyS712 (talk) 04:16, 8 March 2020 (UTC)Reply
My hesitation is in precaution lest there should be some measure that, on due consideration, would call for some different arrangement of things and thus require some untangling downstream. If we can anticipate suitable infrastructure to support future measures, we can allow for it now; part of the purpose of moving the logic into a subtemplate is, after all, is to avoid later changes to the main template. The current arrangement has been in place for many years, so we can presumably afford a moment to consider before acting. --Pi zero (talk) 12:51, 8 March 2020 (UTC)Reply
Return to "Source" page.