Module:Authority control/documentation and Module:Authority control/documentation/sandbox: Difference between pages
(Difference between pages)
imported>TheDragonFire Attempt to prevent crash |
imported>MSGJ mirror change to live |
||
| Line 4: | Line 4: | ||
local config_file = frame.args.config and frame.args.config~='' and ('/' .. frame.args.config) or '' | local config_file = frame.args.config and frame.args.config~='' and ('/' .. frame.args.config) or '' | ||
local config = mw.loadData('Module:Authority control/config' .. config_file) | local config = mw.loadData('Module:Authority control/config' .. config_file) | ||
local sandbox | local sandbox = '/' .. config.i18n.sandbox | ||
local title = mw.title.getCurrentTitle() | local title = mw.title.getCurrentTitle() | ||
local namespace = title.namespace | local namespace = title.namespace | ||
| Line 72: | Line 72: | ||
)} | )} | ||
} or '' | } or '' | ||
local col1 = mw.html.create('th'):attr('data-sort-value', conf.property) | local col1 = mw.html.create('th') | ||
:attr('data-sort-value', conf.property) | |||
:attr('rowspan',conf.remark and '2' or '1') | |||
:wikitext(frame:expandTemplate{ | |||
title = 'Wikidata property link', | |||
args = {conf.property} | |||
}) | |||
local col2 = mw.html.create('td') | |||
:wikitext(getname(conf.property)) | |||
local col3 = mw.html.create('td') | |||
:css('text-align', 'center') | |||
:wikitext(config.sections[conf.section].name) | |||
local col4 = mw.html.create('td') | |||
:wikitext(example) | |||
local row = mw.html.create('tr') | local row = mw.html.create('tr') | ||
:node(col1) | :node(col1) | ||
: | :node(col2) | ||
: | :node(col4) | ||
: | :node(col4) | ||
local remark | local remark | ||
if conf.remark then | if conf.remark then | ||
local cell = mw.html.create('td') | |||
:attr('colspan', '3') | |||
:tag('span'):css('font-weight', 'bold'):wikitext('ℹ️ '):done() | |||
:wikitext(frame:preprocess{text = conf.remark}) | |||
: | remark = mw.html.create('tr') | ||
:addClass('expand-child') | |||
:node(cell) | |||
end | end | ||
return row, remark | return row, remark | ||
| Line 118: | Line 129: | ||
table.insert(plist, frame:expandTemplate{title='Wikidata property link', args={'P' .. property}}) | table.insert(plist, frame:expandTemplate{title='Wikidata property link', args={'P' .. property}}) | ||
end | end | ||
local link = wlist.topic and mw.wikibase.getSitelink('Q' .. wlist.topic) | |||
and '[[' .. mw.wikibase.getSitelink('Q' .. wlist.topic) .. ']]' | |||
or mw.wikibase.getLabel('Q' .. wlist.topic) | |||
local row = mw.html.create('tr') | local row = mw.html.create('tr') | ||
:tag('th'):wikitext(code):done() | :tag('th'):wikitext(code):done() | ||
:tag('td'):wikitext( | :tag('td'):wikitext(link):done() | ||
:tag('td'):wikitext(table.concat(plist,', ')):done() | :tag('td'):wikitext(table.concat(plist,', ')):done() | ||
Table:node(row) | Table:node(row) | ||
| Line 194: | Line 208: | ||
out = out .. '</li></ul>' | out = out .. '</li></ul>' | ||
return out | return out | ||
end | |||
p.listproperties = function() | |||
local tab = {} | |||
for _, conf in pairs(config.config) do | |||
table.insert(tab, conf.property) | |||
end | |||
return table.concat(tab, ', ') | |||
end | end | ||
return p | return p | ||