אונטערשייד צווישן ווערסיעס פון "יחידה:תבנית מידע"

909 בייטן צוגעלייגט ,  פֿאַר 1 יאָר
אפדעיט
(תמונה + בילד)
(אפדעיט)
שורה 355: שורה 355:
if hasData then
if hasData then
if options['formatter'] then
res = options['formatter'](res)
end
local link = mw.title.makeTitle( 0, entityId, propertyName, 'wikidata' ):fullUrl('uselang=he')
local link = mw.title.makeTitle( 0, entityId, propertyName, 'wikidata' ):fullUrl('uselang=he')
res = res .. mw.ustring.format(' [[File:Blue pencil RTL.svg|15px|link=%s|עריכת הנתון בוויקינתונים]]', link)
res = res .. mw.ustring.format(' [[File:Blue pencil RTL.svg|15px|link=%s|עריכת הנתון בוויקינתונים]]', link)
שורה 400: שורה 404:
local filterFunc = mw.ustring.match(templateParams[missingParam..'-ויקינתונים-סינון'],'filter[a-zA-Z]+')
local filterFunc = mw.ustring.match(templateParams[missingParam..'-ויקינתונים-סינון'],'filter[a-zA-Z]+')
wikidataOptions['filter'] = require(moduleTitle)[filterFunc]
wikidataOptions['filter'] = require(moduleTitle)[filterFunc]
end
if templateParams[missingParam..'-ויקינתונים-עיצוב'] and mw.ustring.match(templateParams[missingParam..'-ויקינתונים-עיצוב'], '[a-zA-Z]+') then
local moduleTitle = mw.ustring.match( frame:getParent():getTitle(), 'מוסטער:(.+)' )
moduleTitle = mw.ustring.format('יחידה:%s', moduleTitle)
local formatFunc = templateParams[missingParam..'-ויקינתונים-עיצוב']
wikidataOptions['formatter'] = require(moduleTitle)[formatFunc]
end
end
שורה 413: שורה 424:
wikidataOptions['img-width'] = templateParams[missingParam..'-ויקינתונים-תמונה-גודל']
wikidataOptions['img-width'] = templateParams[missingParam..'-ויקינתונים-תמונה-גודל']
end
end
if templateParams[missingParam..'-ויקינתונים'] then
if templateParams[missingParam..'-ויקינתונים'] then
if templateParams[missingParam..'-ויקינתונים-יחידה'] then
if templateParams[missingParam..'-ויקינתונים-יחידה'] then
שורה 538: שורה 550:
if #propertyVals == 0 then propertyVals = mw.wikibase.getBestStatements(entityId, 'P1559') end
if #propertyVals == 0 then propertyVals = mw.wikibase.getBestStatements(entityId, 'P1559') end
if #propertyVals > 0 then
if #propertyVals > 0 then
local propValue = propertyVals[1].mainsnak and propertyVals[1].mainsnak.datavalue
for _,propertyVal in pairs(propertyVals) do
if  propValue and propValue.value and propValue.value.text and propValue.value.text~=name then
local propValue = propertyVal.mainsnak and propertyVal.mainsnak.datavalue
originName = mw.ustring.format('<span lang="%s" title="%s">%s</span>', propValue.value.language,  
-- by convention we pick single origin name
        mw.language.fetchLanguageName( propValue.value.language , 'he'), propValue.value.text)
if  propValue and propValue.value and propValue.value.text and propValue.value.text~=name and not originName then
    end
originName = mw.ustring.format('<span lang="%s" title="%s">%s</span>', propValue.value.language,  
        mw.language.fetchLanguageName( propValue.value.language , 'he'), propValue.value.text)
    end
end
end
end
end
end
if originName and #originName and originName~=name then
if originName and #originName and originName~=name then
name = name..'<br>'..originName
name = name..'<br>'..originName
שורה 560: שורה 574:
local templateStructure = {}
local templateStructure = {}
args.subtemplate = frame.args['תת-תבנית']
args.subtemplate = frame.args['תת-תבנית']
args.entityId = templateArgs['qid'] or templateParams['qid']
if (templateArgs['qid'] ~= nil and templateArgs['qid'] ~= '') then
args.entityId = templateArgs['qid']
elseif (templateParams['qid'] ~= nil and templateParams['qid'] ~= '') then
args.entityId = templateParams['qid']
else
args.entityId = mw.wikibase.getEntityIdForCurrentPage()
end
-- disable wikidata fetching
-- disable wikidata fetching
if args.entityId == '' or args.entityId == '-' then args.entityId = nil end
if args.entityId == '' or args.entityId == '-' then args.entityId = nil end