Module:Taxonbar/confdoc: Difference between revisions

Content deleted Content added
improve formatting of examples
use require('strict') instead of require('Module:No globals')
 
(4 intermediate revisions by 3 users not shown)
Line 1:
require('Module:No globalsstrict')
 
local conf = require( "Module:Taxonbar/conf" ) -- configuration module
Line 6:
function p.confdoc( frame )
local wikitable = '{| class="wikitable sortable"\n' mw.html. create('table')
wikitable:addClass('wikitable sortable')
'|-\n' ..
:tag('caption')
'! Parameter !! data-sort-type=number style="white-space: nowrap;"|Wikidata ID !! Authority !! Description'
:wikitext('Taxon identifiers by parameter name')
:done()
:tag('tr')
:tag('th')
:wikitext('Parameter')
:tag('th')
:attr('data-sort-type', 'number')
:css('white-space', 'nowrap')
:wikitext('Wikidata ID')
:tag('th')
:wikitext('Authority')
:tag('th')
:wikitext('Description')
local format = string.format
for _, db in pairs( conf.databases ) do
local param = mw.ustring.lower(db[1])
local prop = db[3]
if type(prop) == 'number' and prop > 0 then
local param = mw.ustring.lower(db[1])
local TaxonbarProperty = frame:expandTemplate{ title = 'Taxonbar/Property', args = { prop } }
wikitablelocal row = wikitable mw.html. create('\ntr' .. )
row
'|-\n' ..
:tag('td')
'|' .. param .. '||' .. TaxonbarProperty
:wikitext(param)
:tag('td')
:attr('data-sort-value', prop)
:wikitext(format('[[d:Property:P%d|P%d]]', prop, prop))
-- {{#statements:P1629|from=P{{{1|}}}}}
:tag('td')
:wikitext(frame:callParserFunction{
name = '#statements:P1629',
args = { from = 'P' .. prop }
})
:tag('td')
:wikitext(mw.wikibase.getDescription('P' .. prop))
wikitable:node(row)
end
end
return wikitable .. '\n|}'
end
--[[ p.wikidataInfo( frame )
Line 36 ⟶ 66:
local wikitable = '{| class="wikitable sortable"\n' ..
'|-\n' ..
'! Parameter !! data-sort-type=number style="white-space: nowrap;"|Wikidata ID !! Database !! Examples !! datatype !! formatterURL (or alternative) and examples'
for _, db in pairs( conf.databases ) do
Line 91 ⟶ 121:
.. '\n|' .. examples
.. '\n|' .. datatype
.. '\n|' .. url .. '<small>\n{{smalldiv|1=' .. links .. '</small>}}'
end
end