Module:Footnotes/anchor id list/sandbox: Difference between revisions

Content deleted Content added
no need to template_list_add() --- it just calls template_name_get redundantly
Tag: Reverted
get rid of debugging statements
Tag: Reverted
Line 386:
template_name = template_name:match ('^#invoke%s*:%s*(.+)'); -- get module name
local func_name = template:match ('^{{[^|}]+%|%s*([^/|}]*)'); -- get function name
mw.logObject(template_name,"module name")
mw.logObject(func_name,"func_name")
if template_name and func_name then -- valid module invocation
return template_name:gsub ('%s+$', '') .. ' ' .. func_name; -- ensure exactly one trailing whitespace between module and function name
Line 413 ⟶ 411:
return nil; -- could not get template name from (possibly corrupt) template; extraneous opening { mid template can cause this;
end;
mw.logObject(template_name,"template name")
template_name = template_name:gsub ('%s*$', ''); -- trim trailing whitespace; leading whitespace already removed
return Lang_obj:ucfirst (template_name); -- first character in template name must be uppercase (same as canonical template name) TODO: better way to do this?
Line 753 ⟶ 750:
break; -- template is nil for some reason (last template missing closing }} for example) so declare ourselves done
end
mw.logObject(template,"template")
template_name = template_name_get (template); -- get first char uppercase trimmed template name; ignore subpages ~/new, ~/sandbox
list_add (template_name, template_list); -- add this template's name to the list