Module:Extract short description: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 16:
local template_content = ibox_text:gsub ('{{%s' .. template_name, ''):gsub ('}}$', '')
 
returnlocal text = (frame:expandTemplate ({title=template_name, args = {template_content}}):match ('<div[^>]; -class="shortdescription.->([^<]+)')) orexpand the infobox ''template
-- preprocess the template and return shortdescription text or empty string
 
return (frame:expandTemplate ({title=template_name, args = {template_content}}):match ('<div[^>]-class="shortdescription.->([^<]+)')) or ''
text = text and text:match ('<div[^>]-class="shortdescription.->([^<]+)'); -- extract shortdescription text
 
return text and mw.text.trim (text) or ''; -- trim whitespace and done
-- preprocess the template then apply syntax highlighting
-- return frame:callParserFunction ('#tag:syntaxhighlight', frame:expandTemplate ({title=template_name, args = {template_content}}));