وحدة:بطاقة/قالب/جبل

local building = require "وحدة:بطاقة/أدوات/مبنى"
local general = require "وحدة:بطاقة/أدوات"
local localdata = require("وحدة:بطاقة/بيانات")
local wd = require "Module:Wikidata/fr"

local formats = {
	-- على الخريطة :
    --أيقونة المؤشر -- لون المؤشر -- مستوى التكبير 
    Q29025902 = {"triangle-stroked", "#8B0000", "10"}, -- formation volcanique
    Q1061151 = {"triangle-stroked", "#996633", "6"}, -- massif
    Q46831 = {"triangle-stroked", "#996633", "6"}, -- chaîne de montagnes
    Q150784 = {"circle-stroked", "#996633", "10"}, -- gorge
    default = {"triangle-stroked", "#996633", "4"}
}

local function wdformat() --retourne une table
    local wtypes =
        wd.stringTable {
        entity = localdata.item,
        property = "P31",
        displayformat = "raw",
        excludespecial = true
    }
    local default = formats.default
    wtypes = wd.addVals(wtypes or {}, {property = "P279"}, 1) -- on utilise en plus les sous-classes
    
    --mw.logObject(wtypes)
    
    for i, item in pairs(wtypes or {}) do
        if formats[item] then
            return formats[item]
        end
    end
    return default
end
local function setcharte()
    if localdata["charte"] then
        charte = localdata["charte"]
        for i, j in pairs(formats) do
            if j[2] == charte then
                return j
            end
        end
    end
    return wdformat()
end

local displayformat = setcharte()

