Modulo:Collegamenti esterni: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m messaggio più preciso |
ottimizzo e riduco possibilità errori se si compila male il parametro template nella configurazione |
||
Riga 367:
local cfg = readConfig()
local lang = mw.language.getContentLanguage()
local pageContent,
:gsub('<!%-%-.-%-%->', '')▼
:gsub('<[Rr][Ee][Ff]%s.-/>', '') -- facilita la ricerca successiva▼
:gsub('<[Rr][Ee][Ff].->.-</[Rr][Ee][Ff]%s*>', '')▼
local loadedEntities = setmetatable({}, {
__newindex = function(t1, key, t2)
Riga 376 ⟶ 373:
for k, v in pairs(t2) do rawset(t1, k, v) end
end })
local preview = mw.getCurrentFrame():preprocess('{{REVISIONID}}') == ''▼
local section = pageContent:match('^=+[^=\n]+=+ *\n')▼
local duplicates = false -- per categoria temporanea
for _, groupName in ipairs(orderedGroupNames) do -- per ogni gruppo tematico
Riga 423 ⟶ 418:
-- controlla che il link non sia generato da altri template in voce
if valido and linkConf.template then
first_char = string.format('[%s%s]', first_char:upper(), first_char:lower())▼
▲ :gsub('<!%-%-.-%-%->', '')
valido, duplicates = preview, true▼
▲ :gsub('<[Rr][Ee][Ff]%s.-/>', '') -- facilita la ricerca successiva
▲ if preview then
▲ :gsub('<[Rr][Ee][Ff].->.-</[Rr][Ee][Ff]%s*>', '')
previewMsg = mw.message.newRawMessage(tmpFound, template):plain()▼
end▼
for template in mw.text.gsplit(templateList, ',') do
template = template:gsub(' +', ' +')
local firstChar = template:match('^.')
▲
if pageContent:match('{{%s*' .. template:gsub('^.', firstChar) .. '%s*[|}]') then
if isPreview then
▲ previewMsg = mw.message.newRawMessage(tmpFound, template):plain()
break
end
end
if isSection == nil then
end
if isSection then
templateList = templateList:gsub(',', ', ')
end
▲ break
end
▲ end
▲ if section and not previewMsg then
▲ previewMsg = mw.message.newRawMessage(tmpSection, linkConf.template):plain()
end
end
|