Jump to content

Module talk:Portal maintenance status

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Evad37 (talk | contribs) at 07:53, 19 June 2018 (Code consolidation: reply). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
WikiProject iconPortals  
WikiProject iconThis page is within the scope of WikiProject Portals, a collaborative effort to improve portals on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Template This module does not require a rating on the project's quality scale.
Note icon
See also: List of Portals

Code consolidation

@Evad37: Regarding my recent edit to the module to add the {{Featured portal}} detection code. I feel as though this could have been written better, perhaps by removing the duplication of the template search code. As of now, there are three functions that start by doing the same thing. Would it make sense to make a generic search function that accepts an argument for the type of template to search for, then return true for that search? If I knew Lua better, I'd work on it myself. Or perhaps it's not worth the trouble right now? — AfroThundr (u · t · c) 03:02, 18 June 2018 (UTC)[reply]

Most of the potential duplication is already avoided, as all three entry points uses the functions getSubjectPageContent and makeTemplatePattern. Further consolidation is possible, but may be more appropriate as a function in Module:Excerpt (that would return the wikitext of a template invocation for a given page and template name) - Evad37 [talk] 07:53, 19 June 2018 (UTC)[reply]