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

אפדעיט
(תמונה + בילד)
(אפדעיט)
 
(2 צווישנדיגע ווערסיעס פונעם זעלבן באַניצער נישט געוויזן)
שורה 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
שורה 430: שורה 442:
wikidataOptions['seperator'] = templateParams[missingParam..'-ויקינתונים-מרובה-הפרדה']
wikidataOptions['seperator'] = templateParams[missingParam..'-ויקינתונים-מרובה-הפרדה']
wikidataOptions['sort'] = { templateParams[missingParam..'-ויקינתונים-מרובה-מיון'] } or nil
wikidataOptions['sort'] = { templateParams[missingParam..'-ויקינתונים-מרובה-מיון'] } or nil
if templateParams[missingParam..'-ויקינתונים-מרובה-מיון-יורד'] then
wikidataOptions['sort-order'] = 'desc'
end
paramsData = {}
paramsData = {}
-- split multiple params to include all of them (e.g: "P1,P2")
-- split multiple params to include all of them (e.g: "P1,P2")
שורה 458: שורה 473:
local wikidataParamValue = propertyLink.getLabel(templateParams[missingParam..'-ויקינתונים-פשוט'], entityId)
local wikidataParamValue = propertyLink.getLabel(templateParams[missingParam..'-ויקינתונים-פשוט'], entityId)
if wikidataParamValue and #wikidataParamValue>0 then
if wikidataParamValue and #wikidataParamValue>0 then
templateArg.data = frame:preprocess(mw.ustring.gsub(templateArg.data, '\{\{\{('..missingParam..')\}\}\}', wikidataParamValue))
templateArg.data = frame:preprocess(mw.ustring.gsub(templateArg.data, '{{{('..missingParam..')}}}', wikidataParamValue))
inWikidata = true
inWikidata = true
end
end
שורה 538: שורה 553:
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: שורה 577:
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']
else
args.entityId = templateParams['qid']
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
שורה 567: שורה 588:
args.titlestyle = templateParams['כותרת תבנית-עיצוב']
args.titlestyle = templateParams['כותרת תבנית-עיצוב']
args.titleclass = templateParams['כותרת תבנית-מחלקה']
args.titleclass = templateParams['כותרת תבנית-מחלקה']
args.subtitle = templateParams['תת כותרת תבנית']
args.subtitle = templateParams['תת-כותרת תבנית']
args.subtitlestyle = templateParams['תת כותרת תבנית-עיצוב']
args.subtitlestyle = templateParams['תת-כותרת תבנית-עיצוב']
args.subtitleclass = templateParams['תת כותרת תבנית-מחלקה']
args.subtitleclass = templateParams['תת-כותרת תבנית-מחלקה']
args.rightImageDesc = templateParams['כיתוב ימין']
args.rightImageDesc = templateParams['כיתוב ימין']
שורה 575: שורה 596:
valueArg=templateParams['תמונה ימין'],
valueArg=templateParams['תמונה ימין'],
wikidataArg=templateParams['תמונה ימין-ויקינתונים'],
wikidataArg=templateParams['תמונה ימין-ויקינתונים'],
width='100x80',  
width=templateParams['תמונה ימין-גודל'] or '100x80',  
imgDesc=args.rightImageDesc,
imgDesc=args.rightImageDesc,
args=args
args=args
שורה 584: שורה 605:
valueArg=templateParams['תמונה שמאל'],
valueArg=templateParams['תמונה שמאל'],
wikidataArg=templateParams['תמונה שמאל-ויקינתונים'],
wikidataArg=templateParams['תמונה שמאל-ויקינתונים'],
width='100x80',  
width=templateParams['תמונה שמאל-גודל'] or '100x80',  
imgDesc=args.leftImageDesc,
imgDesc=args.leftImageDesc,
args=args
args=args
שורה 758: שורה 779:
else
else
-- otherwise if the template isn't full or if there is a Wikidata-beats tag - them try to use wikidata to fill it
-- otherwise if the template isn't full or if there is a Wikidata-beats tag - them try to use wikidata to fill it
local m = mw.ustring.match(v.data, '\{\{\{(.-)\}\}\}')
local m = mw.ustring.match(v.data, '{{{(.-)}}}')
if v.label and templateParams[v.label..'-ויקינתונים-גובר'] then
if v.label and templateParams[v.label..'-ויקינתונים-גובר'] then
m = templateParams[v.label..'-ויקינתונים-גובר']
m = templateParams[v.label..'-ויקינתונים-גובר']
שורה 803: שורה 824:
-- use wikidata in title
-- use wikidata in title
if args.title then
if args.title then
local m = mw.ustring.match(args.title, '\{\{\{(.-)\|?\}\}\}')  
local m = mw.ustring.match(args.title, '{{{(.-)|(?)}}}')  
if m then
if m then
local inWikidata = false
local inWikidata = false
שורה 815: שורה 836:
local wikidataParamValue = propertyLink.getLabel(templateParams[m..'-ויקינתונים-פשוט'])
local wikidataParamValue = propertyLink.getLabel(templateParams[m..'-ויקינתונים-פשוט'])
if wikidataParamValue then
if wikidataParamValue then
args.title = frame:preprocess(mw.ustring.gsub(args.title, '\{\{\{('..m..')\|?\}\}\}', wikidataParamValue))
args.title = frame:preprocess(mw.ustring.gsub(args.title, '{{{('..m..')|?}}}', wikidataParamValue))
end
end
end
end