Module:Sandbox/Erutuon: Difference between revisions

Content deleted Content added
experiment with searching for language codes in Template:lang and lang-xx templates in article text
allow inputting of pagename; error catching
Line 168:
 
function p.search_for_language_codes(frame)
local page_name = frame.args[1] or "English language"
local content = mw.title.new(page_name):getContent()
local success, title_object = pcall(mw.title.new, page_name)
if not (success and title_object) then
mw.log(("Could not make title object for '%s'"):format(page_name))
return
end
local content = mw.title.new(page_name)title_object:getContent()
local language_codes = {}
for lang_template in content:gmatch '{{lang[^}]+' do