Template talk:Archive list

From Wikipedia, the free encyclopedia

Contents

[edit] ifexist limit

{{editprotected}}

This template generates 101 calls fo #ifexist. Per Wikipedia:Village_pump_(technical)#.23ifexist_limit, the devs will be blocking all pages from making more than 100 calls to #ifexist for performance reasons, which would put all pages transcluding this immediately above the limit.

I would suggest restructuring this as 10 blocks based on 10 calls to #ifexist, rather than having an #ifexist call for each possible archive. Dragons flight 21:41, 1 December 2007 (UTC)

The template currently works the following way:
  • Link to archive 1.
  • Does archive 2 exist? If so, link to it. Otherwise, give up.
  • Does archive 3 exist? If so, link to it. Otherwise, give up.
  • Does archive 4 exist? If so, link to it. Otherwise, give up.
  • etc
This means that once the new algorithm for following #ifexist is used (where each branch is only followed when necessary), the pages transcluding this template should only make as many #ifexist calls as there are archive pages. In most cases, this number should be well below 101.
It would be possible to restructure the template to test if a block of pages exists, and narrow down from there until the exact number of archive pages is found. Depending on how it's implemented, this would generate approximately 8 #ifexist calls per page but it would be fairly complex to code and it would need to be tested in a sandbox before being put in the live version. Tra (Talk) 01:15, 2 December 2007 (UTC)
I've created a version at Template:Archive list/sandbox that should cut down on #ifexist calls once the new mechanism for parsing #if works (i.e. only look at the branches that need to be looked at, instead of all of them), but doesn't require this change to be made to the #ifexist mechanism. Tra (Talk) 21:55, 4 December 2007 (UTC)

{{editprotected}} I've updated Template:Archive list/sandbox with a version that doesn't use #ifexist at all. -- Fullstop (talk) 05:53, 8 January 2008 (UTC)

Disabled due to display:none issues. More info available here: Wikipedia:HiddenStructure. Cheers. --MZMcBride (talk) 06:19, 8 January 2008 (UTC)

[edit] Links per line

{{editprotected}} Can the links per line be defined as I have done in the sandbox? Right now it is only #s that are multiples of 5, to keep the size down. MrKIA11 (talk) 17:06, 11 January 2008 (UTC)

I just want to point out the parameter name nobr isn't good, there's an HTML tag called nobr which does nowrap for text. —Dispenser (talk) 19:17, 11 January 2008 (UTC)
I changed nobr to break, but I think that even that is not the best name, I just can't think of anything short and sweet. Maybe links or line? MrKIA11 (talk) 20:11, 11 January 2008 (UTC)
I'd like to see something a bit more flexible where I could specify a multiple to the line breaks to appear. —Dispenser (talk) 20:40, 11 January 2008 (UTC)
The sandbox version is based on another version that was rejected previously due to accessibility issues. Would it be possible to have the proposed method be based on the existing version at Template:Archive list? Tra (Talk) 20:51, 11 January 2008 (UTC)
I changed it to be based on the current version. I also changed it so it can take any multiple (up to 100 of course). As you can see though, it increases quite a bit in size. All of my changes I assume will work. I'm not very experienced with HTML, but from what I have read, what I did makes sense in my head. MrKIA11 (talk) 21:05, 11 January 2008 (UTC)
I've tested it a bit in a show-preview window and I think the main problem is that currently, there is by default a line break every 10 links and the line breaks can be disabled by setting nobr=yes. In the new version, the default is to have no line breaks unless otherwise specified. This may mess up existing uses of the template. Tra (Talk) 22:21, 11 January 2008 (UTC)
I'm not very sure about this stuff, but would putting {{{links|10}}} at the beginning set the default for the links parameter to 10? MrKIA11 (talk) 22:30, 11 January 2008 (UTC)
Not done. There really isn't a compelling reason for #ifexist to not be used at the moment. rel2abs can cause serious issues when mixed with a CSS hack, as mentioned above. Also, nobr, while it is an HTML tag, is a perfectly fine parameter name, especially when it removes the presence of br tags. Unless there is a reason to update this template, it's my view that it should either be deprecated in favor of a bot doing the archive boxes or be left alone. --MZMcBride (talk) 22:55, 11 January 2008 (UTC)
I thought about using {{{links|10}}} in place of just {{{links}}} but just having that on its own would cause the pages using nobr=yes to stop working, so extra code would be needed to handle the nobr=yes parameter. What I've done in the sandbox is to use the new code except for at the end of each group of 10 links, where it would check if links= has been specified, and if it hasn't been specified, it would insert a line break or comma depending on the presence of nobr=yes.
When testing this, the existing uses of {{archive list}} appear identical under the sandbox template (i.e. the template is fully backwards compatible), and when testing links=, this appears correctly too.
One other issue is that the size of the template is almost doubled. This means that under the old version, I could repeat the template 72 times on a page before it broke, but under the new version, the template can only be repeated 42 times. However, this testing was carried out by repeating links to an identical set of archives - in practical use, the template could only be used 5 times since it uses 100 #ifexist calls for each set of archive pages, and the limit is 500 #ifexist calls. Therefore, the increased size of the template should have negligible effect.
In response to MZMcBride, the css hack is no longer in use, and nobr is working correctly again. I think this change would be a good idea and should be implemented as it would allow greater flexibility in listing archives. Tra (Talk) 23:24, 11 January 2008 (UTC)
First of all, I think it would help if the admin actually read the code. The current template uses rel2abs and the sandbox version still uses #ifexist. The sandbox is the same as the current version, but with more options. Tra, when you say it can be used 5 times, do you mean on the same page? If so, why would it be on any given page more than once? Can the {{editprotected}} be placed again, so someone else can review it, or is that not allowed since it was already reviewed? MrKIA11 (talk) 23:42, 11 January 2008 (UTC)
Yes, that's 5 times per page, assuming that no other #ifexist calls are used on that page (or templates transcluded on to that page). If there are other #ifexist calls, the limit would come down. As an example of where it's used more than once, there's Wikipedia:Village pump archive which links to the archives of each of the sub sections of the Village Pump. I'd rather not simply make the edit against the actions of another admin, so I'll contact MZMcBride to see what he thinks. Tra (Talk) 00:07, 12 January 2008 (UTC)

