Template talk:Shortcut

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Direct link[edit]

Since this is placed on the policy in question, the links displayed do not do anything but make your browser reload the page. I thought it'd be nice to send them directly to the page of the redirect, as that adds a little bit of use to an otherwise useless link--it makes it easier to check the history, etc. and see if it'd be alright to reappropriate the shortcut in question. Red Slash 02:48, 10 January 2014 (UTC)

Hi, could someone please change the bluelinks in this to be "redirect=no" links? I did it on Template:Shortcut-l and the text <small>[[Wikipedia:Shortcut|Shortcut{{#if:{{{2|}}}|s}}]]: {{#if:{{{1|}}}|* {{no redirect|{{{1}}} }}{{#if:{{{2|}}}| * {{no redirect|{{{2}}}}} }}{{#if:{{{3|}}}| * {{no redirect|{{{3}}}}} }}{{#if:{{{4|}}}| * {{no redirect|{{{4}}}}} }}{{#if:{{{5|}}}| * {{no redirect|{{{5}}}}} }}{{#if:{{{6|}}}| * {{no redirect|{{{6}}}}} }}{{#if:{{{7|}}}| * {{no redirect|{{{7}}}}} }}{{#if:{{{8|}}}| * {{no redirect|{{{8}}}}} }}{{#if:{{{9|}}}| * {{no redirect|{{{9}}}}} }}{{#if:{{{10|}}}| * {{no redirect|{{{10}}}}} }}{{#if:{{{11|}}}| * {{no redirect|{{{11}}}}} }}{{#if:{{{12|}}}| * {{no redirect|{{{12}}}}} }} }}{{#if:{{{2|}}}| * [[{{{2}}}]] }}{{#if:{{{3|}}}| * [[{{{3}}}]] }}{{#if:{{{4|}}}| * [[{{{4}}}]] }}{{#if:{{{5|}}}| * [[{{{5}}}]] }}</small>

could be inserted in the corresponding part of the template... Or just copy/paste the content from my test case: {{shortcut/sandbox3}}


Thanks! Red Slash 04:15, 7 March 2014 (UTC)

I guess doing this right after you've requested it in an edit request is bad timing, but I've just implemented this as a Lua module - see Module:Shortcut. This will remove the 10-shortcut limit, and will also mean that the template doesn't have to check all 10 parameters if only one or two have been specified in the template invocation. I've adjusted it to add redirect=no, though, so the net effect should be the same. :) Have a play around with it and see what you think. There should probably be some more time for people to discuss this before we make any changes to the main template, so I'm marking this request as answered for now. — Mr. Stradivarius ♪ talk ♪ 06:31, 7 March 2014 (UTC)

Protected edit request on 4 December 2014[edit]

Please replace the current version with this sandbox version. The content/function change (starting from a duplicate of the current template) is here; the subsequent changes change nothing other than the code's presentation.

The key content/function change is the removal of whitespace accompanying the parameters. This, for example, releases restrictions on parameter formatting in templates that call {{Shortcut}}, such as {{Village pump page header}} (see "Third" shortcut output below):

{{Village pump page header
 | Test
 | This parameter, the second, carries text...

...that can be quite lengthy.
 |First |Second |Third
  Policy   Technical   Proposals   Idea lab   Miscellaneous  
This parameter, the second, carries text...

...that can be quite lengthy.

« Older discussions, 1, 2

Sardanaphalus (talk) 20:19, 4 December 2014 (UTC)

Again you're messing with newlines for no apparent benefit. It makes it very difficult to carry about a comparison with the sandbox diff link above. --Redrose64 (talk) 20:41, 4 December 2014 (UTC)
  • Incorrect – if, that is, you read the request and followed the second link ("here") provided.
This article, in the context of the comprehension of and/or reaquaintance with code, might indicate why I take trouble over ("mess with") spacings, alignments and so on.
Sardanaphalus (talk) 01:17, 5 December 2014 (UTC)
Red information icon with gradient background.svg Not done: please establish a consensus for this alteration before using the {{edit protected}} template. I also object to this pointless change. I have fully read your request, and that article you link 1) doesn't use this template, so I see no connection and 2) looks horrible as there is way too much whitespace on my screens resolutions. — {{U|Technical 13}} (etc) 16:17, 8 December 2014 (UTC)
  1. I don't understand how this change is seen as pointless. This template assumes parameters are fed to it without whitespace. An example of what happens when this doesn't occur is given above, using a template (Village pump page header) that calls/invokes/transcludes this template. The change therefore strips parameters of whitespace they may include. ("The key content/function change is the removal of whitespace accompanying the parameters.")
  2. If by "that article" you're referring to the article Principles of grouping linked in my reponse to Redrose64, it's not meant as an example of where this template {{Shortcut}} is in use / malfunctioning / etc. It's to suggest (to Redrose64) why I try to give code layout some structure.
  3. I don't understand what you mean by the proposed version looking "horrible ... way too much whitespace". The change made doesn't add any whitespace to what is already a relatively small box on the righthand side of the page.
Sardanaphalus (talk) 17:53, 9 December 2014 (UTC)
The parameter whitespace fix seems a positive change. It's the "changes in the code's presentation" which seem to be generating disagreement here. Would you mind doing the former without the latter? — Martin (MSGJ · talk) 21:54, 9 December 2014 (UTC)
The former is here (yes, the same "here" linked in the intial request and again for Redrose64). It's misreading the request that has generated the smoke and mirrors, not the increase in the clarity of the code's presentation – although I suspect that's already recogniszed. Thank you for your post. Sardanaphalus (talk) 22:13, 11 December 2014 (UTC)
Then why not sandbox that change only and leave out all of the unnecessary stuff? --Redrose64 (talk) 22:52, 13 December 2014 (UTC)
  • Because I believe the other changes are worthwhile. Anyone with the required access is able to make that change only. Sardanaphalus (talk) 12:36, 16 December 2014 (UTC)
This request reminded me - I had previously written Module:Shortcut but forgotten about it. I've fixed it up, and changed the test cases so that they are more useful for comparing the template versus the module. The module also fixes the newline issue that Sardanaphalus had fixed. What would people think of switching this template to use the module instead? — Mr. Stradivarius ♪ talk ♪ 14:12, 15 December 2014 (UTC)
  • Sounds like a timely step forward here; thank you for suggesting. Sardanaphalus (talk) 12:36, 16 December 2014 (UTC)
Yes check.svg Done Ok, the module is now up live. — Mr. Stradivarius ♪ talk ♪ 12:34, 17 December 2014 (UTC)

Direct links[edit]

Hi, could the links in the template please be "redirect-only" links? There's really no need for the links to even be there if they're just going to lead you back to the page you're already on; redirect-only links let you check out what's linking to those exact shortcuts, etc. Thanks! Red Slash 03:41, 10 April 2015 (UTC)

@Red Slash: You put this on as a request to edit Template:Shortcut, but that does pretty much nothing nowadays other than send information to Module:Shortcut for processing. You'd need a Lua specialist to amend that; but regardless, Red information icon with gradient background.svg Not done: please establish a consensus for this alteration before using the {{edit template-protected}} template. --Redrose64 (talk) 10:29, 10 April 2015 (UTC)

Strange problem[edit]

I'm having a strange problem with {{Shortcut-l}}.

I've tried using it on WP:COI, because I've been adding images or quote boxes that take up the right-hand side. But the template is repeating all but the first shortcut. You can see it in this section, where the second shortcut is repeated, and in this one, where it repeats the second and third.

Any suggestions for how to fix this? SarahSV (talk) 05:21, 9 December 2015 (UTC)

@SlimVirgin: The template was horribly broken - among other things, it listed shortcuts 2-5 twice. This edit should have fixed it. — Mr. Stradivarius ♪ talk ♪ 05:53, 9 December 2015 (UTC)
It has indeed fixed it. Thank you, Mr. Stradivarius. SarahSV (talk) 06:04, 9 December 2015 (UTC)

Div instead of table?[edit]

The module builds a layout table containing a single cell, a <th>. This causes an accessibility error, screen readers treat it as a data table (see WP:LTAB). Changing the <th> to a bolded <td>, and adding :attr('role', 'presentation') to the table would be a quick fix. But would a simple floating div instead of a table be more appropriate? Matt Fitzpatrick (talk) 10:16, 12 April 2016 (UTC)

It really ought to be a floated <div>...</div>. --Redrose64 (talk) 10:55, 12 April 2016 (UTC)

How's this?

Matt Fitzpatrick (talk) 08:56, 15 April 2016 (UTC)

No visual changes, give or take a pixel. But I should explain what's changed under the hood.

  • <div> instead of <table>.
  • As there was only one cell, I guess the <th> was just for bolding the text. Replaced with "font-weight:bold".
  • "background:transparent" to override <th>'s style no longer needed.
  • role="note" and "font-size:smaller" instead of <small>. Semantically more of an aside or note than small print. Also, tidy doesn't allow a <ul> nested inside a <small> and messes with the output.
  • line-height and padding tweaks to minimize pixel differences.

Matt Fitzpatrick (talk) 04:02, 19 April 2016 (UTC)

Related, just found these.

Policy shortcut uses a table with a single header cell, and I think it should be similarly changed. I'll drop a note on its talk page. Shortcut-l uses a div already and looks mostly fine to me. Matt Fitzpatrick (talk) 04:12, 19 April 2016 (UTC)

The reason that you can't put <ul>...</ul> inside <small>...</small> is because the former is a block-level element ("flow content" in modern terminology) whereas the latter is an inline element ("phrasing content"). The proper thing to do in HTML 4 (or later) is to add a class attribute to the <ul> tag, and in the style sheet, assign the declaration font-size:smaller; to that class. --Redrose64 (talk) 19:47, 19 April 2016 (UTC)
@Redrose64: Luckily, the table already had class="shortcutbox", and I kept that in the div. If the inline styles are acceptable, should I ask an admin to move them into a .shortcutbox rule in common.css at the same time as making my sandbox edit? Matt Fitzpatrick (talk) 23:47, 26 April 2016 (UTC)
I think so; perhaps Edokter (talk · contribs)? --Redrose64 (talk) 09:49, 27 April 2016 (UTC)
Shortcut boxes are a relatively rare occurence compared to the number of total pages. Let's leave them inline for now and wait for TemplateStyles to be deployed. -- [[User:Edokter]] {{talk}} 10:04, 27 April 2016 (UTC)

Module:Sandbox/Matt_Fitzpatrick/Shortcut to Module:Sandbox Module:Shortcut (diff)

Includes a margin fix from User:Edokter, thanks! This replaces the layout <table> containing a single <th> (which is an accessibility error) with a <div>. It leaves styles inline for now, per Edokter, with TemplateStyles coming soon. See also Template:Shortcut/testcases. Matt Fitzpatrick (talk) 21:10, 29 April 2016 (UTC)

Edited - typo on module link. Matt Fitzpatrick (talk) 21:13, 29 April 2016 (UTC)

Yes check.svg Done. -- [[User:Edokter]] {{talk}} 21:58, 29 April 2016 (UTC)

Treating redlinked shortcuts as errors[edit]

Redlinked shortcuts currently populate the cleanup category Category:Wikipedia shortcut box first parameter needs fixing. I don't think this behavior is correct, because redlinked shortcuts are just like any other sort of redlink: sometimes the box is on a userspace draft of a policy that'll eventually be promoted; sometimes the box is meant to illustrate a humorous parallel with an actual shortcut. Either way, I don't think redlinks naturally "need fixing". (Pinging Mr. Stradivarius, who wrote the module.) Enterprisey (talk!(formerly APerson) 03:12, 18 July 2016 (UTC)

@Enterprisey: This category was in the original template, and has been around since 2008. Looking at the rationale for adding it, I see that it was originally meant to be temporary. I don't mind if we take it out. Or we could make it suppressible with something like |nocat=true if that is more desirable. — Mr. Stradivarius ♪ talk ♪ 03:31, 18 July 2016 (UTC)
Actually, I see that it already is suppressible with |category=no. — Mr. Stradivarius ♪ talk ♪ 03:34, 18 July 2016 (UTC)
Wonderful! Great find. Thanks. Enterprisey (talk!(formerly APerson) 03:40, 18 July 2016 (UTC)

Protected edit request on 20 August 2016[edit]

At the moment, the error category for an invalid first parameter is added if the first parameter is a valid interwiki link; apparently, mw.title.exists is false in this case. Therefore:

if not title or not title.exists then

should be changed to

if not title or (not title.exists and title.interwiki == '') then

in order to catch this case.

Enterprisey (talk!(formerly APerson) 03:45, 20 August 2016 (UTC)

Yes check.svg Donexaosflux Talk 23:23, 20 August 2016 (UTC)

The cleanup category should be removed[edit]

Since I cleared out CAT:SHORTFIX, the category should be deleted and all code that adds pages to it (as far as I know, such code is present in {{Ombox/shortcut}}, {{Policy shortcut}}, and {{Shortcut-l}}, in addition to Module:Shortcut) should be removed. In the original discussion, it was suggested that this happen as soon as the category was cleared out. Pinging Mr. Stradivarius, with whom I had a related discussion last month. Enterprisey (talk!(formerly APerson) 20:57, 31 August 2016 (UTC)

I've removed it from the module and from all the templates you listed. — Mr. Stradivarius ♪ talk ♪ 23:30, 31 August 2016 (UTC)
Thank you! Enterprisey (talk!(formerly APerson) 02:49, 1 September 2016 (UTC)