Авикипедиа abwiki https://ab.wikipedia.org/wiki/%D0%98%D1%85%D0%B0%D0%B4%D0%BE%D1%83_%D0%B0%D0%B4%D0%B0%D2%9F%D1%8C%D0%B0 MediaWiki 1.39.0-wmf.25 first-letter Амедиа Цастәи Ахцәажәара Алахәыла Алахәыла ахцәажәара Авикипедиа Авикипедиа ахцәажәара Афаил Афаил ахцәажәара Амедиавики Амедиавики ахцәажәара Ашаблон Ашаблон ахцәажәара Ацхыраара Ацхыраара ахцәажәара Акатегориа Акатегориа ахцәажәара TimedText TimedText talk Амодуль Амодуль ахцәажәара Гаджет Обсуждение гаджета Определение гаджета Обсуждение определения гаджета Авикипедиа:Афорум/Атехникатә цхыраара 4 29729 118360 117000 2022-08-20T06:38:04Z Fraxinus.cs 8381 /* Infobox (акарточка) */ новая тема wikitext text/x-wiki {{Авикипедиа:Афорум/Атехникатә цхыраара/Ахы}} == [[Аҳәынҭқаррақәа рсиа]] == # [[Аҳәынҭқарра]] истатиа аԥҵара (to create this page) # Зегь [[аҳәынҭқарра]]қәа рстатиақәа аԥҵара (to create all the country pages) # Астатиа аус адулара (to rework the page) ::* [[Аҳәынҭқарра]]қәа рхьӡқәа рыбзианы [[аиҭага]] (to correctly translate the names of the countries) ::* Зегь [[Аҳәынҭқарра]]қәа рдыргақәа [[Ашаблон:Абираҟдырга|рбираҟқәа ршаблонқәа]] ацҵара (to create all the flag icons for all the countries) {{Ok}} ::* Аформа аанахәара (to improve the form/style) --[[Алахәыла:Fraxinus.cs|Fraxinus.cs]] ([[Алахәыла ахцәажәара:Fraxinus.cs|обсуждение]]) 13:27, 19 ԥхынгәымза 2021 (UTC) [[Акатегориа:Авикипедиа]] == Standardization of Abkhazian labels == * To find russian labels, and to rename/rework them later: ::# "О проекте" ::# "Редактирование" {{Ok}} ::# "Править код" {{Ok}} ::# "Тема/заголовок" ::# "Предпросмотр темы/заголовка" {{Ok}} ::# "новая тема" ::# "Следить за странице" ::# "Навсегда" ::# "1 неделя" {{Ok}} ::# 1 месяц {{Ok}} ::# 3 месяца {{Ok}} ::# 6 месяцев {{Ok}} ::# Записать страницу {{Ok}} ::# Предварительный просмотр {{Ok}} ::# Бнесённые изменения ::# Отменить {{Ok}} ::# Отказ от ответственности ::# Мобильная версия {{Ok}} ::# Разработчики ::# Статистика {{Ok}} ::# Заявление о куки {{Ok}} --[[Алахәыла:Fraxinus.cs|Fraxinus.cs]] ([[Алахәыла ахцәажәара:Fraxinus.cs|обсуждение]]) 13:27, 19 ԥхынгәымза 2021 (UTC) == Hidden categories comming from the templates == * [[:Акатегориа:Страницы с картами]] - we need to track down where this category comes from, it is automatically created in all the pages with the map. But this category is mysteriously absent in the related templates. --[[Алахәыла:Fraxinus.cs|Fraxinus.cs]] ([[Алахәыла ахцәажәара:Fraxinus.cs|обсуждение]]) 13:27, 19 ԥхынгәымза 2021 (UTC) :{{Ok}} Oready done!--[[Алахәыла:Surprizi|Surprizi]] ([[Алахәыла ахцәажәара:Surprizi|обсуждение]]) 19:23, 24 ԥхынгәымза 2021 (UTC) == Interwiki for Арҽеира ҿыцқәа == * [[Цастәи:АрҽеираҾыцқәа]] has no interwiki displayed, but it can be accessed from some other wikipedias without a problem. Unfortunately I have no admin rights so I can't look into this problem myself. It seems interwiki must be done manually somewhere this time. --[[Алахәыла:Fraxinus.cs|Fraxinus.cs]] ([[Алахәыла ахцәажәара:Fraxinus.cs|обсуждение]]) 09:09, 30 ԥхынҷкәынмза 2021 (UTC) == Sandbox == [[Алахәыла:Amire80|Amir E. Aharoni]] Hi! In most of Wikipedias on the top right side screen have "Sandbox" ({{lang-ab|аиқәаҵәа}}). Can you help us, because we also need this button.--[[Алахәыла:Surprizi|Surprizi]] ([[Алахәыла ахцәажәара:Surprizi|ахцәажәара]]) 06:17, 6 жәабранмза 2022 (UTC) :Can you ask for it in Phabricator? :(И со мной можно по-русски. Как вам легче.) --[[Алахәыла:Amire80|Amir E. Aharoni]] ([[Алахәыла ахцәажәара:Amire80|ахцәажәара]]) 09:15, 6 жәабранмза 2022 (UTC) == Infobox (акарточка) == Updating the existing modules and creating new ones to improve the work on such templates like infobox or акарточка. Renaming: Creations: * [[Амодуль:PropertyLink‎]] – created {{Ok}}; tested (no) * [[Ашаблон:Ахьӡ аихшарада]] – created {{Ok}}; tested (no) * [[Ашаблон:ВД акарточка‎]] – created {{Ok}}; tested (no) * [[Ашаблон:Taxobox/аԥштәы]] – created {{Ok}}; tested (no) * [[Ашаблон:ВД афото‎]] – created {{Ok}}; tested (no) * [[Ашаблон:Taxobox‎]] - created [[Афаил:Under construction icon-orange.svg|22px]] ; tested (no) * [[Ашаблон:ВД аилыркаа]] – created (no); tested (no) Updates: * [[Амодуль:Wikidata]] – updated (no); tested (no) [[Алахәыла:Fraxinus.cs|Fraxinus.cs]] ([[Алахәыла ахцәажәара:Fraxinus.cs|ахцәажәара]]) 06:38, 20 нанҳәамза 2022 (UTC) 8t8ulk04j69wpdyib3um9u84cmiiaqz 118369 118360 2022-08-20T08:35:25Z Fraxinus.cs 8381 /* Infobox (акарточка) */ wikitext text/x-wiki {{Авикипедиа:Афорум/Атехникатә цхыраара/Ахы}} == [[Аҳәынҭқаррақәа рсиа]] == # [[Аҳәынҭқарра]] истатиа аԥҵара (to create this page) # Зегь [[аҳәынҭқарра]]қәа рстатиақәа аԥҵара (to create all the country pages) # Астатиа аус адулара (to rework the page) ::* [[Аҳәынҭқарра]]қәа рхьӡқәа рыбзианы [[аиҭага]] (to correctly translate the names of the countries) ::* Зегь [[Аҳәынҭқарра]]қәа рдыргақәа [[Ашаблон:Абираҟдырга|рбираҟқәа ршаблонқәа]] ацҵара (to create all the flag icons for all the countries) {{Ok}} ::* Аформа аанахәара (to improve the form/style) --[[Алахәыла:Fraxinus.cs|Fraxinus.cs]] ([[Алахәыла ахцәажәара:Fraxinus.cs|обсуждение]]) 13:27, 19 ԥхынгәымза 2021 (UTC) [[Акатегориа:Авикипедиа]] == Standardization of Abkhazian labels == * To find russian labels, and to rename/rework them later: ::# "О проекте" ::# "Редактирование" {{Ok}} ::# "Править код" {{Ok}} ::# "Тема/заголовок" ::# "Предпросмотр темы/заголовка" {{Ok}} ::# "новая тема" ::# "Следить за странице" ::# "Навсегда" ::# "1 неделя" {{Ok}} ::# 1 месяц {{Ok}} ::# 3 месяца {{Ok}} ::# 6 месяцев {{Ok}} ::# Записать страницу {{Ok}} ::# Предварительный просмотр {{Ok}} ::# Бнесённые изменения ::# Отменить {{Ok}} ::# Отказ от ответственности ::# Мобильная версия {{Ok}} ::# Разработчики ::# Статистика {{Ok}} ::# Заявление о куки {{Ok}} --[[Алахәыла:Fraxinus.cs|Fraxinus.cs]] ([[Алахәыла ахцәажәара:Fraxinus.cs|обсуждение]]) 13:27, 19 ԥхынгәымза 2021 (UTC) == Hidden categories comming from the templates == * [[:Акатегориа:Страницы с картами]] - we need to track down where this category comes from, it is automatically created in all the pages with the map. But this category is mysteriously absent in the related templates. --[[Алахәыла:Fraxinus.cs|Fraxinus.cs]] ([[Алахәыла ахцәажәара:Fraxinus.cs|обсуждение]]) 13:27, 19 ԥхынгәымза 2021 (UTC) :{{Ok}} Oready done!--[[Алахәыла:Surprizi|Surprizi]] ([[Алахәыла ахцәажәара:Surprizi|обсуждение]]) 19:23, 24 ԥхынгәымза 2021 (UTC) == Interwiki for Арҽеира ҿыцқәа == * [[Цастәи:АрҽеираҾыцқәа]] has no interwiki displayed, but it can be accessed from some other wikipedias without a problem. Unfortunately I have no admin rights so I can't look into this problem myself. It seems interwiki must be done manually somewhere this time. --[[Алахәыла:Fraxinus.cs|Fraxinus.cs]] ([[Алахәыла ахцәажәара:Fraxinus.cs|обсуждение]]) 09:09, 30 ԥхынҷкәынмза 2021 (UTC) == Sandbox == [[Алахәыла:Amire80|Amir E. Aharoni]] Hi! In most of Wikipedias on the top right side screen have "Sandbox" ({{lang-ab|аиқәаҵәа}}). Can you help us, because we also need this button.--[[Алахәыла:Surprizi|Surprizi]] ([[Алахәыла ахцәажәара:Surprizi|ахцәажәара]]) 06:17, 6 жәабранмза 2022 (UTC) :Can you ask for it in Phabricator? :(И со мной можно по-русски. Как вам легче.) --[[Алахәыла:Amire80|Amir E. Aharoni]] ([[Алахәыла ахцәажәара:Amire80|ахцәажәара]]) 09:15, 6 жәабранмза 2022 (UTC) == Infobox (акарточка) == Updating the existing modules and creating new ones to improve the work on such templates like infobox or акарточка. Renaming: Creations: * [[Амодуль:PropertyLink‎]] – created {{Ok}}; tested (no) * [[Ашаблон:Ахьӡ аихшарада]] – created {{Ok}}; tested (no) * [[Ашаблон:ВД акарточка‎]] – created {{Ok}}; tested (no) * [[Ашаблон:Taxobox/аԥштәы]] – created {{Ok}}; tested (no) * [[Ашаблон:ВД афото‎]] – created {{Ok}}; tested (no) * [[Ашаблон:Taxobox‎]] - created [[Афаил:Under construction icon-orange.svg|22px]] ; tested (no) * [[Ашаблон:ВД аилыркаа]] – created (no); tested (no) * [[Амодуль:Wikidata/i18n]] – created {{Ok}}; translated [[Афаил:Under construction icon-orange.svg|22px]]; tested (no); Updates: * [[Амодуль:Wikidata]] – updated (no); tested (no) [[Алахәыла:Fraxinus.cs|Fraxinus.cs]] ([[Алахәыла ахцәажәара:Fraxinus.cs|ахцәажәара]]) 06:38, 20 нанҳәамза 2022 (UTC) re7px6kkj57nrt5xongi4wflq0cw0ck Ашаблон:Ахьӡ аихшарада 10 30708 118351 2022-08-19T15:20:27Z Fraxinus.cs 8381 Новая страница: «<includeonly>{{#invoke:String|replace|source={{{1|{{PAGENAME}}}}}|pattern=%s+%b()$|replace=|count=1|plain=false}}</includeonly><noinclude> {{Doc}} [[Акатегориа:Ашаблонқәа рформатркра]] </noinclude>» wikitext text/x-wiki <includeonly>{{#invoke:String|replace|source={{{1|{{PAGENAME}}}}}|pattern=%s+%b()$|replace=|count=1|plain=false}}</includeonly><noinclude> {{Doc}} [[Акатегориа:Ашаблонқәа рформатркра]] </noinclude> rcpgmie91kjzkv74bofy5ljdj9bk70t Акатегориа:Ашаблонқәа рформатркра 14 30709 118352 2022-08-19T15:21:07Z Fraxinus.cs 8381 Новая страница: «[[Акатегориа:Авикипедиа:Ашаблонқәа]]» wikitext text/x-wiki [[Акатегориа:Авикипедиа:Ашаблонқәа]] qgh1v2ky3l9qu47aqnbcgoklqvu9c9q Ашаблон:ВД акарточка 10 30710 118353 2022-08-19T15:32:17Z Fraxinus.cs 8381 Новая страница: «<includeonly>{{#if: {{#invoke:Wikidata|getCurrentId}} <!-- pouze je-li připojena WD položka --> | {{#if: {{#invoke:Wikidata|getLabel|lang=ab}} | {{#if: {{{1|}}} | {{{1}}}<!-- existují oba, můžeme porovnávat -->{{#if:{{{nocat|}}}||{{#switch: {{{1}}} | {{lcfirst:{{#invoke:Wikidata|getLabel|lang=ab}}}} | {{ucfirst:{{#invoke:Wikidata|getLabel|lang=ab}}}} | ''{{lcfirst:{{#invoke:Wikidata|getLabel|lang=ab}}}}'' | ''{{ucfirst:{{#invoke:Wikidata...» wikitext text/x-wiki <includeonly>{{#if: {{#invoke:Wikidata|getCurrentId}} <!-- pouze je-li připojena WD položka --> | {{#if: {{#invoke:Wikidata|getLabel|lang=ab}} | {{#if: {{{1|}}} | {{{1}}}<!-- existují oba, můžeme porovnávat -->{{#if:{{{nocat|}}}||{{#switch: {{{1}}} | {{lcfirst:{{#invoke:Wikidata|getLabel|lang=ab}}}} | {{ucfirst:{{#invoke:Wikidata|getLabel|lang=ab}}}} | ''{{lcfirst:{{#invoke:Wikidata|getLabel|lang=ab}}}}'' | ''{{ucfirst:{{#invoke:Wikidata|getLabel|lang=ab}}}}'' | '''{{lcfirst:{{#invoke:Wikidata|getLabel|lang=ab}}}}''' | '''{{ucfirst:{{#invoke:Wikidata|getLabel|lang=ab}}}}''' | '''''{{lcfirst:{{#invoke:Wikidata|getLabel|lang=ab}}}}''''' | '''''{{ucfirst:{{#invoke:Wikidata|getLabel|lang=ab}}}}''''' = <!-- v pořádku --> | #default = {{Акатегориа|Авикипедиа:Авикидыррақәа даҽа акарточка ирымоуп||{{PAGENAME}}}}<!-- parametr a štítek se liší --> }}}} | {{#invoke:Wikidata|getLabel|lang=ab}}<!-- lokální hodnota není --> }}{{#if:{{{nocat|}}}||{{#ifeq:{{Ахьӡ аихшарада|{{#invoke:Wikidata|getLabel|lang=ab}}}}|{{#invoke:Wikidata|getLabel|lang=ab}} | <!-- bez rozlišovače --> | {{#ifeq:{{{1|}}}|{{#invoke:Wikidata|getLabel|lang=ab}} | <!-- podle lokálního vyplnění v pořádku --> | {{Акатегориа|Авикипедиа:Авикидыррақәа хыцқәа ркарточка ирымоуп||{{PAGENAME}}}} }} }}}} | {{#if: {{{1|}}} | {{{1}}} | {{FULLPAGENAME}}<!-- fallback --> }}<!-- na Wikidatech není štítek -->{{#if:{{{nocat|}}}||{{Акатегориа|Авикипедиа:Авикидыррақәа ркарточкада||{{PAGENAME}}}}}} }} | {{#if: {{{1|}}} | {{{1}}} | {{FULLPAGENAME}} }} }}</includeonly><noinclude> {{Doc}} </noinclude> nymrt23cr6620azu7ixcrktbzksbgsa Амодуль:PropertyLink 828 30711 118354 2022-08-19T15:44:26Z Fraxinus.cs 8381 Новая страница: «function getProperty( propertyName ) local entity = mw.wikibase.getEntityObject() if not entity or not entity.claims then return end--the entity doesn't exist or has no claims local property = entity.claims[propertyName] if not property then return end--no such property for this item property = property[1] local propValue = property.mainsnak and property.mainsnak.datavalue if not propValue then return end --property doesn't exist if propValue['type']...» Scribunto text/plain function getProperty( propertyName ) local entity = mw.wikibase.getEntityObject() if not entity or not entity.claims then return end--the entity doesn't exist or has no claims local property = entity.claims[propertyName] if not property then return end--no such property for this item property = property[1] local propValue = property.mainsnak and property.mainsnak.datavalue if not propValue then return end --property doesn't exist if propValue['type'] == 'wikibase-entityid' then local linkTarget = mw.wikibase.sitelink( "Q" .. propValue.value['numeric-id'] ) local linkTitle = mw.wikibase.label( "Q" ..propValue.value['numeric-id'] ) return linkTarget and linkTitle and mw.ustring.format( "[[%s|%s]]", linkTarget, linkTitle ) or linkTitle elseif propValue and propValue['type'] == 'string' then return propValue.value end end function property( frame ) return getProperty(string.upper(frame.args[1])) end function getLabel( propertyName ) local entity = mw.wikibase.getEntityObject() if not entity or not entity.claims then return end--the entity doesn't exist or has no claims local property = entity.claims[propertyName] if not property then return end--no such property for this item property = property[1] local propValue = property.mainsnak.datavalue if not propValue then return '' end --property doesn't exist if propValue['type'] == 'wikibase-entityid' then return mw.wikibase.label( "Q" ..propValue.value['numeric-id'] ) elseif propValue['type'] == 'string' then return propValue.value end end -- Return the label for property, or the label of the linked entiy of that property function label( frame ) return getLabel( string.upper(frame.args[1] )) end function getImageLink( propName, width ) local entity = mw.wikibase.getEntityObject() if not entity or not entity.claims then return end --the entity doesn't exist or has no claims local property = entity.claims[propName or "P18"] if property then local width = width or "220" return mw.ustring.format( '[[File:%s|%spx]]', property[1].mainsnak.datavalue.value, width ) end end --use this function to get associated image to be used in the article function imageLink( frame ) return getImageLink( string.lower(frame.args[1]), frame.args.width) end return { imageLink = imageLink, Image = imageLink, File = imageLink, label = label, Label = label, property = property, Property = property, getProperty = getProperty, getImageLink = getImageLink, getLabel = getLabel } 87e6f2nj7ql2i8et8mvchf4x8a0rqth Ашаблон:Taxobox/аԥштәы 10 30712 118355 2022-08-19T17:02:48Z Fraxinus.cs 8381 Новая страница: «<includeonly><!--{{#if:{{{аԥштәы|}}}|{{{аԥштәы}}}|-->{{ #if:{{{авирусқәа|}}}|violet|{{ #switch:{{lc:{{{раҳра|}}}}} |[[аԥстәқәа]] (animalia) |'''аԥстәқәа''' (metazoa) |[[аԥстәқәа]] (metazoa)=pink |[[rostliny]] (plantae) |'''аҵиаақәа''' (''plantae'') |[[аҵиаақәа]] (''plantae'')=lightgreen |'''акәыкәбаақәа''' (fungi) |[[акәыкәбаақәа]] (fungi)=lig...» wikitext text/x-wiki <includeonly><!--{{#if:{{{аԥштәы|}}}|{{{аԥштәы}}}|-->{{ #if:{{{авирусқәа|}}}|violet|{{ #switch:{{lc:{{{раҳра|}}}}} |[[аԥстәқәа]] (animalia) |'''аԥстәқәа''' (metazoa) |[[аԥстәқәа]] (metazoa)=pink |[[rostliny]] (plantae) |'''аҵиаақәа''' (''plantae'') |[[аҵиаақәа]] (''plantae'')=lightgreen |'''акәыкәбаақәа''' (fungi) |[[акәыкәбаақәа]] (fungi)=lightblue |#default={{ #switch:{{lc:{{{адомен|}}}}} |[[аеукариотақәа]] |'''аеукариотақәа''' |[[аеукариотақәа]] (eukaryota)=khaki |[[археи]] |'''археи''' (archaea) |[[археи]] (archaea) |[[археи]]=BlanchedAlmond |[[абактериақәа]] |'''абактериақәа''' (bacteria) |[[абактериақәа]] (bacteria)=lightgray |#default={{{еилкаам|lightgray}}} }} }} }}<!-- }}--></includeonly><noinclude> {{doc}} [[Акатегориа:Ашаблонқәа:Акарточкақәа|T]] </noinclude> 8elcvof19ecchw5ginilkpx03box5vh Ашаблон:ВД афото 10 30713 118356 2022-08-19T19:36:47Z Fraxinus.cs 8381 Новая страница: «<includeonly>{{#switch: {{{1}}} | vypnuto = <!-- potlačení --> | <!-- parametr zadaný, ale prázdný --> | {{{((}}1{{))}}} <!-- "{{{1}}}", tj. šablona pouze z WD --> | {{{{{{ахышәара}}}}}} = <!-- "{{{афото}}}", tj. parametr nezadaný -->{{#if: {{#if: {{{1}}} | {{#invoke:Wikidata|getRawValue|property={{#if:{{{аҟазшьаҷыда|}}}|{{{аҟазшьаҷыда}}}|P18}}}} | <!-- pokud je parametr zadaný, ale prázdný, přeskoč WD rovnou k...» wikitext text/x-wiki <includeonly>{{#switch: {{{1}}} | vypnuto = <!-- potlačení --> | <!-- parametr zadaný, ale prázdný --> | {{{((}}1{{))}}} <!-- "{{{1}}}", tj. šablona pouze z WD --> | {{{{{{ахышәара}}}}}} = <!-- "{{{афото}}}", tj. parametr nezadaný -->{{#if: {{#if: {{{1}}} | {{#invoke:Wikidata|getRawValue|property={{#if:{{{аҟазшьаҷыда|}}}|{{{аҟазшьаҷыда}}}|P18}}}} | <!-- pokud je parametr zadaný, ale prázdný, přeskoč WD rovnou k placeholderu --> }} | [[Афаил:{{#invoke:Wikidata|getRawValue|property={{#if:{{{аҟазшьаҷыда|}}}|{{{аҟазшьаҷыда}}}|P18}}}}|{{{афото ашәагаа}}}|{{If empty|{{ВД аилыркаа|{{#invoke:Wikidata|getRawValue|property={{#if:{{{аҟазшьаҷыда|}}}|{{{аҟазшьаҷыда}}}|P18}}}}|raw=ano|аҟазшьаҷыда={{{аҟазшьаҷыда|}}}|ахьӡ={{{ахьӡ|}}}}}|альт={{{алагамҭатә еилыркаа|}}}}}]]{{#if: {{{аилыркаа|}}} | {{Акатегориа|Арҽеиратә усурақәа:Акарточка аҿы аилыркаақәа рыда рдаҟьақәа}} }} | {{#if: {{{placeholder|}}} | [[Афаил:{{{placeholder}}}|256px|link=//commons.wikimedia.org/wiki/Special:UploadWizard?uselang=cs&categories={{urlencode:Media uploaded from placeholders on Abkhaz Wikipedia{{#if:{{{акатегориа аҭагалара|}}}|{{!}}{{{акатегориа аҭагалара}}}}}}}&description={{urlencode:{{{ахьӡ|}}}}}|альт=Ара зхы иақәиҭу асахьа игуп]]{{Акатегориа|{{#if:{{{арҽеиратә|}}}|{{{арҽеиратә}}}|Арҽеиратә усурақәа:Асахьақәа рыда рдаҟьақәа}}}}{{#if: {{{аилыркаа|}}} | {{Акатегориа|Арҽеиратә усурақәа:Акарточка аҿы аилыркаақәа рыда рдаҟьақәа}} }} | <!-- jsme bez obrázku --> }} }} | #default = [[Афаил:{{{1}}}|{{{афото ашәагаа}}}{{#if:{{{volby|}}}|{{!}}{{{volby}}}}}{{#if: {{{альт|}}} | {{!}}альт={{{альт}}} }}|{{If empty|{{{аилыркаа|}}}|{{{алагамҭатә еилыркаа|}}}}}]]<!-- parametr zadaný -->{{#if: {{#invoke:Wikidata|getRawValue|property={{#if:{{{аҟазшьаҷыда|}}}|{{{аҟазшьаҷыда}}}|P18}}}} | | {{#ifeq: {{ucfirst:{{{1}}}}} | {{#invoke:Wikidata|getRawValue|property=P154}} | {{Акатегориа|Арҽеиратә усурақәа:Алого еиԥш асахьа}} | {{#ifeq: {{ucfirst:{{{1}}}}} | {{#invoke:Wikidata|getRawValue|property=P94}} | {{Акатегориа|Арҽеиратә усурақәа:Агерб еиԥш асахьа}} | {{#ifeq: {{ucfirst:{{{1}}}}} | {{#invoke:Wikidata|getRawValue|property=P1801}} | {{Акатегориа|Арҽеиратә усурақәа:Амемориалтә ӷәы еиԥш асахьа}} | {{#ifeq: {{ucfirst:{{{1}}}}} | {{#invoke:Wikidata|getRawValue|property=P6802}} | {{Акатегориа|Арҽеиратә усурақәа:Имариам еиԥш асахьа}} | {{#ifeq:{{ucfirst:{{{1}}}}} | {{#invoke:Wikidata|getRawValue|property=P1442}} | {{Акатегориа|Арҽеиратә усурақәа:Адамра исахьа}} | {{Акатегориа|Арҽеиратә усурақәа:{{ucfirst:{{{ахышәара}}}}} Авикидыррақәа аҿы иҟаӡам||{{PAGENAME}}}} }}}}}}}}}}}} }}</includeonly><noinclude> {{Doc}} [[Акатегориа:Wikidata ашаблонқәа]] </noinclude> l0k31kr972lmg2cs43z9ym4416w8abt Ашаблон:Taxobox 10 30714 118357 2022-08-19T19:56:00Z Fraxinus.cs 8381 Новая страница: «{{Акарточка |амаҭәар_астил = width:{{#if:{{{аҭбаара|}}}|{{{аҭбаара}}}|277.2px}}; |хыхьтәи = <sup style="float:right">[[Афаил:Information-silk.svg|18px|link=Авикипедиа:ишԥа taxobox аԥхьара|Ишԥа Taxobox аԥхьара]]</sup>{{ucfirst:{{ВД акарточка|{{{Ахьӡ|}}}}}}}{{#if: {{{анызарҭа|}}}|<br /><span style="font-size:70%;">Aстратиграфиатә нызарҭ...» wikitext text/x-wiki {{Акарточка |амаҭәар_астил = width:{{#if:{{{аҭбаара|}}}|{{{аҭбаара}}}|277.2px}}; |хыхьтәи = <sup style="float:right">[[Афаил:Information-silk.svg|18px|link=Авикипедиа:ишԥа taxobox аԥхьара|Ишԥа Taxobox аԥхьара]]</sup>{{ucfirst:{{ВД акарточка|{{{Ахьӡ|}}}}}}}{{#if: {{{анызарҭа|}}}|<br /><span style="font-size:70%;">[[Aстратиграфиатә нызарҭа]]: {{{анызарҭа}}}</span>}}{{#if: {{{атаксон|}}}|<br /><span style="font-size:70%;">[[Атаксон]] аҭагылазаашьа: {{{атаксон}}}</span> {{{Акатегориа|{{Акатегориа|{{ #switch:{{lc:{{{раҳра|}}}}} |[[аԥстәқәа]] (animalia) |'''аԥстәқәа''' (metazoa) |[[аԥстәқәа]] (metazoa)= Иԥсабаратәым аԥстәқәа рытаксонқәа |Иԥсабаратәым атаксонқәа}}}}}}}}} | хыхьтәи астил = background-color:{{Taxobox/аԥштәы|аԥштәы={{{аԥштәы|}}}|авирусқәа={{{Балтимор авирусқәа реихшара|}}}|раҳра={{{раҳра|}}}|адомен={{{адомен|}}}}}; line-height: 25px; |афото астил = |афото акласс = |афото1 = {{ВД афото | 1 = {{{афото}}} | аҟазшьаҷыда = афото | афото ашәагаа = {{If empty|{{{афото ашәагаа|}}}|альт=270px}} | аилыркаа = {{{аилыркаа|}}} | алагамҭатә еилыркаа = асахьа аилыркаа игуп | альт = {{#if: {{{альт|}}} | {{{альт}}} | асахьа альтернативтә еилыркаа игуп}} | placeholder = No living being photo cs2.svg | акатегориа аҭагалара = Nature of Abkhazia | ахьӡ = {{ucfirst:{{ВД акарточка|{{{ахьӡ|}}}|nocat=true}}}} | арҽеиратә = Арҽеиратә усурақәа:Асахьақәа рда ртаксонқәа }} |аилыркаа = {{#if: {{{афото1|}}} | {{{аилыркаа|}}} | {{ВД аилыркаа|{{#invoke:Wikidata|getRawValue|property=P18}}|ахьӡ={{ucfirst:{{ВД акарточка|{{{ахьӡ|}}}|nocat=true}}}}}} }} |афото2 = {{#if: {{{афото2|}}} | [[Афаил:{{{афото2}}}|{{If empty|{{{афото ашәагаа2|}}}|альт=200px}}|альт={{#if: {{{альт2|}}} | {{{альт2}}} | асахьа альтернативтә еилыркаа игуп }}]] }} |аилыркаа2 = {{{аилыркаа2|}}} }} grarclhd08ns9dztic7bt62cqvyuiv4 Амодуль:Wikidata/lib 828 30716 118361 2022-08-20T07:38:54Z Fraxinus.cs 8381 Новая страница: «require "Modul:No globals" local p = { common = require "Modul:Functions", props = { begin = { 'P569', 'P580' }, ending = { 'P570', 'P582' }, lang = { 'P364', 'P407' }, point = { 'P571', 'P577', 'P585' }, }, datatypeToValueType = { ['commonsMedia'] = 'string', ['external-id'] = 'string', ['geo-shape'] = 'string', ['globe-coordinate'] = 'globecoordinate', ['math'] = 'string', ['monolingualtext'] = 'monolingualtext', ['musical-notati...» Scribunto text/plain require "Modul:No globals" local p = { common = require "Modul:Functions", props = { begin = { 'P569', 'P580' }, ending = { 'P570', 'P582' }, lang = { 'P364', 'P407' }, point = { 'P571', 'P577', 'P585' }, }, datatypeToValueType = { ['commonsMedia'] = 'string', ['external-id'] = 'string', ['geo-shape'] = 'string', ['globe-coordinate'] = 'globecoordinate', ['math'] = 'string', ['monolingualtext'] = 'monolingualtext', ['musical-notation'] = 'string', ['quantity'] = 'quantity', ['score'] = 'string', ['string'] = 'string', ['tabular-data'] = 'string', ['time'] = 'time', ['url'] = 'string', ['wikibase-item'] = 'wikibase-entityid', ['wikibase-property'] = 'wikibase-entityid', ['wikibase-lexeme'] = 'wikibase-entityid', ['wikibase-form'] = 'wikibase-entityid', ['wikibase-sense'] = 'wikibase-entityid', }, } local i18n = mw.loadData("Modul:Wikidata/i18n") function p.addWdClass(str) return '<span class="wd">' .. str .. '</span>' end function p.category(key, ...) local Category = require 'Modul:Kategorie' local title = mw.title.getCurrentTitle() if i18n.categories[key] ~= '-' then return Category.makeCategory(mw.ustring.format(i18n.categories[key], ...), '0,14', title.text) else return '' end end function p.getInterwikiPrefix(wiki) local prefixMap = { wiki = 'w:', wikibooks = 'b:', wikidata = 'd:', wikinews = 'n:', wikipedia = 'w:', wikiquote = 'q:', wikisource = 's:', wikiversity = 'v:', wikivoyage = 'voy:', wiktionary = 'wikt:', } if prefixMap[wiki] then return prefixMap[wiki] end local code, family = string.match(wiki, '^(.+)(wik.-)$') if prefixMap[code] and family == 'wiki' then return prefixMap[code] end if not code then code = wiki end local prefix = string.gsub(code, '_', '-') .. ':' return (prefixMap[family] or '') .. prefix end function p.augmentArgs(args, defaults, prefix) local out = {} prefix = prefix or '' setmetatable(out, { __index = function (t, key) if args[prefix .. key] ~= nil then return args[prefix .. key] end return defaults[key] end, }) return out end function p.formatDateRange(snaks, options) local Formatters = require 'Modul:Wikidata/Formatters' local Y = require('Modul:Time').PRECISION.YEAR local defaults = { precision = Y } local options = p.augmentArgs(options, defaults) local begin_raw, ending_raw if snaks.begin then begin_raw = Formatters.getRawValue(snaks.begin, options) end if snaks.ending then ending_raw = Formatters.getRawValue(snaks.ending, options) end if not begin_raw or begin_raw == 'novalue' then if not ending_raw or ending_raw == 'novalue' then return '' end return mw.ustring.format(options['end-format'] or i18n.date['end'], Formatters.formatRawValue(ending_raw, 'time', options)) end if not ending_raw or ending_raw == 'novalue' then return mw.ustring.format(options['begin-format'] or i18n.date['start'], Formatters.formatRawValue(begin_raw, 'time', options)) end local begin, ending local connector = ' – ' if begin_raw ~= 'somevalue' and ending_raw ~= 'somevalue' then local begin_precision = math.min(options.precision, begin_raw.precision) local ending_precision = math.min(options.precision, ending_raw.precision) local showera = { begin_raw.year <= 0 and ending_raw.year > 0, begin_raw.year <= 0 or ending_raw.year < 0, } while true do -- TODO: implement merging (1st - 2nd January 2020, 3rd January - 4th February 2020, etc.) defaults.precision = begin_precision begin = Formatters.formatRawValue(begin_raw, 'time', options) defaults.precision = ending_precision ending = Formatters.formatRawValue(ending_raw, 'time', options) if begin ~= ending then -- this must happen after equality test defaults.precision = begin_precision defaults.showera = showera[1] begin = Formatters.formatRawValue(begin_raw, 'time', options) defaults.precision = ending_precision defaults.showera = showera[2] ending = Formatters.formatRawValue(ending_raw, 'time', options) break end -- assumption: if the dates are same, they have the same precision if begin_precision == begin_raw.precision or ending_precision == ending_raw.precision then break end begin_precision = begin_precision + 1 ending_precision = ending_precision + 1 end if begin_precision == Y and ending_precision == Y and not showera[1] then connector = '–' end else begin = Formatters.formatRawValue(begin_raw, 'time', options) ending = Formatters.formatRawValue(ending_raw, 'time', options) end if begin == ending then return begin end return table.concat( { begin, ending }, connector ) end function p.formatError(key, ...) return mw.ustring.format(i18n.errors[key], ...) end function p.formatFromPattern(str, pattern) local escaped = mw.ustring.gsub(str, '%%', '%%%%') return mw.ustring.gsub(pattern, '$1', escaped) .. '' --Hack to get only the first result of the function end function p.formatTextInLanguage(text, language) return mw.text.tag('span', { lang = language }, text) end -- @deprecated function p.getEntityIdFromValue(value) local entityType = value['entity-type'] if entityType == 'item' then return 'Q' .. value['numeric-id'] elseif entityType == 'property' then return 'P' .. value['numeric-id'] else return error(p.formatError('unknown-entity-type', entityType)) end end function p.getItemIdFromURI(uri) return mw.ustring.match(uri, '(Q%d+)') end function p.getLabelInLanguage(entityId, langs) langs = p.textToTable(langs) local label, lang = mw.wikibase.getLabelWithLang(entityId) if label then for _, lg in ipairs(langs) do if lg == lang then return label, lang end end end return nil, nil end function p.getLinkWhenNonexistingLabel(entityId) local ImageFormatter = require 'Modul:ImageFormatter' return ImageFormatter.makeImage('Wikidata-edit.svg', { description = i18n['missing-label'], link = 'd:' .. entityId, size = '27x17px' }) .. '<code>[[d:' .. entityId .. '|' .. entityId .. ']]</code>' .. p.category('missing-label') end function p.IsOptionTrue(options, key) if options[key] then if tostring(options[key]) == 'true' or tostring(options[key]) == 'yes' or tostring(options[key]) == '1' then return true end end return false end function p.isPropertyId(value) return mw.ustring.match(value, '^[Pp][1-9]%d-$') and true end function p.IsSnakValue(snak) return snak.snaktype == 'value' end function p.raiseInvalidDatatype(method, allowed, provided) if type(allowed) ~= 'table' then allowed = { allowed } end return p.formatError('invalid-datatype2', method, mw.text.listToText(allowed, '“, „', '“ nebo „'), provided) end function p.simpleCompare(first, second) if first == second then return 0 end if first < second then return -1 else return 1 end end function p.textToTable(something, options) if type(something) ~= "table" then local options = options or {} local split_pattern = options.split_pattern or "%s*,%s*" something = mw.text.split(something, split_pattern) end return p.common.cleanArgs(something) end return p 5o1ckzh40dposy4rxi7maa6rtgjywli 118367 118361 2022-08-20T08:07:06Z Fraxinus.cs 8381 Scribunto text/plain require "Амодуль:No globals" local p = { common = require "Амодуль:Functions", props = { begin = { 'P569', 'P580' }, ending = { 'P570', 'P582' }, lang = { 'P364', 'P407' }, point = { 'P571', 'P577', 'P585' }, }, datatypeToValueType = { ['commonsMedia'] = 'string', ['external-id'] = 'string', ['geo-shape'] = 'string', ['globe-coordinate'] = 'globecoordinate', ['math'] = 'string', ['monolingualtext'] = 'monolingualtext', ['musical-notation'] = 'string', ['quantity'] = 'quantity', ['score'] = 'string', ['string'] = 'string', ['tabular-data'] = 'string', ['time'] = 'time', ['url'] = 'string', ['wikibase-item'] = 'wikibase-entityid', ['wikibase-property'] = 'wikibase-entityid', ['wikibase-lexeme'] = 'wikibase-entityid', ['wikibase-form'] = 'wikibase-entityid', ['wikibase-sense'] = 'wikibase-entityid', }, } local i18n = mw.loadData("Амодуль:Wikidata/i18n") function p.addWdClass(str) return '<span class="wd">' .. str .. '</span>' end function p.category(key, ...) local Category = require 'Амодуль:Category' local title = mw.title.getCurrentTitle() if i18n.categories[key] ~= '-' then return Category.makeCategory(mw.ustring.format(i18n.categories[key], ...), '0,14', title.text) else return '' end end function p.getInterwikiPrefix(wiki) local prefixMap = { wiki = 'w:', wikibooks = 'b:', wikidata = 'd:', wikinews = 'n:', wikipedia = 'w:', wikiquote = 'q:', wikisource = 's:', wikiversity = 'v:', wikivoyage = 'voy:', wiktionary = 'wikt:', } if prefixMap[wiki] then return prefixMap[wiki] end local code, family = string.match(wiki, '^(.+)(wik.-)$') if prefixMap[code] and family == 'wiki' then return prefixMap[code] end if not code then code = wiki end local prefix = string.gsub(code, '_', '-') .. ':' return (prefixMap[family] or '') .. prefix end function p.augmentArgs(args, defaults, prefix) local out = {} prefix = prefix or '' setmetatable(out, { __index = function (t, key) if args[prefix .. key] ~= nil then return args[prefix .. key] end return defaults[key] end, }) return out end function p.formatDateRange(snaks, options) local Formatters = require 'Амодуль:Wikidata/Formatters' local Y = require('Амодуль:Time').PRECISION.YEAR local defaults = { precision = Y } local options = p.augmentArgs(options, defaults) local begin_raw, ending_raw if snaks.begin then begin_raw = Formatters.getRawValue(snaks.begin, options) end if snaks.ending then ending_raw = Formatters.getRawValue(snaks.ending, options) end if not begin_raw or begin_raw == 'novalue' then if not ending_raw or ending_raw == 'novalue' then return '' end return mw.ustring.format(options['end-format'] or i18n.date['end'], Formatters.formatRawValue(ending_raw, 'time', options)) end if not ending_raw or ending_raw == 'novalue' then return mw.ustring.format(options['begin-format'] or i18n.date['start'], Formatters.formatRawValue(begin_raw, 'time', options)) end local begin, ending local connector = ' – ' if begin_raw ~= 'somevalue' and ending_raw ~= 'somevalue' then local begin_precision = math.min(options.precision, begin_raw.precision) local ending_precision = math.min(options.precision, ending_raw.precision) local showera = { begin_raw.year <= 0 and ending_raw.year > 0, begin_raw.year <= 0 or ending_raw.year < 0, } while true do -- TODO: implement merging (1st - 2nd January 2020, 3rd January - 4th February 2020, etc.) defaults.precision = begin_precision begin = Formatters.formatRawValue(begin_raw, 'time', options) defaults.precision = ending_precision ending = Formatters.formatRawValue(ending_raw, 'time', options) if begin ~= ending then -- this must happen after equality test defaults.precision = begin_precision defaults.showera = showera[1] begin = Formatters.formatRawValue(begin_raw, 'time', options) defaults.precision = ending_precision defaults.showera = showera[2] ending = Formatters.formatRawValue(ending_raw, 'time', options) break end -- assumption: if the dates are same, they have the same precision if begin_precision == begin_raw.precision or ending_precision == ending_raw.precision then break end begin_precision = begin_precision + 1 ending_precision = ending_precision + 1 end if begin_precision == Y and ending_precision == Y and not showera[1] then connector = '–' end else begin = Formatters.formatRawValue(begin_raw, 'time', options) ending = Formatters.formatRawValue(ending_raw, 'time', options) end if begin == ending then return begin end return table.concat( { begin, ending }, connector ) end function p.formatError(key, ...) return mw.ustring.format(i18n.errors[key], ...) end function p.formatFromPattern(str, pattern) local escaped = mw.ustring.gsub(str, '%%', '%%%%') return mw.ustring.gsub(pattern, '$1', escaped) .. '' --Hack to get only the first result of the function end function p.formatTextInLanguage(text, language) return mw.text.tag('span', { lang = language }, text) end -- @deprecated function p.getEntityIdFromValue(value) local entityType = value['entity-type'] if entityType == 'item' then return 'Q' .. value['numeric-id'] elseif entityType == 'property' then return 'P' .. value['numeric-id'] else return error(p.formatError('unknown-entity-type', entityType)) end end function p.getItemIdFromURI(uri) return mw.ustring.match(uri, '(Q%d+)') end function p.getLabelInLanguage(entityId, langs) langs = p.textToTable(langs) local label, lang = mw.wikibase.getLabelWithLang(entityId) if label then for _, lg in ipairs(langs) do if lg == lang then return label, lang end end end return nil, nil end function p.getLinkWhenNonexistingLabel(entityId) local ImageFormatter = require 'Амодуль:ImageFormatter' return ImageFormatter.makeImage('Wikidata-edit.svg', { description = i18n['missing-label'], link = 'd:' .. entityId, size = '27x17px' }) .. '<code>[[d:' .. entityId .. '|' .. entityId .. ']]</code>' .. p.category('missing-label') end function p.IsOptionTrue(options, key) if options[key] then if tostring(options[key]) == 'true' or tostring(options[key]) == 'yes' or tostring(options[key]) == '1' then return true end end return false end function p.isPropertyId(value) return mw.ustring.match(value, '^[Pp][1-9]%d-$') and true end function p.IsSnakValue(snak) return snak.snaktype == 'value' end function p.raiseInvalidDatatype(method, allowed, provided) if type(allowed) ~= 'table' then allowed = { allowed } end return p.formatError('invalid-datatype2', method, mw.text.listToText(allowed, '“, „', '“ nebo „'), provided) end function p.simpleCompare(first, second) if first == second then return 0 end if first < second then return -1 else return 1 end end function p.textToTable(something, options) if type(something) ~= "table" then local options = options or {} local split_pattern = options.split_pattern or "%s*,%s*" something = mw.text.split(something, split_pattern) end return p.common.cleanArgs(something) end return p qslnxqzf7jgpov60px41ujjv1ospzup Амодуль:Category 828 30717 118362 2022-08-20T07:49:08Z Fraxinus.cs 8381 Новая страница: «require "Амодуль:No globals" local p = {} local function checkNamespace(namespace) if not namespace or namespace == '' then namespace = 0 end if type(namespace) == 'string' then namespace = mw.text.split(namespace, ',') elseif type(namespace) ~= 'table' then namespace = { namespace } end local namespace_map = mw.site.namespaces local title = mw.title.getCurrentTitle() for _, namespace in ipairs(namespace) do if tonumber(namespace)...» Scribunto text/plain require "Амодуль:No globals" local p = {} local function checkNamespace(namespace) if not namespace or namespace == '' then namespace = 0 end if type(namespace) == 'string' then namespace = mw.text.split(namespace, ',') elseif type(namespace) ~= 'table' then namespace = { namespace } end local namespace_map = mw.site.namespaces local title = mw.title.getCurrentTitle() for _, namespace in ipairs(namespace) do if tonumber(namespace) then if title.namespace == tonumber(namespace) then return true end end local namespace_data = namespace_map[namespace] if namespace_data then if title.namespace == namespace_data.id then return true end end end return false end function p.makeCategory(catname, namespace, key) if not catname or catname == '' then return '' end if not checkNamespace(namespace) then return '' end if key and key ~= '' then return "[[Kategorie:" .. catname .. "|" .. key .. "]]" else return "[[Kategorie:" .. catname .. "]]" end end function p.fromTemplate(frame) local parent = frame:getParent() local params = parent.args return p.makeCategory(params[1], params[2], params[3]) end return p o2kgjhq9pwd2un4w1liis7yc7bp2j8h 118363 118362 2022-08-20T07:52:06Z Fraxinus.cs 8381 Fraxinus.cs переименовал страницу [[Амодуль:Акатегориа]] в [[Амодуль:Category]] без оставления перенаправления Scribunto text/plain require "Амодуль:No globals" local p = {} local function checkNamespace(namespace) if not namespace or namespace == '' then namespace = 0 end if type(namespace) == 'string' then namespace = mw.text.split(namespace, ',') elseif type(namespace) ~= 'table' then namespace = { namespace } end local namespace_map = mw.site.namespaces local title = mw.title.getCurrentTitle() for _, namespace in ipairs(namespace) do if tonumber(namespace) then if title.namespace == tonumber(namespace) then return true end end local namespace_data = namespace_map[namespace] if namespace_data then if title.namespace == namespace_data.id then return true end end end return false end function p.makeCategory(catname, namespace, key) if not catname or catname == '' then return '' end if not checkNamespace(namespace) then return '' end if key and key ~= '' then return "[[Kategorie:" .. catname .. "|" .. key .. "]]" else return "[[Kategorie:" .. catname .. "]]" end end function p.fromTemplate(frame) local parent = frame:getParent() local params = parent.args return p.makeCategory(params[1], params[2], params[3]) end return p o2kgjhq9pwd2un4w1liis7yc7bp2j8h 118364 118363 2022-08-20T07:52:52Z Fraxinus.cs 8381 Scribunto text/plain require "Амодуль:No globals" local p = {} local function checkNamespace(namespace) if not namespace or namespace == '' then namespace = 0 end if type(namespace) == 'string' then namespace = mw.text.split(namespace, ',') elseif type(namespace) ~= 'table' then namespace = { namespace } end local namespace_map = mw.site.namespaces local title = mw.title.getCurrentTitle() for _, namespace in ipairs(namespace) do if tonumber(namespace) then if title.namespace == tonumber(namespace) then return true end end local namespace_data = namespace_map[namespace] if namespace_data then if title.namespace == namespace_data.id then return true end end end return false end function p.makeCategory(catname, namespace, key) if not catname or catname == '' then return '' end if not checkNamespace(namespace) then return '' end if key and key ~= '' then return "[[Акатегориа:" .. catname .. "|" .. key .. "]]" else return "[[Акатегориа:" .. catname .. "]]" end end function p.fromTemplate(frame) local parent = frame:getParent() local params = parent.args return p.makeCategory(params[1], params[2], params[3]) end return p c81hxhzzebsnwy2zq4xakrtmcetl0kb Амодуль:Wikidata/cite 828 30718 118365 2022-08-20T07:59:24Z Fraxinus.cs 8381 Новая страница: «require "Амодуль:No globals" local p = {} local lib = require 'Амодуль:Wikidata/lib' local cache = {} p.props = { accessdate = { 'P813' }, -- archivedate = { 'P2960' }, TODO -- archiveurl = { 'P1065' }, TODO author = { 'P50' }, date = { 'P577' }, doi = { 'P356' }, -- editor = { 'P90' }, TODO -- illustration = { 'P110' }, TODO isbn = { 'P212', 'P957' }, -- lang = { 'P364', 'P407' }, TODO -- pages = { 'P304' }, TODO place = { 'P291...» Scribunto text/plain require "Амодуль:No globals" local p = {} local lib = require 'Амодуль:Wikidata/lib' local cache = {} p.props = { accessdate = { 'P813' }, -- archivedate = { 'P2960' }, TODO -- archiveurl = { 'P1065' }, TODO author = { 'P50' }, date = { 'P577' }, doi = { 'P356' }, -- editor = { 'P90' }, TODO -- illustration = { 'P110' }, TODO isbn = { 'P212', 'P957' }, -- lang = { 'P364', 'P407' }, TODO -- pages = { 'P304' }, TODO place = { 'P291' }, published = { 'P1433' }, -- publisher = { 'P123' }, TODO title = { 'P1476' }, -- type = { 'P31' }, TODO url = { 'P854', 'P953', 'P2699' }, work = { 'P248' }, } local function dataToContent(data) local content = {} local Formatters = require 'Амодуль:Wikidata/Formatters' if data.author then local authors = {} for _, snak in ipairs(data.author) do table.insert(authors, Formatters.getFormattedValue(snak, {})) end table.insert(content, table.concat(authors, ', ') .. ':') end if data.title or data.work then local title if data.title then title = Formatters.getFormattedValue(data.title[1], {}) end if data.work then title = Formatters.getFormattedValue(data.work[1], { text = title }) -- TODO end table.insert(content, mw.ustring.format("''%s''.", title)) end if data.published then local published = Formatters.getFormattedValue(data.published[1], {}) table.insert(content, mw.ustring.format("In: %s.", published)) end if data.place then local places = {} for _, snak in ipairs(data.place) do table.insert(places, Formatters.getFormattedValue(snak, {})) end table.insert(content, table.concat(places, ', ') .. '.') end if data.date then local date = Formatters.getFormattedValue(data.date[1], { nolink = true }) .. '.' table.insert(content, date) end if data.isbn then local isbn = Formatters.getFormattedValue(data.isbn[1], { pattern = '[[Speciální:Zdroje knih/$1|$1]]' }) table.insert(content, '[[International Standard Book Number|ISBN]] ' .. isbn .. '.') end if data.doi then local doi = Formatters.getFormattedValue(data.doi[1], { autoformat = true, property = data.doi[1].property, }) table.insert(content, '[[Digital object identifier|DOI]] ' .. doi .. '.') end if data.url then local url = Formatters.getFormattedValue(data.url[1], { ['value-formatter'] = 'url', text = 'Dostupné online' }) .. '.' table.insert(content, url) elseif data.external then local url = Formatters.getFormattedValue(data.external[1], { autoformat = true, property = data.external[1].property, text = 'Dostupné online' -- todo: i18n }) .. '.' table.insert(content, url) end if #content > 0 and data.accessdate then local date = Formatters.getRawValue(data.accessdate[1], {}):toString() table.insert(content, mw.ustring.format('[cit. %s]', date)) end return table.concat(content, ' ') end local function dataFromItem(id, data) for key, props in pairs(p.props) do if not data[key] then local array = {} for _, prop in ipairs(props) do for _, statement in ipairs(mw.wikibase.getBestStatements(id, prop)) do if lib.IsSnakValue(statement.mainsnak) then table.insert(array, statement.mainsnak) end end if #array > 0 then break end end if #array > 0 then data[key] = array end end end end function p.formatReferences(references, options) local frame = mw.getCurrentFrame() local Formatters = require 'Амодуль:Wikidata/Formatters' local valid_refs = {} local limit = tonumber(options.max_ref) for _, ref in ipairs(references) do if cache[ref.hash] then table.insert(valid_refs, frame:extensionTag('ref', '', { name = ref.hash })) else local data = {} for key, props in pairs(p.props) do local array = {} for _, prop in ipairs(props) do if ref.snaks[prop] then for _, snak in ipairs(ref.snaks[prop]) do if lib.IsSnakValue(snak) then table.insert(array, snak) end end end if #array > 0 then break end end if #array > 0 then data[key] = array end end for prop, snaks in pairs(ref.snaks) do if snaks[1].datatype == 'external-id' or prop == 'P627' then --fixme data.external = { snaks[1] } break end end if data.work then -- P248 local id = Formatters.getRawValue(data.work[1], {}) dataFromItem(id, data) end local ref_content = dataToContent(data) if ref_content ~= '' then if lib.IsOptionTrue(options, 'addlink') then -- TODO end ref_content = lib.addWdClass(ref_content) table.insert(valid_refs, frame:extensionTag('ref', ref_content, { name = ref.hash })) cache[ref.hash] = true end end if limit and #valid_refs == limit then break end end return table.concat(valid_refs) end return p 6ifyi4tzuisjnucrfgv781zwacpsge2 118366 118365 2022-08-20T08:05:20Z Fraxinus.cs 8381 Scribunto text/plain require "Амодуль:No globals" local p = {} local lib = require 'Амодуль:Wikidata/lib' local cache = {} p.props = { accessdate = { 'P813' }, -- archivedate = { 'P2960' }, TODO -- archiveurl = { 'P1065' }, TODO author = { 'P50' }, date = { 'P577' }, doi = { 'P356' }, -- editor = { 'P90' }, TODO -- illustration = { 'P110' }, TODO isbn = { 'P212', 'P957' }, -- lang = { 'P364', 'P407' }, TODO -- pages = { 'P304' }, TODO place = { 'P291' }, published = { 'P1433' }, -- publisher = { 'P123' }, TODO title = { 'P1476' }, -- type = { 'P31' }, TODO url = { 'P854', 'P953', 'P2699' }, work = { 'P248' }, } local function dataToContent(data) local content = {} local Formatters = require 'Амодуль:Wikidata/Formatters' if data.author then local authors = {} for _, snak in ipairs(data.author) do table.insert(authors, Formatters.getFormattedValue(snak, {})) end table.insert(content, table.concat(authors, ', ') .. ':') end if data.title or data.work then local title if data.title then title = Formatters.getFormattedValue(data.title[1], {}) end if data.work then title = Formatters.getFormattedValue(data.work[1], { text = title }) -- TODO end table.insert(content, mw.ustring.format("''%s''.", title)) end if data.published then local published = Formatters.getFormattedValue(data.published[1], {}) table.insert(content, mw.ustring.format("In: %s.", published)) end if data.place then local places = {} for _, snak in ipairs(data.place) do table.insert(places, Formatters.getFormattedValue(snak, {})) end table.insert(content, table.concat(places, ', ') .. '.') end if data.date then local date = Formatters.getFormattedValue(data.date[1], { nolink = true }) .. '.' table.insert(content, date) end if data.isbn then local isbn = Formatters.getFormattedValue(data.isbn[1], { pattern = '[[Цастәи:Источники_книг/$1|$1]]' }) table.insert(content, '[[International Standard Book Number|ISBN]] ' .. isbn .. '.') end if data.doi then local doi = Formatters.getFormattedValue(data.doi[1], { autoformat = true, property = data.doi[1].property, }) table.insert(content, '[[Digital object identifier|DOI]] ' .. doi .. '.') end if data.url then local url = Formatters.getFormattedValue(data.url[1], { ['value-formatter'] = 'url', text = 'Онлаин' }) .. '.' table.insert(content, url) elseif data.external then local url = Formatters.getFormattedValue(data.external[1], { autoformat = true, property = data.external[1].property, text = 'Dostupné online' -- todo: i18n }) .. '.' table.insert(content, url) end if #content > 0 and data.accessdate then local date = Formatters.getRawValue(data.accessdate[1], {}):toString() table.insert(content, mw.ustring.format('[cit. %s]', date)) end return table.concat(content, ' ') end local function dataFromItem(id, data) for key, props in pairs(p.props) do if not data[key] then local array = {} for _, prop in ipairs(props) do for _, statement in ipairs(mw.wikibase.getBestStatements(id, prop)) do if lib.IsSnakValue(statement.mainsnak) then table.insert(array, statement.mainsnak) end end if #array > 0 then break end end if #array > 0 then data[key] = array end end end end function p.formatReferences(references, options) local frame = mw.getCurrentFrame() local Formatters = require 'Амодуль:Wikidata/Formatters' local valid_refs = {} local limit = tonumber(options.max_ref) for _, ref in ipairs(references) do if cache[ref.hash] then table.insert(valid_refs, frame:extensionTag('ref', '', { name = ref.hash })) else local data = {} for key, props in pairs(p.props) do local array = {} for _, prop in ipairs(props) do if ref.snaks[prop] then for _, snak in ipairs(ref.snaks[prop]) do if lib.IsSnakValue(snak) then table.insert(array, snak) end end end if #array > 0 then break end end if #array > 0 then data[key] = array end end for prop, snaks in pairs(ref.snaks) do if snaks[1].datatype == 'external-id' or prop == 'P627' then --fixme data.external = { snaks[1] } break end end if data.work then -- P248 local id = Formatters.getRawValue(data.work[1], {}) dataFromItem(id, data) end local ref_content = dataToContent(data) if ref_content ~= '' then if lib.IsOptionTrue(options, 'addlink') then -- TODO end ref_content = lib.addWdClass(ref_content) table.insert(valid_refs, frame:extensionTag('ref', ref_content, { name = ref.hash })) cache[ref.hash] = true end end if limit and #valid_refs == limit then break end end return table.concat(valid_refs) end return p cqaka462xrvinwk2y0af0mjeq2t57l9 Амодуль:Functions 828 30719 118368 2022-08-20T08:11:35Z Fraxinus.cs 8381 Новая страница: «require "Амодуль:No globals" local p = {} -- Изменяет первую букву строки на заглавную -- @param строка -- @return строка function p.firstToUpper(str) return mw.ustring.upper(mw.ustring.sub(str, 1, 1)) .. mw.ustring.sub(str, 2) end -- Удаляет пустые параметры из таблицы -- @param табулица -- @return табулица function p.cleanArgs(args) local cleanArgs...» Scribunto text/plain require "Амодуль:No globals" local p = {} -- Изменяет первую букву строки на заглавную -- @param строка -- @return строка function p.firstToUpper(str) return mw.ustring.upper(mw.ustring.sub(str, 1, 1)) .. mw.ustring.sub(str, 2) end -- Удаляет пустые параметры из таблицы -- @param табулица -- @return табулица function p.cleanArgs(args) local cleanArgs = {} for key, value in pairs(args) do if type(value) == 'string' then local value = mw.text.trim(value) if value ~= '' then cleanArgs[key] = value end elseif type(value) == 'table' then if not p.isTableEmpty(value) then cleanArgs[key] = value end else cleanArgs[key] = value end end return cleanArgs end -- Определяет, является ли таблица пустой (вообще не имеет или пустые параметры) -- @param табулица -- @return bool function p.isTableEmpty(Table) for key, value in pairs(Table) do if type(value) == 'table' then if not p.isTableEmpty(value) then return false end elseif type(value) == 'string' then if mw.text.trim(value) ~= '' then return false end else return false end end return true end return p h4eol7w00g20e49znvf8szz73zfr3yw Амодуль:Wikidata/i18n 828 30720 118370 2022-08-20T08:35:45Z Fraxinus.cs 8381 Новая страница: «return { categories = { ['arbitrary-data'] = '-', ['centenarians'] = 'Мониторинг:Люди века', ['centenarians-living'] = 'Мониторинг:Люди живого века', ['diff'] = 'Обслуживание:%s отличается от Викиданных', ['failed-age-computing'] = 'Обслуживание: ошибка в расчете возраста', ['missing-label'] = 'Обслуживание: добавить...» Scribunto text/plain return { categories = { ['arbitrary-data'] = '-', ['centenarians'] = 'Мониторинг:Люди века', ['centenarians-living'] = 'Мониторинг:Люди живого века', ['diff'] = 'Обслуживание:%s отличается от Викиданных', ['failed-age-computing'] = 'Обслуживание: ошибка в расчете возраста', ['missing-label'] = 'Обслуживание: добавить метку в Викиданные', ['not'] = 'Обслуживание:%s нет в Викиданных', ['references'] = 'Мониторинг:Ссылки из Викиданных', ['same'] = 'Мониторинг:%s соответствует Викиданным', ['used-property'] = 'Мониторинг: использование свойства %s', }, date = { ['start'] = 'с %s', ['end'] = 'до %s', ['age'] = '$1&nbsp;{{PLURAL:$2|год|годы|годы}}', ['in-the-age'] = 'на $1&nbsp;-м году', ['gregorian'] = '<sup>[[грегориантәи амзар|грег.]]</sup>', ['julian'] = '<sup>[[иулиантәи амзар|иул.]]</sup>', ['CE'] = '$1&nbsp;ш.', ['millenium'] = '$1.&nbsp;tisíciletí', ['millenium-linked'] = '[[$1. tisíciletí|$1.&nbsp;tisíciletí]]', ['millenium-BCE'] = '$1.&nbsp;tisíciletí př.&nbsp;n.&nbsp;l.', ['millenium-BCE-linked'] = '[[$1. tisíciletí př. n. l.|$1.&nbsp;tisíciletí př.&nbsp;n.&nbsp;l.]]', ['century'] = '$1.&nbsp;století', ['century-linked'] = '[[$1. století|$1.&nbsp;století]]', ['century-BCE'] = '$1.&nbsp;století př.&nbsp;n.&nbsp;l.', ['century-BCE-linked'] = '[[$1. století př. n. l.|$1.&nbsp;století př.&nbsp;n.&nbsp;l.]]', ['decade'] = 'Desetiletí od $1', --['decade-linked'] = '[[$1–{{#expr:$1+9}}|Desetiletí od $1]]', ['decade-BCE'] = 'Desetiletí do $1 př.&nbsp;n.&nbsp;l.', --['decade-BCE-linked'] = '[[$1–{{#expr:$1+9}} př. n. l.|Desetiletí do $1&nbsp;př.&nbsp;n.&nbsp;l.]]', ['year'] = 'Y', ['year-linked'] = '[[Y]]', ['year-BCE'] = 'Y"&nbsp;př.&nbsp;n.&nbsp;l."', ['year-BCE-linked'] = '[[Y" př. n. l.|"Y"&nbsp;př.&nbsp;n.&nbsp;l."]]', ['year-month'] = 'F Y', ['year-month-linked'] = 'F [[Y]]', ['year-month-BCE'] = 'F Y"&nbsp;př.&nbsp;n.&nbsp;l."', ['year-month-BCE-linked'] = 'F [[Y" př. n. l.|"Y"&nbsp;př.&nbsp;n.&nbsp;l."]]', ['month-day'] = 'j."&nbsp;"xg', ['day'] = 'j.', ['year-month-day'] = 'j."&nbsp;"xg Y', ['year-month-day-linked'] = '[[j. F|j."&nbsp;"xg]] [[Y]]', ['year-month-day-BCE'] = 'j."&nbsp;"xg Y"&nbsp;př.&nbsp;n.&nbsp;l."', ['year-month-day-BCE-linked'] = '[[j. F|j."&nbsp;"xg]] [[Y" př. n. l.|"Y"&nbsp;př.&nbsp;n.&nbsp;l.]]"', }, errors = { ['entity-not-found'] = 'Объект не найден', ['infobox-type-invalid'] = 'Недопустимый тип значения в строке %s: %s.', ['invalid-datatype'] = 'Неверный тип данных свойства „%s“: „%s“; обязательный „%s“', -- legacy ['invalid-datatype2'] = 'Для функции „%s“ требуется тип данных „%s“, был предоставлен „%s“', ['invalid-date'] = 'Недействительная дата „%s“', ['invalid-field'] = 'Недопустимое поле „%s“', ['invalid-sort'] = 'Неверный метод сортировки „%s“', ['param-not-provided'] = 'Параметр не указан „%s“', ['unknown-claim-type'] = 'Неизвестный тип утверждения: %s', ['unknown-datavalue-type'] = 'Неизвестный тип значения данных: %s', ['unknown-entity-type'] = 'Неизвестный тип сущности: %s', ['unknown-snak-type'] = 'Неизвестный тип снака: %s', }, lang = 'cs', ['missing-label'] = 'Запись Викиданных не включает абхазский ярлык; вы можете дополнить его', ['more-on-Wikidata'] = '…&nbsp;подробнее на [[d:%s#%s|Викиданных]]', novalue = "''без значение''", -- legacy somevalue = "''неизвестное значение''", -- legacy ['decimal point'] = ',', ['thousands separator'] = '&nbsp;', ['qualifiers separator'] = '; ', } h3nddhgmjws3vq6p1tszt1t5km12gco 118371 118370 2022-08-20T08:37:11Z Fraxinus.cs 8381 Scribunto text/plain return { categories = { ['arbitrary-data'] = '-', ['centenarians'] = 'Мониторинг:Люди века', ['centenarians-living'] = 'Мониторинг:Люди живого века', ['diff'] = 'Обслуживание:%s отличается от Викиданных', ['failed-age-computing'] = 'Обслуживание: ошибка в расчете возраста', ['missing-label'] = 'Обслуживание: добавить метку в Викиданные', ['not'] = 'Обслуживание:%s нет в Викиданных', ['references'] = 'Мониторинг:Ссылки из Викиданных', ['same'] = 'Мониторинг:%s соответствует Викиданным', ['used-property'] = 'Мониторинг: использование свойства %s', }, date = { ['start'] = 'с %s', ['end'] = 'до %s', ['age'] = '$1&nbsp;{{PLURAL:$2|год|годы|годы}}', ['in-the-age'] = 'на $1&nbsp;-м году', ['gregorian'] = '<sup>[[грегориантәи амзар|грег.]]</sup>', ['julian'] = '<sup>[[иулиантәи амзар|иул.]]</sup>', ['CE'] = '$1&nbsp;ш.', ['millenium'] = '$1.&nbsp;tisíciletí', ['millenium-linked'] = '[[$1. tisíciletí|$1.&nbsp;tisíciletí]]', ['millenium-BCE'] = '$1.&nbsp;tisíciletí př.&nbsp;n.&nbsp;l.', ['millenium-BCE-linked'] = '[[$1. tisíciletí př. n. l.|$1.&nbsp;tisíciletí př.&nbsp;n.&nbsp;l.]]', ['century'] = '$1.&nbsp;století', ['century-linked'] = '[[$1. století|$1.&nbsp;století]]', ['century-BCE'] = '$1.&nbsp;století př.&nbsp;n.&nbsp;l.', ['century-BCE-linked'] = '[[$1. století př. n. l.|$1.&nbsp;století př.&nbsp;n.&nbsp;l.]]', ['decade'] = 'Desetiletí od $1', --['decade-linked'] = '[[$1–{{#expr:$1+9}}|Desetiletí od $1]]', ['decade-BCE'] = 'Desetiletí do $1 př.&nbsp;n.&nbsp;l.', --['decade-BCE-linked'] = '[[$1–{{#expr:$1+9}} př. n. l.|Desetiletí do $1&nbsp;př.&nbsp;n.&nbsp;l.]]', ['year'] = 'Y', ['year-linked'] = '[[Y]]', ['year-BCE'] = 'Y"&nbsp;př.&nbsp;n.&nbsp;l."', ['year-BCE-linked'] = '[[Y" př. n. l.|"Y"&nbsp;př.&nbsp;n.&nbsp;l."]]', ['year-month'] = 'F Y', ['year-month-linked'] = 'F [[Y]]', ['year-month-BCE'] = 'F Y"&nbsp;př.&nbsp;n.&nbsp;l."', ['year-month-BCE-linked'] = 'F [[Y" př. n. l.|"Y"&nbsp;př.&nbsp;n.&nbsp;l."]]', ['month-day'] = 'j."&nbsp;"xg', ['day'] = 'j.', ['year-month-day'] = 'j."&nbsp;"xg Y', ['year-month-day-linked'] = '[[j. F|j."&nbsp;"xg]] [[Y]]', ['year-month-day-BCE'] = 'j."&nbsp;"xg Y"&nbsp;př.&nbsp;n.&nbsp;l."', ['year-month-day-BCE-linked'] = '[[j. F|j."&nbsp;"xg]] [[Y" př. n. l.|"Y"&nbsp;př.&nbsp;n.&nbsp;l.]]"', }, errors = { ['entity-not-found'] = 'Объект не найден', ['infobox-type-invalid'] = 'Недопустимый тип значения в строке %s: %s.', ['invalid-datatype'] = 'Неверный тип данных свойства „%s“: „%s“; обязательный „%s“', -- legacy ['invalid-datatype2'] = 'Для функции „%s“ требуется тип данных „%s“, был предоставлен „%s“', ['invalid-date'] = 'Недействительная дата „%s“', ['invalid-field'] = 'Недопустимое поле „%s“', ['invalid-sort'] = 'Неверный метод сортировки „%s“', ['param-not-provided'] = 'Параметр не указан „%s“', ['unknown-claim-type'] = 'Неизвестный тип утверждения: %s', ['unknown-datavalue-type'] = 'Неизвестный тип значения данных: %s', ['unknown-entity-type'] = 'Неизвестный тип сущности: %s', ['unknown-snak-type'] = 'Неизвестный тип снака: %s', }, lang = 'ab', ['missing-label'] = 'Запись Викиданных не включает абхазский ярлык; вы можете дополнить его', ['more-on-Wikidata'] = '…&nbsp;подробнее на [[d:%s#%s|Викиданных]]', novalue = "''без значение''", -- legacy somevalue = "''неизвестное значение''", -- legacy ['decimal point'] = ',', ['thousands separator'] = '&nbsp;', ['qualifiers separator'] = '; ', } plubt2338dxvgz6mqra0f8vx3sysyxi Амодуль:Wikidata/Formatters 828 30721 118372 2022-08-20T08:39:50Z Fraxinus.cs 8381 Новая страница: «require 'Амодуль:No globals' local p = {} p.Formatters = {} setmetatable(p.Formatters, { __index = function(t, key) t[key] = require('Амодуль:Wikidata/Formatters/' .. key) return t[key] end }) local lib = require 'Амодуль:Wikidata/lib' local function formatSpecial(snaktype, options) local i18n = mw.loadData('Амодуль:Wikidata/i18n') return options[snaktype] or i18n[snaktype] -- todo: přeložit pomocí hlášení end f...» Scribunto text/plain require 'Амодуль:No globals' local p = {} p.Formatters = {} setmetatable(p.Formatters, { __index = function(t, key) t[key] = require('Амодуль:Wikidata/Formatters/' .. key) return t[key] end }) local lib = require 'Амодуль:Wikidata/lib' local function formatSpecial(snaktype, options) local i18n = mw.loadData('Амодуль:Wikidata/i18n') return options[snaktype] or i18n[snaktype] -- todo: přeložit pomocí hlášení end function p.getRawValue(snak, options) if snak.snaktype == 'somevalue' or snak.snaktype == 'novalue' then return snak.snaktype elseif snak.snaktype ~= 'value' then return error(lib.formatError('unknown-snak-type', snak.snaktype)) end return p.Formatters[snak.datavalue.type].getRawValue(snak.datavalue.value, options or {}) end function p.formatRawValue(value, formatter, options) options = options or {} if value == 'somevalue' or value == 'novalue' then return formatSpecial(value, options) else return p.Formatters[formatter].formatRawValue(value, options) end end function p.getFormattedValue(snak, options) if snak.snaktype == 'somevalue' or snak.snaktype == 'novalue' then return formatSpecial(snak.snaktype, options) elseif snak.snaktype ~= 'value' then return error(lib.formatError('unknown-snak-type', snak.snaktype)) end local formatter = options['value-formatter'] or snak.datavalue.type if formatter == 'built-in' then return mw.wikibase.formatValue(snak) else return p.Formatters[formatter].formatValue(snak.datavalue.value, options) end end return p 9n8o845lwjvelhnjlhratlbnsihgtvv Амодуль:Wikidata/Formatters/globecoordinate 828 30722 118373 2022-08-20T08:59:25Z Fraxinus.cs 8381 Новая страница: «require 'Амодуль:No globals' local p = {} local lib = require 'Амодуль:Wikidata/lib' function p.getRawValue(value, options) if not options.field then local GlobeCoordinate = require 'Амодуль:GlobeCoordinate' return GlobeCoordinate.newFromWikidataValue(value) elseif options.field == 'latitude' or options.field == 'longitude' or options.field == 'precision' or options.field == 'globe' then return value[options.field] else ret...» Scribunto text/plain require 'Амодуль:No globals' local p = {} local lib = require 'Амодуль:Wikidata/lib' function p.getRawValue(value, options) if not options.field then local GlobeCoordinate = require 'Амодуль:GlobeCoordinate' return GlobeCoordinate.newFromWikidataValue(value) elseif options.field == 'latitude' or options.field == 'longitude' or options.field == 'precision' or options.field == 'globe' then return value[options.field] else return error(lib.formatError('invalid-field', options.field)) end end function p.formatValue(value, options) --local GlobeCoordinate = require 'Амодуль:GlobeCoordinate' --local _value = GlobeCoordinate.newFromWikidataValue(value) local Coord = require 'Амодуль:Coordinates' local args = { value.latitude, value.longitude, } local globe = lib.getItemIdFromURI(value.globe) if globe and globe ~= 'Q2' then args.globe = Coord.myGlobes[globe] end setmetatable(args, { __index = options }) return Coord._renderCoordinates(args, mw.getCurrentFrame()) end return p 41vzirfw16w8jo0h8vgokubn1g4yy1v Амодуль:GlobeCoordinate 828 30723 118374 2022-08-20T09:00:59Z Fraxinus.cs 8381 Новая страница: «local GlobeCoordinate = {} --Internal functions --[[ Check if a value is a number in the given range @param mixed value @param number min @param number max @return boolean ]]-- local function validateNumberInRange( value, min, max ) return type( value ) == 'number' and value >= min and value <= max end --[[ Validate a GlobeCoordinate defintion @param table definition data @return boolean ]]-- local function validate( def...» Scribunto text/plain local GlobeCoordinate = {} --Internal functions --[[ Check if a value is a number in the given range @param mixed value @param number min @param number max @return boolean ]]-- local function validateNumberInRange( value, min, max ) return type( value ) == 'number' and value >= min and value <= max end --[[ Validate a GlobeCoordinate defintion @param table definition data @return boolean ]]-- local function validate( definition ) --Validate constantes if definition.globe ~= GlobeCoordinate.GLOBE.EARTH then return false end --Validate precision if not validateNumberInRange( definition.precision, 0, 1 ) then return false end --Validate latitude and longitude if not validateNumberInRange( definition.latitude, -180, 360 ) or not validateNumberInRange( definition.longitude, -180, 360 ) then return false end return true end --[[ Try to find the relevant precision for a latitude or longitude as float @param float float @return number the precision ]]-- local function detectPrecisionForFloat( float ) local parts = mw.text.split( tostring( float ), '.' ) if parts[2] then return math.pow( 10, -1 * #parts[2] ) else return 1 end end --[[ Try to find the relevant precision for a GlobeCoordinate definition @param table GlobeCoordinate definition @return number the precision ]]-- local function guessPrecision( definition ) return math.max( detectPrecisionForFloat( definition.latitude ), detectPrecisionForFloat( definition.longitude ) ) end --[[ Format a float coordinate as DMS according to the precision @param float float @param precision float @param positive string the tag if the coordinate is positive, like 'N' @param positive string the tag if the coordinate is negative, like 'S' @return string the coordinate in DMS format ]]-- local function formatDMS( float, precision, positive, negative ) local isNegative = float < 0 float = math.abs( float ) local d = math.floor( float ) local dms = d .. '°' if precision <= 1/60 then float = (float - d) * 60 local m = math.floor( float ) dms = dms .. ' ' .. m .. '′' if precision <= 1/3600 then float = (float - m) * 60 local s if float%2 ~= 0.5 then s = math.floor( float + 0.5 ) else s = float - 0.5 end dms = dms .. ' ' .. s .. '″' --TODO: precision higher than second end end if isNegative then return dms .. ' ' .. negative else return dms .. ' ' .. positive end end --Public interface --[[ Build a new GlobeCoordinate @param table definition definition of the coodinate @return GlobeCoordinate|nil ]]-- function GlobeCoordinate.new( definition ) --Default values if definition.precision == nil then definition.precision = guessPrecision( definition ) end if definition.globe == nil then definition.globe = GlobeCoordinate.GLOBE.EARTH end if not validate( definition ) then return nil end local coord = { latitude = definition.latitude, longitude = definition.longitude, globe = definition.globe or GlobeCoordinate.GLOBE.EARTH, precision = definition.precision or 0 } setmetatable( coord, { __index = GlobeCoordinate, __tostring = function( self ) return self:toString() end } ) return coord end --[[ Build a new GlobeCoordinate from a Wikidata GlobeCoordinate value @param table wikidataValue the coordinate as represented by Wikidata @return GlobeCoordinate|nil ]]-- function GlobeCoordinate.newFromWikidataValue( wikidataValue ) if wikidataValue.globe == 'http://www.wikidata.org/entity/Q2' then wikidataValue.globe = GlobeCoordinate.GLOBE.EARTH else return nil end return GlobeCoordinate.new( wikidataValue ) end --[[ Return a GlobeCoordinate as a string @param mw.language|string|nil language to use. By default the content language. @return string @todo i18n ]]-- function GlobeCoordinate:toString( language ) return formatDMS( self.latitude, self.precision, 'N', 'S' ) .. ' ' .. formatDMS( self.longitude, self.precision, 'E', 'W' ) end --[[ Return a GlobeCoordinate in HTMl (with a <GlobeCoordinate> node) @param mw.language|string|nil language to use. By default the content language. @param table|nil attributes table of attributes to add to the <GlobeCoordinate> node. @return string ]]-- function GlobeCoordinate:toHtml( language, attributes ) return mw.text.tag( 'span', { ["class"] = "geo" }, mw.text.tag( 'span', { ["class"] = "latitude", ["title"] = self.latitude, }, formatDMS( self.latitude, self.precision, 'N', 'S' ) ) .. ' ' .. mw.text.tag( 'span', { ["class"] = "longitude", ["title"] = self.longitude, }, formatDMS( self.longitude, self.precision, 'E', 'W' ) ) ) end --[[ Supported globes ]]-- GlobeCoordinate.GLOBE = { EARTH = 'Earth' } return GlobeCoordinate c95625vlna7vsodmpj0s2xtnwvid6yg