Revision 0f2e977af415a52dd8dd51a8d1b3e08b65336af2 authored by alex@thinkpad on 03 March 2017, 17:48:02 UTC, committed by alex@thinkpad on 03 March 2017, 17:48:02 UTC
1 parent eaa8ca8
showlink.lua
function ShowLink(addr, name)
newname = name
if string.find(addr, "Video") then
return -- don't show videos
elseif string.find(addr, "Image") then
return -- don't show sample images
elseif string.find(addr, "magiclantern.wikia.com") and not string.find(name, "here") then
name = string.gsub(name, [[#]], [[\#]])
newname = "" .. name
elseif not string.find(addr, "amzn") and not string.find(addr, "sescom") then
-- escape TeX special characters and strip HTTP
local a = addr
a = string.gsub(a, [[http://]], [[]])
a = string.gsub(a, [[https://]], [[]])
a = string.gsub(a, [[&]], [[\&]])
a = string.gsub(a, [[_]], [[\_]])
a = string.gsub(a, [[#]], [[\#]])
a = string.gsub(a, [[%%]], [[\%%]])
a = string.gsub(a, [[/]], [[/\phantom{-}\hskip-1ex]])
newname = newname .. [[{ \scriptsize \textlangle ]] .. a .. [[\textrangle }]]
end
tex.print([[\oldhref{]] .. addr .. [[}{]] .. newname .. [[}]])
end
Computing file changes ...