Для документации этого модуля может быть создана страница Модуль:Natural monument/doc
local p = {} function p.monument(frame) local pArgs = frame:getParent().args -- Технические ограничения на названия local m_type = pArgs['type'] -- Остальные переменные так же, как в шаблоне local address = pArgs["address"] local area = pArgs["area"] local biosphere = pArgs["biosphere"] local category = pArgs["category"] local commonscat = pArgs["commonscat"] local complex = pArgs["complex"] local description = pArgs["description"] local dismissed = pArgs["dismissed"] local district = pArgs["district"] local document = pArgs["document"] local document2 = pArgs["document2"] local image = pArgs["image"] local knid = pArgs["knid"] local lat = pArgs["lat"] local link = pArgs["link"] local linkextra = pArgs["linkextra"] local long = pArgs["long"] local munid = pArgs["munid"] local municipality = pArgs["municipality"] local name = pArgs["name"] local noupload = pArgs["noupload"] local oopt = pArgs["oopt"] local ooptid = pArgs["ooptid"] local precise = pArgs["precise"] local region = pArgs["region"] local reorganized = pArgs["reorganized"] local status = pArgs["status"] local uid = pArgs["uid"] local unesco = pArgs["unesco"] local wdid = pArgs["wdid"] local wiki = pArgs["wiki"] local wikivoyage = pArgs["wikivoyage"] local m = require("Module:Monument") -- Шапка local tmp = '' if status == "destroyed" or status == "rejected" or status == "reorganized" or status == "perspective" then tmp = 'style="color:#808080;"' end local t = [[{| id=]] .. knid .. [[ class="monument" border=0 style="font-size:97%;width:100%;" |- valign="top" ]] .. tmp -- Изображение local imagelink = '[[File:Natural landmark without photo.svg|border|150x150px|center|Нет фото]]' if image and image ~= '' then --imagelink = '[[File:' .. image .. '|150x150px|center|' .. name .. ']]' imagelink = string.format('[[File:%s|150x150px|center|%s]]', image, name) end t = t .. '\n| width="160px" | ' .. imagelink -- Цвет карточки local background_color = '' if complex and complex ~= '' then if complex == knid then background_color = "#BAFFC1;" else background_color = "#E1FFE4;" end else background_color = "#F8F8F8;" end t = t .. '\n| style=" background-color:' .. background_color .. ' padding-left:10px;" valign="middle" | ' -- Иконка памятника t = t .. "<span id=" .. mw.uri.anchorEncode(knid or '') .. "></span>" if m_type == 'sanctuary' then t = t .. "[[File:WLE reserve3.svg|20px]] " elseif m_type == 'reserve' then t = t .. "[[File:WLE reserve2.svg|17px]] " elseif m_type == 'park' or m_type == 'nature park' or m_type == 'national park' then t = t .. "[[File:WLE park.svg|20px]] " elseif m_type == 'city park' then t = t .. "[[File:WLE CityPark1.svg|20px]] " elseif m_type == 'arboretum' then t = t .. "[[File:WLE arboretum.svg|20px]] " elseif m_type == 'garden' then t = t .. "[[File:WLE garden2.svg|20px]] " elseif m_type == 'resource reserve' then t = t .. "[[File:Twemoji2 1f48e.svg|20px]] " elseif m_type == 'traditional' then t = t .. "[[File:WLE traditional.svg|20px]] " elseif m_type == 'resort' then t = t .. "[[File:WLE resort1.svg|20px]] " elseif m_type == 'general' or m_type == 'nature' then t = t .. "[[File:WLE nature.svg|20px]] " end -- ЮНЕСКО, биосферные резерваты: if unesco and unesco ~= '' then t = t .. " [[File:Swedish world heritage sign.PNG|18px|Объект ЮНЕСКО]] " end if biosphere and biosphere ~= '' then t = t .. " [[File:Man and the Biosphere Programme Logo.svg|18px|Биосферный заповедник]] " end -- Главный элемент в составе комплекса - иконка: if knid == complex then t = t .. '[[File:Location dot darkslategray.svg|10px|главный элемент комплекса]] ' end -- Название объекта и опциональная иконка Викигида: t = t .. '<span class="monument-name" style="font-size:115%; font-weight:bold">' if wikivoyage and wikivoyage ~= '' then t = t .. '[[File:Wikivoyage-logo.svg|15px]] [[' .. wikivoyage .. '|' .. name .. ']]' else t = t .. name end t = t .. '</span><br>' -- Адрес: t = t .. "''Адрес:'' " local addressprecomma = ''; if municipality and municipality ~= '' then t = t .. "''" .. municipality .. "''" addressprecomma = ', ' end if munid and munid ~= '' then t = t .. ' [[File:Wikidata-logo.svg|18px|link=//wikidata.org/wiki/' .. mw.uri.encode(munid, "PATH") .. ']]' end if address and address ~= '' then t = t .. addressprecomma .. address end -- Площадь: if area and area ~= '' then t = t.. string.format(" ''Площадь:'' %s га", area) end t = t .. '<br>' -- Номер объекта: t = t .. "''Номер объекта:'' " .. '<span style="font-size:93%">[[Природные памятники России#Номера объектов|' .. knid .. ']]' if not knid or knid == '' then t = t .. '<span style="color:red;">Не указан</span>' end if uid and uid ~= '' then t = t .. " / [[:wikipedia:uk:Вікіпедія:Вікі_любить_Землю|" .. uid .. ']]' end t = t .. ' </span>' t = t .. " ''Ссылки:'' " -- Координаты (ссылка на карту): if lat and long and lat~= '' and long ~= '' then t = t .. string.format(' [[File:Map mag.png|17px|link=//ru_monuments.toolforge.org/monmap/index.htm?lat=%s&long=%s&zoom=13&layer=X&no-group-markers=true&name=%s|Расположение на карте]]', lat, long, mw.uri.encode(mw.title.getCurrentTitle().fullText, "WIKI")) if precise ~= 'yes' then t = t .. '<span style="color:#FF0000">!</span>' end end -- Статья в Википедии: if wiki and wiki ~= '' then t = t .. ' [[File:Wikipedia-logo-v2.svg|19px|link=//ru.wikipedia.org/wiki/' .. mw.uri.encode(wiki, "PATH") .. '|Статья в Википедии]]' end -- Категория на Викискладе: if commonscat and commonscat ~= '' then t = t .. ' [[File:Commons-logo.svg|13px|link=//commons.wikimedia.org/wiki/Category:' .. mw.uri.encode(commonscat, "PATH") .. '|Категория на Викискладе]]' end -- Элемент в Викиданных: if wdid and wdid ~= '' then t = t .. ' [[File:Wikidata-logo-without-paddings.svg|18px|link=//www.wikidata.org/wiki/' .. mw.uri.encode(wdid, "PATH") .. '|Элемент в Викиданных]]' end -- Внешняя ссылка №1: if link and link ~= '' then t = t .. ' [[Image:P geography 3 b.png|22px|link=' .. link .. '|Внешняя ссылка]]' end -- Внешняя ссылка №2: if linkextra and linkextra ~= '' then t = t .. ' [[Image:P geography 3 b.png|22px|link=' .. linkextra .. '|Внешняя ссылка]]' end -- На сайте ООПТ России: t = t .. '<span style="font-size:80%">' if oopt and oopt ~= '' then t = t .. string.format(' [http://web.archive.org/web/20240228181615/%s на сайте ООПТ России], ', oopt) end t = t .. '</span>' -- Галерея t = t .. string.format(' [[:commons:Category:Protected areas of Russia/%s|галерея]]', knid) t = t .. "<br>" -- Тип: t = t .. "''Описание:'' " local types = {reserve = "Заповедник", sanctuary = "Заказник", ["nature park"] = "Природный парк", ["national park"] = "Национальный парк", park = "Парк", garden = "Памятник садово-паркового искусства", arboretum = "Ботанический сад / дендрарий", resort = "Рекреационная местность / курорт", ["resource reserve"] = "Ресурсный резерват", ["city park"] = "Городской парк", traditional = "Территории традиционного природопользования", nature = "Памятник природы", general = "Прочие ООПТ"} t = t .. types[m_type or ''] or '' -- Категория охраны: if category or '' == '' then local catd = {["0"] = "federal", ["1"] = "regional", ["2"] = "municipal"} category = catd[mw.ustring.sub(knid, 3, 3)] or '' end if category == "federal" then t = t .. " федерального значения." elseif category == "regional" then t = t .. " регионального значения." elseif category == "municipal" then t = t .. " местного значения." else t = t .. ", не охраняется." end -- Документ: if document and document ~= '' then t = t .. frame:extensionTag{name = 'ref', '', args = {name = document}} end if document2 and document2 ~= '' then t = t .. frame:extensionTag{name = 'ref', '', args = {name = document2}} end -- Статус: if status == "dismissed" then t = t .. " Упразднённый." if dismissed and dismissed ~= "" then t = t .. frame:extensionTag{name = 'ref', '', args = {name = dismissed}} end elseif status == "destroyed" then t = t .. " Утраченный." if dismissed and dismissed ~= "" then t = t .. frame:extensionTag{name = 'ref', '', args = {name = dismissed}} end elseif status == "rejected" then t = t .. " Предложенный, не созданный." elseif status == "reorganized" then t = t .. " Реорганизованный." if reorganized and reorganized ~= "" then t = t .. frame:extensionTag{name = 'ref', '', args = {name = reorganized}} end elseif status == "planned" then t = t .. " Перспективный." elseif status == "reserved" then t = t .. " Резервированные земли." end t = t .. ' ' -- ЮНЕСКО и биосферные резерваты: if biosphere and biosphere ~= '' then if biosphere == 'yes' then t = t .. "Биосферный резерват. " elseif string.sub(biosphere, 1, 1) == "Q" then t = t .. "Входит в состав биосферного резервата «" .. mw.wikibase.getEntityObject(biosphere).sitelinks['ruwiki'].title .. "». " end end if unesco and unesco ~= '' then local unesco_title = '' if string.sub(unesco, 1, 1) == "Q" then unesco_title = mw.wikibase.getEntityObject(unesco).sitelinks['ruwiki'].title else local unesco_list = require("Module:Monument/unesco") unesco_title = unesco_list.unesco(unesco) end t = t .. " Входит в состав объекта Всемирного наследия ЮНЕСКО «" .. unesco_title .. "»." end -- Описание объекта: if description and description ~= "" then if mw.ustring.sub(description, -1) ~= '.' then description = description .. '.' end t = t .. " " .. description end -- Ссылка на загрузку if noupload ~= 'yes' then t = t .. '\n| class="plainlinks" style="width:10%; text-align:center; vertical-align:middle; background-color:#FFFACD; padding:0 1em" ' local campaign = "wle-ru" if region == "ru-km" or region == "ru-sev" then campaign = "wle-crimea" end t = t .. "| [//commons.wikimedia.org/w/index.php?title=Special:UploadWizard&campaign=" .. mw.uri.encode(campaign, "PATH") t = t .. [[&id=]] .. mw.uri.encode(knid or '', "PATH") t = t .. [[&id2=]] .. mw.uri.encode(uid or '', "PATH") local upload_desc = (mw.ustring.gsub(name, '"', '') or '') .. ": " if address and address ~= '' then upload_desc = upload_desc .. address .. ", " end if municipality and municipality ~= '' and (municipality or '') ~= (district or '') then upload_desc = upload_desc .. municipality .. ", " end if district and district ~= '' then upload_desc = upload_desc .. district .. ", " end upload_desc = upload_desc .. (m.region_name(region) or '') t = t .. [[&caption=]] .. mw.uri.encode(upload_desc, "PATH") -- t = t .. [[&description=]] .. mw.uri.encode(upload_desc, "PATH") -- if not commonscat or commonscat == '' then -- local ccat = mw.loadData("Module:Monument/commonscat") -- if ccat[region] then -- commonscat = ccat[region][(district or '') .. '_' .. (municipality or '')] or ccat[region][district] or ccat[region]["default"] -- end -- end t = t .. [[&categories=]] .. mw.uri.encode(commonscat or '', "PATH") t = t .. '&uselang=ru <span class="mw-ui-button">Загрузить фото</span>]' end t = t .. "\n|}<hr>" return t end return p;