Content deleted Content added
MiszaBot II (talk | contribs) m Robot: Archiving 2 threads from Template talk:WPBannerMeta. |
MiszaBot II (talk | contribs) m Robot: Archiving 2 threads from Template talk:WPBannerMeta. (ARCHIVE FULL) |
||
Line 841:
Thank you to everyone for fixing my inelegant and inaccurate (and incomplete!) attempts. I've now updated the main template with the new code. [[User:Bencherlite|Bencherlite]][[User talk:Bencherlite|<i><sup>Talk</sup></i>]] 23:56, 25 February 2013 (UTC)
:I made {{diff|Template:WikiProject Law/portalbox|prev|540405314|a further fix}}. --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] ([[User talk:Redrose64|talk]]) 00:04, 26 February 2013 (UTC)
== Rewriting in Lua ==
Hello.
I am interested in having the templates using {{tl|WPBannerMeta}} being rewritten to use a Lua module.
Possible benefits:
* '''Cleaner code.''' It can make banner template code less verbose, easier to maintain, more self-documenting and semantic. As the developer of [[User:Kephir/gadgets/rater|Rater]], I would also like to be able to parse banner template code directly instead of relying on separate data blobs, prone to errors, being incomplete and outdated. Doing that with current templates is rather hard, with all the subtemplates, nested parameters and parser function calls. (Try reading the code of [[Template:WikiProject United States]] to see what I mean)
* '''More uniform parameters.''' Was it "US", "US-task-force" or "US-work-group"? "musician-importance" or "musician-priority"? "image-needed" or "needs-photo"? A Lua function could recognise all variants in all templates without hassle.
* '''Automatic documentation generation.''' The Lua code may detect when it is being called on the documentation subpage and generate a list of recognised parameters and their descriptions.
A module, [[Module:WikiProjectBanner]] should be written, with functions generating banner fragments based on parameters pulled from the template call and their own invocations.
Thoughts? <span class="signature">[[User:Kephir|Keφr]]</span> 10:57, 9 March 2013 (UTC)
:I'd be interested in this too. The various templates used by WPBannerMeta account for a great deal of the top entries at [[Wikipedia:Database reports/Templates transcluded on the most pages]], and it would be a good chance for me to learn Lua. It looks like it will be a heck of a job though. I think I'll start small with things like [[Template:Portal]]. If anyone else wants to help, or has a grand vision of how to implement this, I'm all ears. :) — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 13:45, 23 March 2013 (UTC)
:: Me too! Perhaps we could also wait for WikiData transclusion to be enabled, and figure out if we can use it to store some of the primary data (per project ratings/importances?)? [[User:Yuvipanda|YuviPanda]] ([[User talk:Yuvipanda|talk]]) 02:37, 31 March 2013 (UTC)
:Please do so. This template seems to be really punishing the job queue for a while. '''[[User talk:Aaron Schulz|<font color="blue">Aar</font><font color="darkblue">on Sc</font><font color="black">hulz</font>]]''' 23:51, 24 May 2013 (UTC)
* Consider below: "[[#Streamline to bypass /core for simple options]]" because rewriting so many parameter options in [[Lua script]] could take weeks of coding and testing. Unless weeks of testing of the Lua version were done, then the rewrite in Lua could break some banners, which would prompt some users to really complain. -[[User_talk:Wikid77|Wikid77]] 14:47, 25 May 2013 (UTC)
*I don't think a rewrite in Lua should be done as a drop in replacement for Template:WPBannerMeta anyway. It would be better to create Module:WPBannerMeta and then gradually go around and update each of the projects banner templates to use the module directly. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 16:33, 25 May 2013 (UTC)
* I agree that a Lua rewrite is the way to go, as opposed to the streamlining option. That said, I do ask that you keep [[WP:1.0/I]] in the loop about any proposed changes to the quality/importance display, such as the WikiData proposal above. [[User:Titoxd|Tito<span style="color:#008000;">xd</span>]]<sup>([[User talk:Titoxd|?!?]] - [[WP:FAC|cool stuff]])</sup> 17:29, 25 May 2013 (UTC)
== Streamline to bypass /core for simple options ==
Rather than rewriting in [[Lua script]], the top-level [[Template:WPBannerMeta]] could be modified to quickly format the banner-box, using similar table-box structure, when only the basic options are used, else call {WPBannerMeta/core} when rare parameters are also passed. The typical template speed seems to be {WPBannerMeta} runs in 0.34s (one-third second), which is equivalent to running about 300 #ifeq conditions. So, if the template were modified to run with a streamlined design, with only 50 #ifeq conditions to format the banner-box for the basic parameters, then it would run 6x faster, as 18x times per second, rather than 3/sec. The current expansion-depth level is 33, which would increase by 1 as 34 levels to format rare options, after the template became streamlined. A similar streamlined design was used in [[Template:Cite_web/sandbox4]], to only call {Citation/core} when rare parameters were used. Note: all banner parameters would still be allowed, but using only the basic parameters would format a banner over 6x faster, as with perhaps 95% of current banners. -[[User:Wikid77|Wikid77]] ([[User talk:Wikid77|talk]]) 14:47, 25 May 2013 (UTC)
|