Module:Excerpt/portals and Module:Excerpt/portals/sandbox: Difference between pages
(Difference between pages)
imported>Matrix fix colour on collapse tops |
imported>Aidan9382 From live (Fix over-culling templates when doing stripTemplate as part of ref cleanup if there's a piped wikilink in an unexpected position) |
||
| Line 42: | Line 42: | ||
-- Regular expressions to match all inline templates that are undesirable in excerpts | -- Regular expressions to match all inline templates that are undesirable in excerpts | ||
local unwantedInlineTemplates = { | local unwantedInlineTemplates = { | ||
"[Ee]fn", "[Ee]fn%-[lu][arg]", "[Ee]fn [%a ]-", "[Ee]l[mn]", "[Rr]p?", "[Ss]fn[bmp]", "[Ss]f[bn]", "[Nn]ote[Tt]ag", "#[Tt]ag:%s*[Rr]ef", "[Rr]efn? | "[Ee]fn", "[Ee]fn%-[lu][arg]", "[Ee]fn [%a ]-", "[Ee]l[mn]", "[Rr]p?", "[Ss]fn[bmp]", "[Ss]f[bn]", "[Nn]ote[Tt]ag", "#[Tt]ag:%s*[Rr]ef", "[Rr]efn?", | ||
"[CcDd]n", "[Cc]itation[%- _]needed", "[Dd]isambiguation needed", "[Ff]eatured article", "[Gg]ood article", | "[CcDd]n", "[Cc]itation[%- _]needed", "[Dd]isambiguation needed", "[Ff]eatured article", "[Gg]ood article", | ||
"[Dd]ISPLAYTITLE", "[Ss]hort[ _]+description", "[Cc]itation", "[Cc]ite[%- _]+[%w_%s]-", "[Cc]oor[%w_%s]-", | "[Dd]ISPLAYTITLE", "[Ss]hort[ _]+description", "[Cc]itation", "[Cc]ite[%- _]+[%w_%s]-", "[Cc]oor[%w_%s]-", | ||
| Line 111: | Line 111: | ||
} | } | ||
local Transcluder = require("Module:Transcluder/sandbox") | |||
local Transcluder = require("Module:Transcluder") | |||
local escapeString = require("Module:String")._escapePattern | local escapeString = require("Module:String")._escapePattern | ||
local yesno = require('Module:Yesno') | local yesno = require('Module:Yesno') | ||
| Line 299: | Line 294: | ||
-- Filter non-free images | -- Filter non-free images | ||
if not fileDescription or fileDescription == "" or | if not fileDescription or fileDescription == "" or mw.ustring.match(fileDescription, "[Nn]on%-free") then return false end | ||
return true | return true | ||
| Line 969: | Line 962: | ||
end | end | ||
if not text or text == "" then return wikiError("No valid pages found") end | if not text or text == "" then return wikiError("No valid pages found") end | ||
if args.showall then | if args.showall then | ||
local separator = args.showall | local separator = args.showall | ||
if separator == "" then separator = "{{clear}}{{hr}}" end | if separator == "" then separator = "{{clear}}{{hr}}" end | ||
for _, candidate in pairs(candidates) do | for _, candidate in pairs(candidates) do | ||
local t = get(candidate, options) | local t = get(candidate, options) | ||
| Line 997: | Line 973: | ||
end | end | ||
end | end | ||
-- Add a collapsed list of pages which might appear | -- Add a collapsed list of pages which might appear | ||
if args.list then | if args.list and not args.showall then | ||
local list = args.list | local list = args.list | ||
if list == "" then list = "Other articles" end | if list == "" then list = "Other articles" end | ||
text = text .. "{{collapse top|title={{resize|85%|" ..list .. "}}|bg= | text = text .. "{{collapse top|title={{resize|85%|" ..list .. "}}|bg=fff}}{{hlist" | ||
for _, candidate in pairs(candidates) do | for _, candidate in pairs(candidates) do | ||
if mw.ustring.match(candidate, "%S") then text = text .. "|[[" .. mw.text.trim(candidate) .. "]]" end | if mw.ustring.match(candidate, "%S") then text = text .. "|[[" .. mw.text.trim(candidate) .. "]]" end | ||