Difference between revisions of "Module:Transclusion count/sandbox"

From blackwiki
Jump to navigation Jump to search
blackwiki>Ahecht
(let's just address ", since it is the only problem so far)
blackwiki>Ahecht
(I'll escape with \ instead)
Line 5: Line 5:
 
local index = mw.ustring.sub(template,1,1)
 
local index = mw.ustring.sub(template,1,1)
 
local data = mw.loadData('Module:Transclusion_count/data/' .. (mw.ustring.find(index, "%a") and index or "other"))
 
local data = mw.loadData('Module:Transclusion_count/data/' .. (mw.ustring.find(index, "%a") and index or "other"))
return data[mw.ustring.gsub(template, '"', '"')]
+
return data[template]
 
end
 
end
  
 
return p
 
return p

Revision as of 04:12, 10 August 2019

Documentation for this module may be created at Module:Transclusion count/sandbox/doc

local p = {}

function p.main()
	local template = mw.title.getCurrentTitle().text
	local index = mw.ustring.sub(template,1,1)
	local data = mw.loadData('Module:Transclusion_count/data/' .. (mw.ustring.find(index, "%a") and index or "other"))
	return data[template]
end

return p