« Module:Weblink » : différence entre les versions

De Lagny-sur-Marne Wiki
Aller à la navigation Aller à la recherche
0x010D (discussion | contributions)
Aucun résumé des modifications
0x010D (discussion | contributions)
Aucun résumé des modifications
Ligne 6 : Ligne 6 :
end
end
if not showntext then
if not showntext then
showntext = string.gsub( url, '(http://', 'https://)', '')  
showntext = string.gsub( url, '(http://|https://)', '')  
end
end
return '[' .. url ..  ' ' ..  showntext .. ']'
return '[' .. url ..  ' ' ..  showntext .. ']'

Version du 1 octobre 2014 à 21:28

local p = {}

function p.makelink(url, showntext) if not url then return nil end if not showntext then showntext = string.gsub( url, '(http://%7Chttps://)', ) end return '[' .. url .. ' ' .. showntext .. ']' end

function p.makelinks(stringlist, separator) if not type(stringlist) == table then return error('stringlist should be table') end if not separator then separator = '
' end for i, j in pairs(stringlist) do stringlist[i] = p.makelink(k) return table.concat(stringlist, separator ) end end

return p