Module:Class/Periodical contribution
{{#invoke:Class/Periodical contribution|set
|titelid=
|tijdschriftnr=
}}
- debugmode
{"Has initial":"Z","Title":"De zwarte dood","Has publication year":"1977","Has sort label":"zwarte dood de¶","Title plain":"De zwarte dood","Has sort label by author":"laerhoven, bob van - zwarte dood de¶"}
local p = {}
local mSlot = require("Module:Slot")
local mFormat= require("Module:Format for sorting")
local mClassTitle = require("Module:Class/Title")
p.set = function(frame)
-- (1) properties derived from TitelID
-- pagename of title
local titelid = frame.args.titelid or ""
-- s[Title][TitelGew]
local titelGew = mSlot.getValueFromTemplateData( "ws-page-props", titelid, "Title", "TitelGew" )
local titelBiblio = mSlot.getValueFromTemplateData( "ws-page-props", titelid, "Title", "TitelBiblio" )
if titelGew == nil then return "" end
local sortTitle = mFormat.flatten( titelBiblio or titelGew )
-- {{uc:{{#sub:{{#var:@sort title}}|0|1}}}}
local initial = mw.ustring.upper( mw.ustring.sub( sortTitle, 1, 1 ) )
local set = {}
set = {
["Title"] = titelGew,
["Title plain"] = titelGew,
["Has sort label"] = sortTitle .. "¶",
["Has sort label by author"] = mClassTitle.getSortLabelByAuthor( titelid ), -- {{#show:{{{TitelID|}}}|?Has sort label by author=|link=none}}
["Has initial"] = initial
}
-- (2) properties derived from TijdschriftNr
local tijdschriftnr = frame.args.tijdschriftnr or nil
if tijdschriftnr ~= nil then
-- {{#show:{{{TijdschriftNr|}}}|?Has publication year}}
set["Has publication year"] = mSlot.getValueFromTemplateData( "ws-page-props", tijdschriftnr, "Periodical issue", "Jaar" )
end
local debugmode = frame.args.debugmode or "false"
if debugmode == "true" then
return "<pre>" .. mw.text.jsonEncode( set ) .. "</pre>"
end
-- #set
local setResult = nil
if mw.smw then
setResult = mw.smw.set( set )
end
-- DISPLAYTITLE
mw.ext.displaytitle.set( titelGew )
end
return p
