Jump to content

Module:Taxonbar/confdoc

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Jts1882 (talk | contribs) at 13:22, 13 November 2021 (basic function for wikidataInfo() with outline table). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

require('Module:No globals')

local conf = require( "Module:Taxonbar/conf" ) -- configuration module

local p = {}
	
function p.confdoc( frame )
	local wikitable = '{| class="wikitable sortable"\n' .. 
					  '|-\n' .. 
					  '! Parameter !! data-sort-type=number style="white-space: nowrap;"|Wikidata ID !! Authority !! Description'
	
	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 TaxonbarProperty = frame:expandTemplate{ title = 'Taxonbar/Property', args = { prop } }
			wikitable = wikitable .. '\n' .. 
					    '|-\n' .. 
					    '|' .. param .. '||' .. TaxonbarProperty
		end
	end
	
	return wikitable .. '\n|}'
end
--[[ p.wikidataInfo( frame )
    -function to show formatURL and id for taxonomic databases
]]

function p.wikidataInfo( frame )
	local wikitable = '{| class="wikitable sortable"\n' .. 
					  '|-\n' .. 
					  '! Parameter !! data-sort-type=number style="white-space: nowrap;"|Wikidata ID !! Database !! database ID !! formatterURL'
	
	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 TaxonbarProperty = frame:expandTemplate{ title = 'Taxonbar/Property', args = { prop } }
			wikitable = wikitable .. '\n' .. '|-' 
					    .. '\n|' .. param 
					    .. '\n|' .. '[[:d:Property:P' .. prop .. '|P' .. prop .. ']]' 
					    .. '\n|' .. 'db'
					    .. '\n|' .. 'id'
					    .. '\n|' .. 'url'
		end
	end
	
	return wikitable .. '\n|}'
end

return p