Module:URL to diff: Difference between revisions
Appearance
Content deleted Content added
make a start at a URL to {{diff}} converter |
(No difference)
|
Revision as of 15:13, 1 January 2015
This module implements {{URL to diff}}. Please see the template page for documentation.
-- This module converts Wikipedia diff URLs to the {{diff}} template format.
local p = {}
local function decodeUrl(url)
if type(url) ~= 'string' then
error('no URL provided', 2)
end
url = mw.uri.new(url)
if not url then
error('invalid URL provided', 2)
end
if url.host ~= 'en.wikipedia.org' then
error(string.format(
"invalid host '%s'; this template only accepts diff URLs from en.wikipedia.org",
tostring(url.host)
), 2)
end
mw.logObject(url.host)
end
local function encodeDiffTemplate(data)
end
function p._url(args)
local url = args[1]
local data = decodeUrl(url)
return encodeDiffTemplate(data)
end
function p.url(frame)
local args = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:Make diff',
})
return p._url(args)
end
return p