Moduł:Dopracować: Różnice pomiędzy wersjami

Usunięta treść Dodana treść
Nie podano opisu zmian
Nie podano opisu zmian
Linia 63:
-- scan well known reasons with date
for k, i in pairs(mapParamToReason) do
local args={}
local object = pf:getArgument(k)
if(require("Moduł:Dopracować").errormodule(frame,args)=="")then
if object then
for k, i in pairs(mapParamToReason) do
local objectcurrentDate = pfobject:getArgumentexpand(k)
if objectcurrentDate then
elseifif not onlyReason ~= i then
local currentDate = object:expand()
if onlyReason currentDate= theni
if notelseif onlyReason ~= i then
onlyReason = i0
break
elseif onlyReason ~= i then
onlyReason = 0
break
end
end
end
end
end
-- scan reasons without dates
if not onlyReason then
for i, reason in ipairs(pf.args) do
--local object = pf:getArgument(i)
--if object then
-- local reason = object:expand()
if reason and ((i ~= resources.data.sectionParamIndex) or (reason ~= resources.data.sectionParamValue)) then
if mw.text.trim(reason) ~= "" then
local known = mapParamToReason[reason]
if known then
if not onlyReason then
onlyReason = known
elseif onlyReason ~= known then
onlyReason = 0
break
end
end
end
end
end
end
Linia 214 ⟶ 211:
end;
function Templates()
if((args.nazwij_jednostka)and(args.nazwij_jednostka~=""))then
sourceTemplates = (section) and resources.sectionTemplates or resources.otherTemplates
templates["{{unit type}}"]="Jednostki"
templates["{{comma}}"]="";
elseif(args.nazwa_przestrzeni_nazw==resources.data.defaultuser)then
sourceTemplates = (section) and resources.sectionTemplates or resources.userTemplates
templates["{{unit type}}"]="Jednostki użytkowników"
templates["{{comma}}"]=",";
elseif(args.nazwa_przestrzeni_nazw==resources.data.defaulthelp)then
sourceTemplates = (section) and resources.sectionTemplates or resources.pomocTemplates
templates["{{unit type}}"]="Strony pomocy"
templates["{{comma}}"]=",";
elseif(args.nazwa_przestrzeni_nazw==resources.data.defaultwikibooks)then
if(((args.typ_jednostki)and (args.typ_jednostki=="brudnopis projektu"))or(mw.ustring.match(args.nazwa_jednostki,"^[Bb]rudnopis/.-")))then
sourceTemplates = (section) and resources.sectionTemplates or resources.documentationdraftprojectTemplates;
else
sourceTemplates = (section) and resources.sectionTemplates or resources.projektTemplates;
end;
if(((args.typ_jednostki)and(args.typ_jednostki=="brudnopis projektu"))or(mw.ustring.match(args.nazwa_jednostki,"^[Bb]rudnopis/.-")))then
templates["{{unit type}}"]="Jednostki brudnopisu projektu"
else
Linia 238 ⟶ 235:
end;
templates["{{comma}}"]=",";
elseif(args.nazwa_przestrzeni_nazw==resources.data.defaulttemplate)then--
if(((args.typ_jednostki)and (args.typ_jednostki=="brudnopis szablonu"))
or((not mw.ustring.match(args.nazwa_jednostki,"^[Bb]rudnopis/opis$"))and(mw.ustring.match(args.nazwa_jednostki,"^[Bb]rudnopis/.-"))))then
sourceTemplates = (section) and resources.sectionTemplates or resources.documentationdrafttemplateTemplates
templates["{{unit type}}"]="Strony brudnopisu opisu szablonów"
Linia 248 ⟶ 245:
end;
templates["{{comma}}"]=",";
elseif(args.nazwa_przestrzeni_nazw==resources.data.defaultmodule)then--
if(((args.typ_jednostki)and(args.typ_jednostki=="brudnopis modułu"))
or((not mw.ustring.match(args.nazwa_jednostki,"^[Bb]rudnopis/opis$"))and(mw.ustring.match(args.nazwa_jednostki,"^[Bb]rudnopis/.-"))))then
sourceTemplates = (section) and resources.sectionTemplates or resources.documentationdraftmoduleTemplates;
templates["{{unit type}}"]="Strony brudnopisu opisu modułów"
Linia 258 ⟶ 255:
end;
templates["{{comma}}"]=",";
elseif(args.nazwa_przestrzeni_nazw==resources.data.defaultcategory)then
sourceTemplates = (section) and resources.sectionTemplates or resources.categoryTemplates
templates["{{unit type}}"]="Strony kategorii"
templates["{{comma}}"]=",";
elseif(args.nazwa_przestrzeni_nazw==resources.data.defaultmainspace)then
if(args.typ_jednostki)then
if(args.typ_jednostki=="artykuł")then
sourceTemplates=(section) and resources.sectionTemplates or resources.articleTemplates;
templates["{{unit type}}"]="Artykuły"
Linia 274 ⟶ 271:
end;
else
local test2=string.match(args.title.text,"^[^/]+$");
sourceTemplates=(section) and resources.sectionTemplates or ManualAndTemplates(test2);
if(test2)then
Linia 284 ⟶ 281:
end;
end;
elseif(args.nazwa_przestrzeni_nazw==resources.data.defaultwikijunior)then
if(args.typ_jednostki)then
if(args.typ_jednostki=="artykuł dla dzieci")then
sourceTemplates=(section) and resources.sectionTemplates or resources.articleTemplates;
templates["{{unit type}}"]="Artykuły dla dzieci"
Linia 296 ⟶ 293:
end;
else
local test2=string.match(args.title.text,"^[^/]+$");
sourceTemplates=(section) and resources.sectionTemplates or ManualAndTemplates(test2);
if(test2)then
Linia 317 ⟶ 314:
templates[k] = v
end
if(args.nazwa_przestrzeni_nazw==resources.data.defaultwikijunior)then
templates["{{M}}"] = templates["{{M}}"].." dla dzieci"
templates["{{B}}"] = templates["{{B}}"].." dla dzieci"
Linia 330 ⟶ 327:
end;
templates[resources.data.dateTemplate] = date or ""
if args.title.talkPageTitle then
templates[resources.data.talkNameTemplate] = args.title.talkPageTitle.fullText
end
templates["{{FULLPAGENAMEE}}"] = mw.uri.encode(args.title.fullText, "WIKI")
templates["{{PAGENAMEE}}"] = mw.uri.encode(args.title.text, "WIKI")
templates["{{BASEPAGENAMEE}}"] = mw.uri.encode(args.title.baseText, "WIKI")
templates["{{SUBPAGENAMEE}}"] = mw.uri.encode(args.title.subpageText, "WIKI")
templates["{{FULLPAGENAME}}"] = args.title.fullText
templates["{{PAGENAME}}"] = args.title.text
templates["{{BASEPAGENAME}}"] = args.title.baseText
templates["{{SUBPAGENAME}}"] = args.title.subpageText
templates[resources.data.pageUrlTemplate] = args.title:fullUrl()
templates["{{Cat}}"] = resources.data.defaultcategory
templates[resources.data.talkSectionTemplate] = args.pf.args[resources.data.talkPageSectionParamIndex] or ""
local defaultComment, _ = string.gsub(c.default or "", resources.data.templatePattern, templates)
templates[resources.data.infoTemplate] = ((comments)and(#comments > 0)) and ((c.prefix or "")..table.concat(comments, c.separator or ", ")..(c.suffix or "")) or defaultComment
Linia 349 ⟶ 346:
-- prepare "talk" hint
local talk = ""
if args.title.talkPageTitle and args.title.talkPageTitle.exists then
talk, _ = string.gsub(reason.talk or "", resources.data.templatePattern, templates)
end
Linia 355 ⟶ 352:
return templates
end
local defaultDate = args.pf.args[resources.data.defaultDateIndex] or ""
title = mw.title.getCurrentTitle()
pf = frame:getParent()
nazwa_przestrzeni_nazw=pf.args["nazwa przestrzeni nazw"]
nazwij_jednostka=pf.args["nazwij jednostką"]
typ_jednostki=pf.args["typ jednostki"]
nazwa_jednostki=pf.args["nazwa jednostki"]
strona_glowna_projektu=pf.args["strona główna projektu"]
strona_glowna_projektu=(not strona_glowna_projektu) and "Wikibooks:Strona główna" or string.gsub(strona_glowna_projektu,"_"," ");
strona_glowna_wikijuniora=pf.args["strona główna dla dzieci"]
strona_glowna_wikijuniora=(not strona_glowna_wikijuniora)and "Wikijunior:Strona główna" or string.gsub(strona_glowna_wikijuniora,"_"," ");
nazwa_przestrzeni_nazw=(not nazwa_przestrzeni_nazw)and title.nsText or nazwa_przestrzeni_nazw;
nazwa_przestrzeni_nazw=require("Module:Nazwy").NpFun{nazwa=nazwa_przestrzeni_nazw};
nazwa_jednostki=(not nazwa_jednostki)and title.text or nazwa_jednostki
local uchwyt_nazwy_przestrzeni_nazw=mw.site.namespaces[nazwa_przestrzeni_nazw];
if(uchwyt_nazwy_przestrzeni_nazw)then
nazwa_przestrzeni_nazw2=mw.ustring.gsub(uchwyt_nazwy_przestrzeni_nazw.name,"_"," ");
nazwa_przestrzeni_nazw=nazwa_przestrzeni_nazw2;
else
nazwa_przestrzeni_nazw2="";
end;
if(nazwa_jednostki~="")then
prawidlowa_nazwa_jednostki=mw.title.makeTitle('',nazwa_jednostki);
if(prawidlowa_nazwa_jednostki)then
title=(nazwa_przestrzeni_nazw=="")and mw.title.makeTitle('',nazwa_jednostki)
or mw.title.makeTitle('',nazwa_przestrzeni_nazw..":"..nazwa_jednostki)
nstext=(title)and mw.ustring.gsub(title.nsText,"_"," ") or nil;
else
title=nil;
end;
else
title=nil;
end;
sekcja=pf.args[resources.data.sectionParamIndex];
 
local defaultDate = args.pf.args[resources.data.defaultDateIndex] or ""
 
local complexCategories = {
Linia 362 ⟶ 394:
-- table.insert(result, "[[Kategoria:WP?|"..title.text.."]]")
-- else
table.insert(result, "[[{{Cat}}:{{unit type}} wymagające umieszczenia w odpowiedniej kategorii|"..args.title.text.."]]")
end,}
local mapParamToReason = {}
Linia 374 ⟶ 406:
-- scan well known reasons with date
for k, i in pairs(mapParamToReason) do
local object = args.pf:getArgument(k)
if object then
local currentDate = object:expand()
Linia 432 ⟶ 464:
end
local sectionParam = scanReasonWithoutDate(resources.data.sectionParamValue)
for i, reason in ipairs(args.pf.args) do
if(type(i)=="number")then
scanReasonWithoutDate(i,reason)
Linia 438 ⟶ 470:
end
local categories = {}
local bezkategorii=args.pf.args["bez kategorii"];
if((bezkategorii==nil)or(bezkategorii==""))then
for i, v in ipairs(resources.reasons) do
Linia 469 ⟶ 501:
 
local result = {}
local section = (args.sekcja == resources.data.sectionParamValue) or sectionParam
local onlyReasonData = resources.reasons[onlyReason]
local mainText = nil
Linia 482 ⟶ 514:
end
if not mainText and not onlyReason then
local date = args.pf.args[resources.data.defaultDateIndex] or ""
if #date > 0 then
date = string.format(resources.data.dateInfix, date)
Linia 495 ⟶ 527:
table.insert(result, mainText)
if args.title.talkPageTitle and args.title.talkPageTitle.exists and ((#templates[resources.data.talkTemplate] == 0) or (#templates[resources.data.talkSectionTemplate] > 0)) then
local talkPageMessage, _ = string.gsub((#templates[resources.data.talkSectionTemplate] == 0) and resources.data.talkPage or resources.data.talkSection, resources.data.templatePattern, templates)
table.insert(result, talkPageMessage)