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
 
(4 tussenliggende versies door dezelfde gebruiker niet weergegeven)
Regel 2: Regel 2:
local mSlot = require("Module:Slot")
local mSlot = require("Module:Slot")
local mFormatForSorting = require("Module:Format for sorting")
local mFormatForSorting = require("Module:Format for sorting")
--local mTitle = require("Module:Class/Title")
local mTitle = require("Module:Class/Title")
--local mPerson = require("Module:Class/Person")
local mPerson = require("Module:Class/Person")


--[[
--[[
Regel 24: Regel 24:
local titelid = frame.args.titelid or ""
local titelid = frame.args.titelid or ""
local boekid = frame.args.boekid or ""
local boekid = frame.args.boekid or ""
 
local titelGew = ""
-- |Has publication year={{#show:{{{BoekID|}}} |?Has publication year }}
local titelBiblio = ""
local jaar = mSlot.getValueFromTemplateData( "ws-page-props", boekid, "Book", "BoekPubJaar", "?" )
local labelForSort = ""
-- |Has publication year (date)={{#show:{{{BoekID|}}} |?Has publication year (date)}}
local displayTitle = ""
local jaarForTypeDate = nil
if string.match( string.gsub( jaar, "±", "" ), "^%d+$") then jaarForTypeDate = jaar end
 
local titelGew = "Geen titel"
local titelBiblio = titelGew
local labelForSort = titelGew
local displayTitle = titelGew
local initial = "G"
local sortLabelByAuthor = ""
if titelid ~= "" then
if titelid ~= "" then
titelGew = mSlot.getValueFromTemplateData( "ws-page-props", titelid, "Title", "TitelGew" )
titelGew = mSlot.getValueFromTemplateData( "ws-page-props", titelid, "Title", "TitelGew" )
titelBiblio = mSlot.getValueFromTemplateData( "ws-page-props", titelid, "Title", "TitelBiblio" )
titelBiblio = mSlot.getValueFromTemplateData( "ws-page-props", titelid, "Title", "TitelBiblio" )
if titelGew == "" then
if titelGew ~= "" then
displayTitle = "Geen titel"
else
displayTitle = titelGew
displayTitle = titelGew
end
end
labelForSort = mFormatForSorting.flatten( mw.text.trim( titelBiblio ) )
if titelBiblio ~= "" then
initial = mw.ustring.upper( mw.ustring.sub( titelBiblio, 1, 1 ) )
labelForSort = mFormatForSorting.flatten( mw.text.trim( titelBiblio ) )
end
local firstAuthorNameBiblio = ""
local schrijverNrs = mSlot.getValueFromTemplateData( "ws-page-props", titelid, "Title", "SchrijverNr" )
if schrijverNrs ~= "" then
--authorNames = mPerson.getAuthorNames( schrijverNrs )
firstAuthorNameBiblio = mPerson.getFirstAuthorNameBiblio( schrijverNrs )
end
sortLabelByAuthor = mTitle.createSortLabelByAuthor( titelBiblio, firstAuthorNameBiblio )
end
end
Regel 43: Regel 60:
["Title"] = displayTitle,
["Title"] = displayTitle,
["Title plain"] = displayTitle,
["Title plain"] = displayTitle,
["Has sort label"] = labelForSort,
["Has sort label"] = labelForSort .. "¶",
["Has sort label by author"] = "",
["Has sort label by author"] = mw.ustring.sub( sortLabelByAuthor, 1, 200 ) .. "",
["Has initial"] = ""
["Has initial"] = initial,
["Has publication year"] = jaar,
["Has publication year (date)"] = jaarForTypeDate
}
}

Huidige versie van 28 okt 2025 18:26

Module:Class/Book contribution




example
{"Has publication year (date)":"2018","Has initial":"W","Title":"De wereld in","Has publication year":"2018","Has sort label":"wereld in de¶","Title plain":"De wereld in","Has sort label by author":"dragt, tonke - wereld in de¶"}
{"Has publication year (date)":"1974","Has initial":"O","Title":"Onvoltooide engelen","Has publication year":"1974","Has sort label":"onvoltooide engelen¶","Title plain":"Onvoltooide engelen","Has sort label by author":"brite, poppy z. - onvoltooide engelen¶"}

local p = {}
local mSlot = require("Module:Slot")
local mFormatForSorting = require("Module:Format for sorting")
local mTitle = require("Module:Class/Title")
local mPerson = require("Module:Class/Person")

--[[
-->{{#slottemplates:ws-page-props |{{{TitelID|}}} | @title-props }}<!--
-->{{#vardefine:@titel|{{#caprint:@title-props[Title][TitelGew]}} }}<!--
-->{{#vardefine:@sort title|{{Strip title for sorting|{{lc:{{#caprint:@title-props[Title][TitelBiblio]}}}} }} }}<!--
-->{{DISPLAYTITLE:{{#var:@titel|Geen titel}}}}<!--

|Has publication year={{#show:{{{BoekID|}}} |?Has publication year}}
|Has publication year (date)={{#show:{{{BoekID|}}} |?Has publication year (date)}}
|Title={{#var:@titel|Geen titel}}
|Title plain={{#var:@titel|Geen titel}}
|Has sort label={{#var:@sort title}}¶
|Has sort label by author={{#show:{{{TitelID|-}}}|?Has sort label by author=|link=none}}
|Has initial={{uc:{{#sub:{{#var:@sort title}}|0|1}}}}

]]--
	
p.set = function( frame )
	local titelid = frame.args.titelid or ""
	local boekid = frame.args.boekid or ""

	-- |Has publication year={{#show:{{{BoekID|}}} |?Has publication year }}
	local jaar = mSlot.getValueFromTemplateData( "ws-page-props", boekid, "Book", "BoekPubJaar", "?" )
	-- |Has publication year (date)={{#show:{{{BoekID|}}} |?Has publication year (date)}}
	local jaarForTypeDate = nil
	if string.match( string.gsub( jaar, "±", "" ), "^%d+$") then jaarForTypeDate = jaar end

	local titelGew = "Geen titel"
	local titelBiblio = titelGew
	local labelForSort = titelGew
	local displayTitle = titelGew
	local initial = "G"
	local sortLabelByAuthor = ""
	if titelid ~= "" then
		titelGew = mSlot.getValueFromTemplateData( "ws-page-props", titelid, "Title", "TitelGew" )
		titelBiblio = mSlot.getValueFromTemplateData( "ws-page-props", titelid, "Title", "TitelBiblio" )
		if titelGew ~= "" then
			displayTitle = titelGew
		end
		if titelBiblio ~= "" then
			initial = mw.ustring.upper( mw.ustring.sub( titelBiblio, 1, 1 ) )
			labelForSort = mFormatForSorting.flatten( mw.text.trim( titelBiblio ) )
		end
		
		local firstAuthorNameBiblio = ""
		local schrijverNrs = mSlot.getValueFromTemplateData( "ws-page-props", titelid, "Title", "SchrijverNr" )
		if schrijverNrs ~= "" then
			--authorNames = mPerson.getAuthorNames( schrijverNrs )
			firstAuthorNameBiblio = mPerson.getFirstAuthorNameBiblio( schrijverNrs )
		end
		sortLabelByAuthor = mTitle.createSortLabelByAuthor( titelBiblio, firstAuthorNameBiblio )
	end
	
	local set = {
		["Title"] = displayTitle,
		["Title plain"] = displayTitle,
		["Has sort label"] = labelForSort .. "¶",
		["Has sort label by author"] = mw.ustring.sub( sortLabelByAuthor, 1, 200 ) .. "¶",
		["Has initial"] = initial,
		["Has publication year"] = jaar,
		["Has publication year (date)"] = jaarForTypeDate
	}
	
	local debugmode = frame.args.debugmode or "false"
	if debugmode == "true" then
		return "<pre>" .. mw.text.jsonEncode( set ) .. "</pre>"
	end
	
	local setResult = nil
	if mw.smw then
		setResult = mw.smw.set( set )
	end
	
	mw.ext.displaytitle.set( displayTitle )

end

return p