Module:Test2: Difference between revisions
Appearance
Created page with "function splitLines(text) local lines = {} for line in text:gmatch("[^\r\n]+") do table.insert(lines, line) end return lines end local p = {} function p.Sitename(frame) local extDataTable = mw.ext.externalData.getExternalData(frame.args[1])[1]["__text"] local dataLines = splitLines(extDataTable) local sitename = '' for i,line in ipairs(dataLines) do if line:match("og:site_name") then sitename = line:match('content="([^"]+)"') break..." |
m Protected "Module:Test2" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)) |
(No difference)
|
Latest revision as of 02:20, 13 March 2025
Documentation for this module may be created at Module:Test2/doc
function splitLines(text)
local lines = {}
for line in text:gmatch("[^\r\n]+") do
table.insert(lines, line)
end
return lines
end
local p = {}
function p.Sitename(frame)
local extDataTable = mw.ext.externalData.getExternalData(frame.args[1])[1]["__text"]
local dataLines = splitLines(extDataTable)
local sitename = ''
for i,line in ipairs(dataLines) do
if line:match("og:site_name") then
sitename = line:match('content="([^"]+)"')
break
end
end
return sitename
end
return p