MrKIA11: I can say with certainty that this isn't the first template I've come across. : - ) Tra is free to implement this code, and you're free to re-activate the editprotected request, however, I will say that this template is border-line high use and its size will jump by about 10,000 bytes if it is updated. #ifexist is an incredibly helpful ParserFunction, though using it in this particular template probably isn't the best idea. As I said before, deprecating this template seems like a wiser choice to me, however, it's not my opinion that really matters here, and frankly, I don't really care about this template and its inner workings. Upon further review of the template, other than the increased size, it seems like perfectly fine code. It's a shame that #ifexist isn't more efficient, but eso es la vida. --MZMcBride (talk) 03:26, 12 January 2008 (UTC)

I was just commenting on the fact that you said There really isn't a compelling reason for #ifexist to not be used at the moment., even though it was in the sandbox code, and that you said rel2abs can cause serious issues when mixed with a CSS hack, even though it is in the current code. I agree that the size is a problem, which is why I originally suggested just having the links be a multiple of 5. This also makes me wonder why previous suggestions that make it smaller, such as the above section, were shot down. MrKIA11 (talk) 04:24, 12 January 2008 (UTC)
Y Done and added a note on the documentation about the performance impact.
With regard to the previous suggestions referred to, whilst making the template smaller is a good thing, if the changes requested introduce other problems then it is more likely they would be rejected because of that. Tra (Talk) 12:00, 12 January 2008 (UTC)
Thank you very much. MrKIA11 (talk) 13:46, 12 January 2008 (UTC)

{{editprotected}} I just noticed that every line was off by one number. I corrected the sandbox, could you please change the template. Thanks. MrKIA11 (talk) 14:23, 12 January 2008 (UTC)

Y Done Tra (Talk) 15:09, 12 January 2008 (UTC)

[edit] Parameter Usage

{{editprotected}}

Could someone add:

{{void|{{Template:Archive list/root/{{#if: {{{root|}}}||un}}defined}}}}
{{void|{{Template:Archive list/nobr/{{#if: {{{nobr|}}}||un}}defined}}}}
{{void|{{Template:Archive list/links/{{#if: {{{links|}}}||un}}defined}}}}

to the end of the template, so that the parameter usage can be checked? MrKIA11 (talk) 18:29, 16 January 2008 (UTC)

Y Done Tra (Talk) 18:54, 16 January 2008 (UTC)
The new preprocessor changed the way {{void}} works, so could those 3 be changed to {{voidd}}. Thanks, MrKIA11 (talk) 12:45, 11 February 2008 (UTC)
Y Done--Patrick (talk) 13:43, 11 February 2008 (UTC)

[edit] Stops at 36

When contained within another template, this seems to have a limit of 36. No archive links above that number are displayed. See Talk:Anarchism, talk:George W. Bush, Wikipedia talk:WikiProject Opera. They contain an experimental new talkheader template, {{talkheader4}}, which includes {{archive list}}. In talk:Anarchism, you can see that this is happening in other templates that make use of this template as well, since a separate archive box is also posted. Can anyone fill me in on what's going on?

PS I tested posting this template on its own without being contained in another template, and in that case it still doesn't display all archives, but it does go up to #39 instead of 36. Equazcion /C 02:25, 30 Mar 2008 (UTC)

I've done some tests and it appears that the problem seems to come from having too many nested ParserFunctions. Rewriting the template to check if a given block of archives exists before linking to them might solve the problem; I'll have a go at this later. Tra (Talk) 12:02, 30 March 2008 (UTC)
It looks like you fixed it, Tra. Great job, thanks! Equazcion /C 17:38, 30 Mar 2008 (UTC)

[edit] Redlink transclusions

{{editprotected}} Is there a reason why the template transcludes three non-existing template subpages which clutter up the "templates transcluded" list and look rather unsightly? I expect that it was (once upon a time) to enable the use of the parameters to be tracked, but is it now necessary? If not, removing them would tidy up countless edit screens. Happymelon 21:35, 11 April 2008 (UTC)

I was originally using them, so if no one else needs them, I don't mind removing them. MrKIA11 (talk) 23:03, 11 April 2008 (UTC)
Thanks - much tidier! Happymelon 12:49, 12 April 2008 (UTC)