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 6: Regel 6:
local uitgeverijnr = frame.args.uitgeverijnr or ""
local uitgeverijnr = frame.args.uitgeverijnr or ""
local boekpubjaar = frame.args.boekpubjaar or ""
local boekpubjaar = frame.args.boekpubjaar or ""
local boekpubjaarAlt = boekpubjaar
if boekpubjaar == "" then boekpubjaarAlt = "?" end
local druk = frame.args.druk or ""
local druk = frame.args.druk or ""
local titleAddendum = p.createTitleAddendum( boekpubjaar, druk, uitgeverijnr, false )
local titleAddendum = p.createTitleAddendum( boekpubjaar, druk, uitgeverijnr, false )
local titleAddendumVariant = p.createTitleAddendum( boekpubjaar, druk, uitgeverijnr, true )
local titleAddendumVariant = p.createTitleAddendum( boekpubjaar, druk, uitgeverijnr, true )
 
local titelnr = frame.args.titelnr or ""
local titelnr = frame.args.titelnr or ""
--TitelGew
--TitelGew
local titelGew = ""
local titelGew = ""
local titelBiblio = ""
local titelBiblio = ""
local schrijverNrs = ""
local schrijverNrs = ""
local authorNames = ""
local authorNames = ""
Regel 27: Regel 30:
end
end


local authorNameString = authorNames
local authorNameString = authorNames
if authorNames == "" then authorNameString = "---" end
if authorNames == "" then authorNameString = "---" end
Regel 47: Regel 49:
mw.ustring.sub( titelBiblio, 1, 1 )
mw.ustring.sub( titelBiblio, 1, 1 )
)
)
-- TODO: {{#show:{{{TitelNr|-}}} |?Has sort label by author=|link=none}}
local sortLabelByAuthor = ""


local set = {
local set = {
["Title"] = labelForTitle,
["Title"] = labelForTitle,
["Title plain"] = labelForTitlePlain,
["Title plain"] = labelForTitlePlain,
["Has initial"] = initial
["Has initial"] = initial,
-- {{#sub:{{#var:@sort title}}|0|150}}¶
["Has sort label"] = mw.ustring.sub( labelForSort, 1, 150 ) .. "¶",
-- {{{BoekPubJaar|?}}} {{{Druk|}}}¶
["Has sort label by year"] = boekpubjaarAlt .. "  " .. druk .. "¶",
["Has sort label by author"] = "",
["Has publication info"] = titleAddendumVariant
}
}



Versie van 1 okt 2025 18:42

Module:Class/Book




verre aarde de - arthur c clarke 1990 2 / 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

tim 2 - louis de groof 1975 / 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 boekpubjaarAlt = boekpubjaar
	if boekpubjaar == "" then boekpubjaarAlt = "?" end
	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 = mw.ustring.lower(
		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 )
	)
	-- TODO: {{#show:{{{TitelNr|-}}} |?Has sort label by author=|link=none}}
	local sortLabelByAuthor = ""

	local set = {
		["Title"] = labelForTitle,
		["Title plain"] = labelForTitlePlain,
		["Has initial"] = initial,
		-- {{#sub:{{#var:@sort title}}|0|150}}¶
		["Has sort label"] = mw.ustring.sub( labelForSort, 1, 150 ) .. "¶",
		-- {{{BoekPubJaar|?}}} {{{Druk|}}}¶
		["Has sort label by year"] = boekpubjaarAlt .. "  " .. druk .. "¶",
		["Has sort label by author"] = "",
		["Has publication info"] = titleAddendumVariant
	}

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

	return labelForSort .. " / " .. 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