Module:Excerpt: Difference between revisions

Content deleted Content added
Fix bug: when a line contains both nested templates and template with a |ref parameter, e.g. Somalia, remove both
Extend caption to include a nested template flowed over multiple lines. (Function parsecaption() strips the template out later.)
Line 123:
local position, caption = mw.ustring.match(text, "|%s*[^=|]*[Cc][Aa][Pp][Tt][Ii][Oo][Nn][^=|]*%s*=%s*()([^\n]+)", capture_from)
if caption then
-- extend caption to parse "| caption = Foo {{Template\n on\n multiple lines}} Bar\n"
local bracedCaption = mw.ustring.match(text, "^[^\n]-%b{}[^\n]+", position);
if bracedCaption and bracedCaption ~= "" then caption = bracedCaption end
caption = mw.text.trim(caption)
local captionStart = mw.ustring.sub(caption, 1, 1)