Semantic MediaWikiDit bericht verdwijnt nadat alle relevante taken zijn afgerond.

Er is één onvoltooide of openstaande taak, die nodig is om het bijwerken van Semantic MediaWiki te voltooien. Een beheerder of gebruiker met voldoende rechten kan deze uitvoeren. Dit moet worden gedaan voordat nieuwe gegevens worden toegevoegd om tegenstrijdigheden te voorkomen.

Geen bewerkingssamenvatting
Geen bewerkingssamenvatting
Regel 25: Regel 25:
if #authorTbl > 2 then str = str .. ", e.a." end
if #authorTbl > 2 then str = str .. ", e.a." end
return str
return str
end
p.getFirstAuthorNameBiblio = function( schrijverNrs )
if schrijverNrs == "" or schrijverNrs == nil then return "" end
local authorsTbl = mw.text.split( schrijverNrs, "," )
local naamBiblio = mSlot.getValueFromTemplateData( "ws-page-props", mw.text.trim(authorsTbl[1]), "Person", "NaamBiblio" )
local res = naamBiblio
if naamBiblio == "" then
res = mSlot.getValueFromTemplateData( "ws-page-props", mw.text.trim(authorsTbl[1]), "Person", "NaamGew" )
end
return res
end
end



Versie van 1 okt 2025 19:38

Module:Class/Person




local p = {}
local mSlot = require("Module:Slot")
local mTitle = require("Module:Class/Title")

--[[ 
Accepts a comma-separated list of pages representing persons
and returns up to two names (NaamGew = first name foll. by last name )
- delimiter = &
- if more than two authors are given, the string ends with  ", e.a."
]]--
p.getAuthorNames = function( authors )
	if authors == "" or authors == nil then return "" end
	local authorTbl = mw.text.split( authors, "," )
	--mw.log( "#authorTbl", #authorTbl )
	local nameTbl = {}
	for i,v in ipairs(authorTbl) do
		-- first two authors only
		if i == 1 or i == 2 then
			local naamGew = mSlot.getValueFromTemplateData( "ws-page-props", mw.text.trim(v), "Person", "NaamGew" )
			--mw.log( "naamGew: " .. naamGew )
			table.insert( nameTbl, naamGew )
		end
	end
	local str = table.concat( nameTbl, " & ")
	if #authorTbl > 2 then str = str .. ", e.a." end
	return str
end

p.getFirstAuthorNameBiblio = function( schrijverNrs )
	if schrijverNrs == "" or schrijverNrs == nil then return "" end
	local authorsTbl = mw.text.split( schrijverNrs, "," )
	local naamBiblio = mSlot.getValueFromTemplateData( "ws-page-props", mw.text.trim(authorsTbl[1]), "Person", "NaamBiblio" )
	local res = naamBiblio
	if naamBiblio == "" then
		res = mSlot.getValueFromTemplateData( "ws-page-props", mw.text.trim(authorsTbl[1]), "Person", "NaamGew" )
	end
	return res
end

--[[ used by Class/Book, maybe todo : Class/Title ]]--
p.createSortLabelByAuthor = function( titelBiblio, firstAuthorBiblioName )
	local titleBiblioFlattened = mTitle.flattenBibliographicTitle( titelBiblio )
	return string.lower( firstAuthorBiblioName .. " - " .. titleBiblioFlattened )
end

return p