Content deleted Content added
Testing in moving alt safety function to another place |
enable ignoreOnlyincludes |
||
(5 intermediate revisions by the same user not shown) | |||
Line 3:
local excerptModule = require('Module:Excerpt/portals/sandbox')
local randomModule = require('Module:Random')
function cleanupArgs(argsTable)
Line 101 ⟶ 100:
file = mw.ustring.gsub(file, '|%s*center%s*([|%]])', '%1')
file = mw.ustring.gsub(file, '|%s*centre%s*([|%]])', '%1')
file = mw.ustring.gsub(file, '|%s*none%s*([|%]])', '%1')
file = mw.ustring.gsub(file, '|%s*baseline%s*([|%]])', '%1')
file = mw.ustring.gsub(file, '|%s*sub%s*([|%]])', '%1')
Line 113:
file = mw.ustring.gsub(file, '|%s*upright%s*=.-([|%]])', '%1')
file = mw.ustring.gsub(file, '|%s*link%s*=.-([|%]])', '%1')
file = mw.ustring.gsub(file, '|%s*lang%s*=.-([|%]])', '%1')
-- remove spaces prior to captions (which cause pre-formatted text)
file = mw.ustring.gsub(file, '|%s*', '|')
Line 132 ⟶ 133:
-- disable pipes in wikilinks
file = file:gsub(
"%[%[(
"[[%1__PIPE__%2]]")
-- move any alt parameter to the end to avoid putting the switcher in too early and causing a linter error
Line 171 ⟶ 172:
content = excerptModule.getSection(content, args['section'..i]) or ''
end
content = excerptModule.cleanupText(content, {keepSubsections=true, ignoreOnlyincludes=true}) -- true means keep subsections
local galleryFiles = extractGalleryFiles(content)
Line 180 ⟶ 181:
local isOkay = excerptModule.checkImage(filename)
if isOkay then
table.insert(lines, doubleCheck(f
end
end
Line 190 ⟶ 191:
for _, f in pairs(extractRegularFiles(otherFiles)) do
if f and f ~= '' and mw.ustring.sub(f, 1, 5) == 'File:' and hasCaption(f) then
table.insert(lines, doubleCheck(f
end
end
|