Modul:Temp: Porovnání verzí

Smazaný obsah Přidaný obsah
oprava vzorů
refaktorizace
Řádek 145:
return output
end
 
 
local function getEqualityType( a, b )
if entrya == titleb then
return "≡"
elseif mw.ustring.lower( texta ) == mw.ustring.lower( titleb ) then
return "≋"
else
return "≢"
end
end
 
Řádek 155 ⟶ 166:
return
end
local patternsLangEntry = {
"^(%a%a%a?%-%a%a%-)(.+)$",
"^(%a%a%a?%-)(.+)$",
"^(Paris%-%-)(.+)$"
}
local patternsEntryLang = {
"^(.+)(%-fr%-Paris)$",
"^(.+)( FR%-Paris)$",
"^(.+)(%-fr%-ouest)$",
}
local output = ""
Řádek 178 ⟶ 177:
local fileName
local fileExtension
local langmatches
local entry
local value
Řádek 184 ⟶ 183:
if file ~== "" then
output = output .. "[[Kategorie:Monitoring:Audio/1/]]"
else
file = string.gsub( file, "_", " " )
Řádek 190 ⟶ 191:
fileName, fileExtension = string.match( file, "^(.+)%.([^%.]+)$" )
if not fileName then
output = output .. string.format( "[[Kategorie:Monitoring:Audio/1/?/%s]]", file )
else
local patterns = {
{ 2, "^([Ff]r%-Paris%-%-)(.+)$" },
{ 2, "^([Ff]r%-)(.+)( FR%-Paris)$" },
{ 2, "^([Ff]r%-)(.+)(%-fr%-Paris)$" },
{ 2, "^([Ff]r%-)(.+)(%-fr%-ouest)$" },
{ 2, "^(%a%a%a?%-%a%a%-)(.+)$" },
{ 2, "^(%a%a%a?%-)(.+)$", }
}
for _, pattern in ipairs( patternsLangEntrypatterns ) do
lang, entrymatches = { string.match( fileName, pattern[2] ) }
if langnext( matches ) ~= nil then
entry = matches[pattern[1]]
valueType = string.format( "%s⌂", lang )
matches[pattern[1]] = "⌂"
valueType = stringtable.formatconcat( "%s⌂", langmatches )
break
end
end
if not lang then
for _, pattern in ipairs( patternsEntryLang ) do
entry, lang = string.match( fileName, pattern )
if lang then
valueType = string.format( "⌂%s", lang )
break
end
end
end
entry = entry and entry or fileName
equalityType = getEqualityType( entry, title )
output = output .. string.format( "[[Kategorie:Monitoring:Audio/1/%s]]", equalityType )
if entry == title then
equalityType = "≡"
elseif mw.ustring.lower( entry ) == mw.ustring.lower( title ) then
equalityType = "≋"
else
equalityType = "≢"
end
output = output .. string.format( "[[Kategorie:Monitoring:Audio/1/⌂.%s]]", fileExtension )
Řádek 225 ⟶ 223:
output = output .. string.format( "[[Kategorie:Monitoring:Audio/1/%s]]", valueType )
end
output = output .. string.format( "[[Kategorie:Monitoring:Audio/1/%s]]", equalityType )
if equalityType == "≢" then
output = output .. string.format( "[[Kategorie:Monitoring:Audio/1/≢ */%s]]", entry )
end
else
output = output .. string.format( "[[Kategorie:Monitoring:Audio/1/?/%s]]", file )
end
else
output = output .. "[[Kategorie:Monitoring:Audio/1/]]"
end
if text ~== "" then
output = output .. "[[Kategorie:Monitoring:Audio/2/]]"
else
value, parentheses = string.match( text, "(.*) %(([^%)]+)%)$" )
if parentheses then
if valueequalityType == getEqualityType( value, title then)
equalityType = "≡"
elseif mw.ustring.lower( value ) == mw.ustring.lower( title ) then
equalityType = "≋"
else
equalityType = "≢"
end
valueType = string.format( "%s (%s)", equalityType, parentheses )
else
if textequalityType == getEqualityType( text, title then)
equalityType = "≡"
elseif mw.ustring.lower( text ) == mw.ustring.lower( title ) then
equalityType = "≋"
else
equalityType = "≢"
end
valueType = string.format( "%s *", equalityType )
end
Řádek 276 ⟶ 254:
output = output .. string.format( "[[Kategorie:Monitoring:Audio/2/≢ */%s]]", text )
end
else
output = output .. "[[Kategorie:Monitoring:Audio/2/]]"
end