Content deleted Content added
Use i18n for errors and excerpt() strings |
Sophivorus (talk | contribs) Testing new idea for "custom" entry point |
||
Line 816:
return table.concat(output)
end
local function transcludeCustom(frame)
local args = {}
for k, v in pairs(frame:getParent().args) do args[k] = v end
for k, v in pairs(frame.args) do args[k] = v end -- args from a Lua call have priority over parent args from template
local pageName = args[1]
options.paraflags = numberFlags(args["paragraphs"] or "") -- parse paragraphs: "1,3-5" to {"1","3-5"}
options.fileflags = numberFlags(args["files"] or "") -- parse file numbers
local text = main(pageNames, options)
return frame:preprocess(text)
end
-- Entry points for template callers using #invoke:
function p.custom(frame) return transcludeCustom(frame) end
function p.lead(frame) return invoke(frame, "lead") end -- {{Transclude lead excerpt}} reads the first and only article
function p.linked(frame) return invoke(frame, "linked") end -- {{Transclude linked excerpt}} reads a randomly selected article linked from the given page
|