Module:Extract short description: Difference between revisions

Content deleted Content added
delete references before preprocessing;
No edit summary
Line 19:
local function extract_from_template (frame, article_title, template_name)
local content = mw.title.new (article_title):getContent(); -- read the unparsed article source
if not content then
local template_name_pattern = template_name:gsub ('^%a', string.lower):gsub ('^%a', '%[%1%1%]'):gsub ('%[%a', string.upper); -- make lua pattern for initial letter upper or lower case: A -> [Aa]
return '<span style="font-size:100%;" class="error">error: no article: ' .. article_title .. '</span>';
end
local template_name_pattern = template_name:gsub ('^%a', string.lower):gsub ('^%a', '%[%1%1%]'):gsub ('%[%a', string.upper); -- make lua pattern for initial letter upper or lower case: A -> [Aa]
 
local start = string.find (content, '{{%s*' .. template_name_pattern); -- find the start of {{template name ...;
if not start then