return {
    maincolor = "#996633",
    --thirdcolor = "white",
  
    wikimod = 'Wikidata.Ca',
    parts = {
        general.title({icon="map",style={color='white'}}),
        general.mainimage(),
        {
            type = "table",
            title = "معلومات عامة",
            rows = {
                {
                	type = "row", 
                	label = "جرم", 
                	value = "جرم", 
                	wikidata = {property = "P376"},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                general.country(),
                {
                	type = "row", 
                	label = "المكان", 
                	value = {"مكان", 'location'},
                	wikidata = {property = "P131"},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                building.island(),
                building.watershed(),
                building.protectedarea(),
                {
                	type = "row",  
                	label = "جزء من",
                	value = {"جزء_من",'part_of'},  
                	wikidata = {
                		property  ="P361" , formatting="table", 
                		tablesort=1 , listrank="bestrank",
                		qualifier1 = "P580 or P582" ,
                		rowsubformat1="<small> ($2–$3)</small>",
                		qualifier2="P580", qualifier3="P582", 
                		colformat2="Y", colformat3="Y",
                		qualifier4="P1552",rowsubformat4=", $4" ,
                		rowformat="$0$1$4" ,separator="<br/>" ,conjunction="<br/>"
                	},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                	type = "row", 
                	label = "المنطقة البيئية" 	, 
                	value = {"المنطقة البيئية" },
                	wikidata = {property="P1425"}
                },
                {
                	type = "row", 
                	label = "تقع في منطقة تضاريس"	, 
                	value = {"منطقة تضاريس"},
                	wikidata = { property="P706"}
                },
            }
        },
        {
            type = "table",
            title = "الجغرافيا",
            rows = {
                building.coordinates(),
                {
                	type = "row", 
                	label = " [[قمة جبل]]", 
                	value = {"قمة جبل", 'peak'},
                	wikidata = {property = "P610"},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                    type = "row",
                    label = "[[ارتفاع (مصطلح)|الارتفاع]]",
                    value = {"ارتفاع",'elevation'},
                    wikidata = {
                    	property = "P2044", 
                    	formatting = "unitlinked",
                    	listrank ='bestrank'
                    	},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                    type = "row",
                    label = "النتوء",
                    plurallabel = "النتوءات",
                    value = {"نتوء متر", "نتوء قدم", "نتوء"},
                    wikidata = {
                    	property = "P2660", 
                    	formatting = "unitlinked"
                    	},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                    type = "row",
                    label = "[[عزلة طوبوغرافية]]",
                    value = {"عزلة",'isolation'},
                    wikidata = {
                    	property = "P2659", 
                    	formatting = "unitlinked"
                    	},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                	type = "row", 
                	label = "القمة الأم", 
                	value = {"القمة الأم", 'parent_peak'},
                	wikidata={property = "P3137"},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                    type = "row",
                    label = "الطول",
                    value = {"طول",'length'},
                    wikidata = {
                    	property = "P2043", 
                    	formatting = "unitlinked"
                    	},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                    type = "row",
                    label = "العرض",
                    value = {"عرض",'width'},
                    wikidata = {
                    	property = "P2049", 
                    	formatting = "unitlinked"
                    	},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                    type = "row",
                    label = "القطر",
                    value = "قطر",
                    wikidata = {
                    	property = "P2386", 
                    	formatting = "unitlinked"
                    	},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                    type = "row",
                    label = "المساحة",
                    value = {"مساحة",'area'},
                    wikidata = {
                    	property = "P2046", 
                    	formatting = "unitlinked"
                    	},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                    type = "row",
                    label = "الحجم",
                    value = {"حجم",'volume'},
                    wikidata = {
                    	property = "P2234", 
                    	formatting = "unitlinked"
                    	},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                	type = "row", 
                	label = "الانحدار",
                	value =  {"انحدار","slope"},
                	wikidata = { property="P4184"},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
            }
        },
        {
            type = "table",
            title = "علم الأرض",
            rows = {
                {type = "row", 
                	label = "ال[[قارة]]", 
                	plurallabel = "القارات", 
                	value = {"قارة", "continent"},
                	wikidata={property = "P30"},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                	type = "row", 
                	label = "وحدة جيومورفولوجية", 
                	value = "وحدة جيومورفولوجية", 
                	wikidata={property = "P4688"},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                building.mountainrange(),
                {
                    type = "row",
                    label = "[[قائمة أنواع الجبال|النوع]]",
                    value = {"نوع", "النوع"},
                    wikidata = {
                    	property = "P31", 
                    	excludevalues = {"Q8502", "Q1595289", "Q34987520"}
                    },
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                	type = "row", 
                	label = "تقدير العمر", 
                	value = {"تقدير العمر",'age estimated'}, 
                	wikidata ={property = "P7584", formatting="unitlink"},
                    metadata = {
                        description = "تقدير للعمر الجيولوجي وفق طريقة قياس",
                        option = "", 
                        type = "", 
                    }
                },
                {
                	type = "row", 
                	label = "يضم", 
                	value = "يضم", 
                	wikidata = {
                		property = "P527"
                	},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                	type = "row", 
                	label = "[[صخر|الصخور]]", 
                	value = {"صخور", "geology"},
                	wikidata = {property = "P186"},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                	type = "row", 
                	label = "[[مقياس زمني جيولوجي|عمر الحجر]]", 
                	value = {"عمر", "العمر",'age'}, 
                	wikidata ={property = "P2348"},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                    type = "row",
                    label = "آخر&nbsp;[[أنواع الثورات البركانية|ثورة بركانية]]",
                    value = {"آخر ثوران","last_eruption"},
                    wikidata = {
                        property = "P793",
                        whitelist0 = "Q29575458",
                        showDate = 'true'
                    },
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                	type = "row", 
                	label = "[[مرصد بركان|المرصد]]", 
                	value = "المرصد", 
                	wikidata={property = "P3815"},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
            }
        },
        {
            type = "table",
            title = "التاريخ والثقافة",
            rows = {
                {
                	type = "row", 
                	label = "الاكتشاف", 
                	value = "اكتشاف", 
                	wikidata={property = "P575"},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                    type = "row",
                    label = "الاسم المحلي",
                    value = "اسم محلي",
                    wikidata = {
                    	property = "P1705",
                    	conjunction = "<br />",
                    	listrank='bestrank' ,
                    	formatting = '$text {{Language icon|NoCat=y|$language}}'
                    },
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                	type = "row", 
                	label = "المكتشف", 
                	value = {"مكتشف","discoverer"},  
                	wikidata = {
                		property = "P61", formatting="table", 
                		tablesort=1 , listrank="bestrank",
                		qualifier1 = "P585 or P575" ,
                		rowsubformat1="<small>($1)</small>" ,
                		rowformat="$0 $1"
                	},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                    type = "row",
                    label = "سمي نسبة",
                    value = {"سمي نسبة",'etymology'},
                    wikidata = {
                    	property = "P138"
                    },
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                    type = "row",
                    label = "سماه",
                    value = "سماه",
                    wikidata = {
                    	property = "P3938"
                    },
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                    type = "row",
                    label = "لقب",
                    plurallabel = "ألقاب",
                    value = {"لقب",'nickname'},
                    wikidata = {property = "P1449"},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                	type = "row", 
                	label = "يقدسه", 
                	value = "يقدسه", 
                	wikidata={property = "P1049"},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                    type = "row",
                    label = "[[أول تسلق]]",
                    value = {"أول تسلق", "الوصول الأول",'first_ascent'},
                    wikidata = {formatting = "table",
                    conjunction = "<br />", rowformat = "$1$2", 
                    	qualifier1 = "P710", 
                        qualifier2 =  "P585", colformat2 = "Y", rowsubformat2 =" <small>($2)</small>",
                    	property = "P793", 
                    	whitelist0 = "Q1194369"
                    },
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                    type = "row",
                    label = "[[مسار التسلق|الطريق]]",
                    value = {"المسار الأسهل",'easiest_route'},
                    wikidata = {formatting = "table", conjunction = "<br />", rowformat = "$1",
                        property = "P2795",
                        qualifier2 = "P518",
                        whitelist2 = "Q34976110",
                        qualifier1 = "P1427"
                    },
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                    type = "row",
                    label = "الخطر",
                    plurallabel = "الأخطار",
                    value = "خطر",
                    wikidata = {property = "P3335", listmax = "3"},
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                    type = "row",
                    label = "رقم قياسي للتسلق",
                    value = "رقم قياسي",
                    wikidata = {formatting = "table", conjunction = "<br />", 
                        rowformat = "* $1$2$3$4",rowsubformat2 ="<br /><small>المدة : $2</small>" , 
                        colformat2 = "unitlinked",
                        rowsubformat3 ="<br /><small>التاريخ : $3</small>",
                        rowsubformat4 ="<br /><small>المنطلق : $4</small>",
                        qualifier1 = "P3279", qualifier2 = "P2047", qualifier3 =  "P585",
                        qualifier4 =  "P1427",
                        property = "P793",
                        whitelist0 = "Q38072305"
                    },
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                {
                    type = "row",
                    label = "[[رؤية شاملة|يطل على]]",
                    value = "يطل على",
                    wikidata = {
                    	property = "P3173", 
                    	--showqualifiers = "P654", 
                    	list = "4"
                    },
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                },
                building.visitors(),
                {
                    type = "row",
                    label = "تصنيف تراثي",
                    value = "تصنيف تراثي",
                    wikidata = {
                    	property = "P1435", 
                    	showDate = "true", 
                    	list = "4"
                    },
                    metadata = {
                        description = "",
                        option = "", 
                        type = "", 
                    }
                }
            }
        },
        general.geoloc(
            {
                marker = displayformat[1],
                default_zoom = displayformat[3],
                markercolor = displayformat[2],
                maptype = "relief"
            }
        )
    }
}