(Razlika između stranica)
s en.wikipedije |
s en.wikipedije |
||
| Redak 13: | Redak 13: | ||
local function getConfig() | local function getConfig() | ||
return mw.loadData('Module:Uses TemplateStyles/config') | return mw.loadData('Module:Uses TemplateStyles/config') | ||
end | |||
local function urlEncode(str) | |||
return mw.uri.encode(str, "WIKI") | |||
end | end | ||
| Redak 29: | Redak 33: | ||
local link = string.format('[[:%s]]', ts) | local link = string.format('[[:%s]]', ts) | ||
local sandboxLink = nil | local sandboxLink = nil | ||
local editLink = string.format( | |||
'[%s edit]', | |||
"https://en.wikipedia.org/w/index.php?title=" .. urlEncode(ts) .. "&action=edit" | |||
) | |||
local tsTitle = mw.title.new(ts) | local tsTitle = mw.title.new(ts) | ||
if tsTitle and cfg['sandbox_title'] then | if tsTitle and cfg['sandbox_title'] then | ||
| Redak 34: | Redak 42: | ||
'%s:%s/%s/%s', tsTitle.nsText, tsTitle.baseText, cfg['sandbox_title'], tsTitle.subpageText)) | '%s:%s/%s/%s', tsTitle.nsText, tsTitle.baseText, cfg['sandbox_title'], tsTitle.subpageText)) | ||
if tsSandboxTitle and tsSandboxTitle.exists then | if tsSandboxTitle and tsSandboxTitle.exists then | ||
sandboxLink = format('sandboxlink', link, ':' .. tsSandboxTitle.prefixedText) | sandboxLink = format('sandboxlink', link, ':' .. tsSandboxTitle.prefixedText) .. " - " .. editLink | ||
end | end | ||
end | end | ||
tStylesLinks[i] = sandboxLink or link | tStylesLinks[i] = sandboxLink or (link .. " (" .. editLink .. ")") | ||
end | end | ||
local tStylesList = mList.makeList('bulleted', tStylesLinks) | local tStylesList = mList.makeList('bulleted', tStylesLinks) | ||
| Redak 53: | Redak 61: | ||
local cfg = getConfig() | local cfg = getConfig() | ||
local cats = {} | local cats = {} | ||
-- Error category | -- Error category | ||
if #tStyles < 1 and cfg['error_category'] then | if #tStyles < 1 and cfg['error_category'] then | ||
cats[#cats + 1] = cfg['error_category'] | cats[#cats + 1] = cfg['error_category'] | ||
end | end | ||
-- TemplateStyles category | -- TemplateStyles category | ||
titleObj = titleObj or mw.title.getCurrentTitle() | titleObj = titleObj or mw.title.getCurrentTitle() | ||