Module:Gadgets and Module:Gadgets/sandbox: Difference between pages

(Difference between pages)
Jump to navigation Jump to search
Page 1
Page 2
imported>Krinkle
Maintenance: Fix Lua error "Lua error in Module:Gadgets at line 74: attempt to index a nil value." on Wikibooks where Wikipedia:GUS2Wiki is an interwiki prefix instead of a namespace. Use the "Project" alias instead, which should work everywhere. Ref discussion on Meta-Wiki
 
imported>NguoiDungKhongDinhDanh
Remove comments and CRs prior to parsing
 
Line 1: Line 1:
local p = {}
local p = {}


-- https://github.com/wikimedia/mediawiki-extensions-Gadgets/blob/5402b231dc0928f53c345c4be2b671a35345c7c2/includes/MediaWikiGadgetsDefinitionRepo.php#L183
p.parse = function()
p.parse = function()
local text = mw.title.new('MediaWiki:Gadgets-definition'):getContent()
local text = mw.title.new('MediaWiki:Gadgets-definition'):getContent()
text = mw.ustring.gsub(text, '<!--.--->', '')
text = mw.ustring.gsub(text, '\r\n', '\n')
text = mw.ustring.gsub(text, '\r', '\n')
local lines = mw.text.split(text, '\n', false)
local lines = mw.text.split(text, '\n', false)