Content deleted Content added
No edit summary |
No edit summary |
||
Line 19:
]]
local function extract_from_template (frame, article_title, template_names_tbl)
local content = mw.title.new (article_title):getContent(); -- read the unparsed article source
Line 27 ⟶ 26:
local template_name_pattern;
local start;
template_names_tbl = {template_names_tbl}; -- convert to a table
end
for _, template_name in ipairs (template_names_tbl) do -- loop through the name in the table
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]
start = content:find ('{{%s*' .. template_name_pattern); -- find the start of {{template name ...;
|