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 41: Regel 41:
local labelForSort = titelBiblio .. " - " .. authorNames .. " " .. boekpubjaar .. " " .. druk
local labelForSort = titelBiblio .. " - " .. authorNames .. " " .. boekpubjaar .. " " .. druk
labelForSort = mFormatForSorting.minimalStripForSorting( labelForSort )
labelForSort = mFormatForSorting.minimalStripForSorting( labelForSort )
-- {{uc:{{#sub:{{#var:@titelbiblio|{{#var:@titel}}}}|0|1}}}}
local initial = mw.ustring.upper(
mw.ustring.sub( titelBiblio, 1, 1 )
)


return labelForTitle .. " / " .. authorNames .. " / " .. titelGew .. " / " .. titelBiblio .. " / " .. titleAddendum .. " / " .. titleAddendumVariant
local set = {
["Title"] = labelForTitle,
["Title plain"] = labelForTitlePlain,
["Has initial"] = initial
}
 
-- {{DISPLAYTITLE:{{#var:@label2}} }}
-- {{DEFAULTSORT:{{#var:@sort title}} }}
 
return initial .. " / " .. labelForTitle .. " / " .. authorNames .. " / " .. titelGew .. " / " .. titelBiblio .. " / " .. titleAddendum .. " / " .. titleAddendumVariant
end
end



Versie van 1 okt 2025 18:29

Module:Class/Book




V / De verre Aarde - Arthur C. Clarke 1990, 2ᵉdruk, A.W. Bruna & Zoon, Utrecht / Arthur C. Clarke / De verre Aarde / verre Aarde, De / 1990, 2ᵉdruk, A.W. Bruna & Zoon, Utrecht / 2ᵉdruk (1990), A.W. Bruna & Zoon, Utrecht

https://www.fandata.nl/Persoon/1608

T / Tim 2 - Louis de Groof 1975, Standaard Uitgeverij, Antwerpen/Amsterdam / Louis de Groof / Tim 2 / Tim 2 / 1975, Standaard Uitgeverij, Antwerpen/Amsterdam / (1975), Standaard Uitgeverij, Antwerpen/Amsterdam

Has publication info = (1975), Standaard Uitgeverij, Antwerpen/Amsterdam +

Has publication year = 1975

Has sort label = Tim 2 louis de groof 1975¶

Has sort label by author = Groof, louis de - tim 2¶


local p = {}
local mSlot = require("Module:Slot")
local mFormatForSorting = require("Module:Format for sorting")

p.set = function( frame ) 
	local uitgeverijnr = frame.args.uitgeverijnr or ""
	local boekpubjaar = frame.args.boekpubjaar or ""
	local druk = frame.args.druk or ""
	local titleAddendum = p.createTitleAddendum( boekpubjaar, druk, uitgeverijnr, false )
	local titleAddendumVariant = p.createTitleAddendum( boekpubjaar, druk, uitgeverijnr, true )
	
	local titelnr = frame.args.titelnr or ""
	--TitelGew
	local titelGew = ""
	local titelBiblio = ""
	local schrijverNrs = ""
	local authorNames = ""
	if titelnr ~= "" then
		titelGew = mSlot.getValueFromTemplateData( "ws-page-props", titelnr, "Title", "TitelGew" )
		titelBiblio = mSlot.getValueFromTemplateData( "ws-page-props", titelnr, "Title", "TitelBiblio" )
		if titelBiblio == nil or titelBiblio == "" then titelBiblio = titelGew end
		schrijverNr = mSlot.getValueFromTemplateData( "ws-page-props", titelnr, "Title", "SchrijverNr" )
		--mw.log( "schrijverNr: " .. schrijverNr )
		authorNames = p.getAuthorNames( schrijverNr )
		--mw.log( "authorNames: " .. authorNames )
		-- + get author names of first two authors
	end

	
	local authorNameString = authorNames
	if authorNames == "" then authorNameString = "---" end
	
	-- <i>{{#var:@titel}}</i> - {{#var:@naamgew|---}} {{#if:{{#var:@title addendum}}|{{#var:@title addendum}}}}
	local labelForTitle = "<i>" .. titelGew .. "</i> - " .. authorNameString .. " " .. titleAddendum
	labelForTitle = mw.text.trim(labelForTitle)
	-- {{#var:@titel}} - {{#var:@naamgew|---}} {{#if:{{#var:@title addendum}}|{{#var:@title addendum}}}} 
	local labelForTitlePlain = titelGew .. " - " .. authorNameString .. " " .. titleAddendum
	labelForTitlePlain = mw.text.trim(labelForTitlePlain)
	-- @sort title = {{lc:{{Strip title for sorting|1={{#var:@titelbiblio}} - {{#var:@naamgew}} {{{BoekPubJaar|}}} {{{Druk|}}} }} }}
	--local stripped = mFormatForSorting.minimalStripForSorting( titelBiblio )
	local labelForSort = titelBiblio .. " - " .. authorNames .. " " .. boekpubjaar .. " " .. druk
	labelForSort = mFormatForSorting.minimalStripForSorting( labelForSort )
	-- {{uc:{{#sub:{{#var:@titelbiblio|{{#var:@titel}}}}|0|1}}}}
	local initial = mw.ustring.upper(
		mw.ustring.sub( titelBiblio, 1, 1 )
	)

	local set = {
		["Title"] = labelForTitle,
		["Title plain"] = labelForTitlePlain,
		["Has initial"] = initial
	}

	-- {{DISPLAYTITLE:{{#var:@label2}} }} 
	-- {{DEFAULTSORT:{{#var:@sort title}} }}

	return initial .. " / " .. labelForTitle .. " / " .. authorNames .. " / " .. titelGew .. " / " .. titelBiblio .. " / " .. titleAddendum .. " / " .. titleAddendumVariant
end

p.createTitleAddendum = function( boekpubjaar, druk, uitgeverijnr, variant )
	local str = ""
	local boekpubjaar = boekpubjaar or "?"
	if boekpubjaar == "" then boekpubjaar = "?" end

	local drukWeergave = ""
	if druk ~= "" then
		local drukN = tonumber(druk)
		if drukN == nil then
			drukWeergave =  "druk: " .. druk
		else
			drukWeergave =  druk .. "ᵉ" .. "druk"
		end
	end

	local uitgeverijnaam = ""
	if uitgeverijnr ~= "" then
		--local slotContent = mSlot.getSlotContent( uitgeverijnr, "ws-page-props", "Publisher" )
		uitgeverijnaam = mSlot.getValueFromTemplateData( "ws-page-props", uitgeverijnr, "Publisher", "Naam" )
	end

	-- concat
	if variant ~= "" and variant == true then
		str = drukWeergave .. " (" .. boekpubjaar .. ")"
		if uitgeverijnaam ~= "" then str = str .. ", " .. uitgeverijnaam end
	else
		str = boekpubjaar
		if drukWeergave ~= "" then str = str .. ", " .. drukWeergave end
		if uitgeverijnaam ~= "" then str = str .. ", " .. uitgeverijnaam end
	end

	return str
end

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

return p