יחידה:תבנית מידע: הבדלים בין גרסאות בדף

מאין תקציר עריכה
מ כותרת סטנדרטית (שם+שם בשפת המקור) אם התבנית לא מציינת במפורש כותרת מיוחדת
שורה 428: שורה 428:
return WikidataCrossValidation.maintainceCategory(matching, propertyName)
return WikidataCrossValidation.maintainceCategory(matching, propertyName)
end
end
end
--[[
If template doesn't specify title parameter, the default is name (fallback by title) + origin name (fallback by wikidata)
]]
function standardTitle(templateArgs, isSubTemplate)
local name = templateArgs['שם']
if name=='-' then return name end --
if isSubTemplate then return name or '' end
local originName = templateArgs['שם בשפת המקור']
if not name then --fallback to title
name = mw.title.getCurrentTitle().text
    name = mw.ustring.gsub(name, " *[(].*[)]","")
end
if originName == '-' then
originName = ''
else
-- use wikidata as fallback
if not originName or #originName==0 then
originName = propertyLink.getProperty('P1705') or propertyLink.getProperty('P1476') or propertyLink.getProperty('P1559')
end
if originName and #originName then
name = name..'<br>'..originName
end
end
return name
end
end


שורה 436: שורה 464:
local args={}
local args={}
local templateStructure = {}
local templateStructure = {}
args.title = frame.args['כותרת תבנית']
args.subtemplate = frame.args['תת-תבנית']
args.title = frame.args['כותרת תבנית'] or standardTitle(templateArgs, args.subtemplate)
if args.title=='-' then args.subtemplate = true end
args.titlestyle = frame.args['כותרת תבנית-עיצוב']
args.titlestyle = frame.args['כותרת תבנית-עיצוב']
args.titleclass = frame.args['כותרת תבנית-מחלקה']
args.titleclass = frame.args['כותרת תבנית-מחלקה']
שורה 455: שורה 485:
args.tablestyle = frame.args['טבלה-עיצוב']
args.tablestyle = frame.args['טבלה-עיצוב']
args.tableclass = frame.args['טבלה-מחלקה']
args.tableclass = frame.args['טבלה-מחלקה']
args.subtemplate = frame.args['תת-תבנית']
args.entityId = templateArgs['qid'] or mw.wikibase.getEntityIdForCurrentPage()
args.entityId = templateArgs['qid'] or mw.wikibase.getEntityIdForCurrentPage()
local isSelfUse = (mw.title.getCurrentTitle().namespace==10)
local isSelfUse = (mw.title.getCurrentTitle().namespace==10)
שורה 591: שורה 620:
end
end
if args.title=='-' then
args.subtemplate = true
end
self.args = args
self.args = args
self.templateStructure = templateStructure
self.templateStructure = templateStructure