local p =
function proc(text,fcn,args) -- processes text sequentially according to a list of functions separated by spaces fcn text=text or "" fcn=fcn or "" local keepfile repeat fcnext=mw.ustring.match(fcn,"(%S+)") if fcnext then fcn=mw.ustring.gsub(fcn,fcnext,"") -- function names SHALL not contain pattern chars if fcnext
-- process File: and Image: links, using alt text when available text=mw.ustring.gsub(text,"%[%[File:[^%[%]]-|%s*alt=([^%[%]|]-)|[^%[%]]-%]%]","%1") -- case for File: where alt= text is present but not at end text=mw.ustring.gsub(text,"%[%[Image:[^%[%]]-|%s*alt=([^%[%]|]-)|[^%[%]]-%]%]","%1") -- case for Image: where alt= text is present but not at end text=mw.ustring.gsub(text,"%[%[File:[^%[%]]-|%s*alt=([^%[%]|]-)%]%]","%1") -- case for File: where alt= text is present at end text=mw.ustring.gsub(text,"%[%[Image:[^%[%]]-|%s*alt=([^%[%]|]-)%]%]","%1") -- case for Image: where alt= text is present at end text=mw.ustring.gsub(text,"%[%[[^%[%]]-|([^%[%]|]-)%]%]","%1") -- link, text separated by "|". Handles case of File: when no alt= is specified, -assuming- last field is the legend text=mw.ustring.gsub(text,"%[%[([^%[%]|]-)%]%]","%1") -- link with no funny |s at all -- deprotect all tokens text=mw.ustring.gsub(text,"