Modul:Mainspace editnotice
Videz
![]() | Urejanje te/ga modul/a je za nove ali neregistrirane uporabnike trenutno onemogočeno. Glej pravila zaščite in dnevnik zaščite za več informacij. Če ne morete urejati te strani in želite objaviti spremembo, lahko zaprosite za urejanje, razpravljate o spremembah na pogovorni strani, zaprosite za umik zaščite strani, se prijavite, ali ustvarite uporabniški račun. |
![]() | Ta modul se uporablja v sistemskih sporočilih. Njene spremembe lahko povzročijo takojšnje spremembe uporabniškega vmesnika Wikipedije. Da bi se izognili večjim motnjam, je treba vse spremembe najprej preizkusiti v /peskovniku ali na podstrani /testniprimeri te strani ali v svojem uporabniškem prostoru. Preizkušene spremembe lahko nato objavite v enem samem urejanju te strani. Prosimo, da se o morebitnih spremembah, pred objavo, pogovorite na pogovorni strani. |
![]() | Uporablja Lua: |
This module is for use in Predloga:Editnotices/Namespace/Main. It conditionally includes other editnotice templates.
It has testcases at Modul:Mainspace editnotice/testniprimeri.
Usage
{{#invoke:Mainspace editnotice|main}}
No parameters are required. For testing what editnotice would be generated for a specific page, you can pass |page=
.
Zgornja dokumentacija je vključena iz Modul:Mainspace editnotice/dok. (uredi | zgodovina) Urejevalci lahko preizkušate ta modul v peskovniku (ustvari | mirror) in testnihprimerih (uredi). Prosimo, da dodate kategorije v /dok podstran. Podstrani te predloge. |
local Arguments = require('Modul:Arguments')
local Disambiguation = require('Modul:Disambiguation')
local TfaTitle = require('Modul:TFA title')
local p = {}
p.main = function(frame)
local args = Arguments.getArgs(frame)
return p.core(args.page and mw.title.new(args.page) or mw.title.getCurrentTitle(), frame)
end
local notices = {
draft_notice = function (page, ctx)
if page.exists
and (page.isRedirect or ctx.isDisambigPage)
and mw.title.new('Osnutek:'..page.fullText).exists then
return "Draft at"
end
end,
blp_notice = function(page)
local content = page:getContent()
local living = "%[%[%s*[Kk]ategorija:%s*[Žž]iveči[ _]ljudje%s*%]%]"
local possiblyLiving = "%[%[%s*[Kk]ategorija:%s*[Mm]orda[ _]živeči[ _]ljudje%s*%]%]"
if content and (content:find(living) or content:find(possiblyLiving)) then
return "BLP editintro"
end
end,
disambig_notice = function(page, ctx)
if ctx.isDisambigPage then
return "Disambig editintro"
end
end,
tfa_notice = function(page)
if TfaTitle.today_title() == page.text then
return "TFA editnotice"
end
end,
refideas_notice = function(page)
local talkContent = page.talkPageTitle:getContent()
if talkContent and talkContent:match('%{%{[rR]ef ?idea') and not talkContent:match("Refideas%-nonotice") then
return "Refideas editnotice"
end
end,
}
p.core = function(page, frame)
-- Context object to store values that are expensive to compute and required
-- in multiple places
local context = {
isDisambigPage = Disambiguation._isDisambiguationPage(page.fullText)
}
local text = ''
for _, getNotice in pairs(notices) do
local template = getNotice(page, context)
text = text .. (template and ('<div class="editnotice-link" style="clear: both; float: right; margin: 0px 0.8em; padding: 0; line-height: 1em;"> <small>[[Predloga:'..template..'|'..template..']]</small> </div>' .. frame:expandTemplate{ title = template }) or '')
end
return text
end
return p