Module:Excerpt: Difference between revisions

Content deleted Content added
Add paragraphs= argument; improve layout
Allow page name to be a wikilink
Line 42:
local args = frame.args -- from calling module
local pargs = frame:getParent().args -- from template
 
local pagename = args[1] or pargs[1] or ""
pagename = mw.ustring.match(pagename, "%[%[%s*(.-)[]|#]") or pagename -- "[[Foo|Bar]]" → "Foo"
 
local parasets = mw.text.split(args["paragraphs"] or pargs["paragraphs"] or "", ",") -- parse paragraphs, e.g. "1,3-5" → {"1","3-5"}
Line 53 ⟶ 56:
end
 
return frame:preprocess(p._lead(args[1] or pargs[1]pagename, paralist))
end