local getArgs = require('Module:Arguments').getArgs
local function getImplicitDescription local current_title = mw.title.getCurrentTitle if not current_title then return errorMessage('could not getCurrentTitle') end local page_content = mw.title.new(current_title):getContent if not page_content then return errorMessage('could not getContent of ' .. safePipedLink(name)) end local all_templates = string.match(page_content, '') return mw.text.nowiki(all_templates) --for m in string.gmatch('string', 'pattern') do mw.log(m) end -- -- let's assume that implicit descriptions will generally be set by infoboxes, but could be from anywhere -- it would therefore makes sense to cycle through any infoboxes first --get the lead infoboxes (there might be none or many) first, since they're the most likely to place any implicit description --since we will be preprocessing them, strip a bunch of stuff we definitely don't need or want --being infoboxes; there SHOULD be no references, but since when did that stop anyone? -_- --local lead_infoboxes = getTransclusion('The Partisan#',) --mw.log(lead_infoboxes) --split the results, and loop through them --preprocess and check for a description match --if we get a hit; return the description -- if we didn't get a hit... --get any remaining infoboxes; multiple infoboxes is unusual, but this will unfortunately get the lead infobox again if there is one --why not just do this first? because it's much more expensive and a lot less likely to be useful --again; strip the stuff we don't need or want --local all_infoboxes = getTransclusion('The Partisan',) --mw.log(all_infoboxes) --split the results --obviously, we don't want to preprocess the same infobox again, so ignore it --if there are any more, loop through them --preprocess and check for a description match --if we get a hit; return the description -- if they weren't helpful, it's probably a good idea to stop doing this, but if you insist... --get all templates that aren't s; it would be nice to not get infoboxes too, but that doesn't seem possible --again; strip the stuff we don't need or want --local all_other_templates = getTransclusion('The Partisan',) --mw.log(all_other_templates) --split the results --obviously, we don't want to preprocess the infoboxes again, so ignore them --if there are any more, loop through them --preprocess and check for a description match --if we get a hit; return the description -- if they didn't spit one out, we consider ourselves lucky to have survived -- NOTE: if there are multiple implicit descriptions being set, it's theoretically possible we could find one that's redundant -- I have zero intention to address this possibility --end
local p =
function p.getImplicitDescription(frame) local args = getArgs(frame) local implicit_description = getImplicitDescription -- this is going to be horrible mw.log(implicit_description) return implicit_descriptionend
local sisters =
function p.test(frame) local args = getArgs(frame) local name = args.name if name then local pre_colon = name:match('^(%a+):') if pre_colon then for i, sister in ipairs(sisters) do if pre_colon
return p