1337box.lua 526 B

12345678910111213141516
  1. function GetFileName(fullpath)
  2. extension = fullpath:match("[^.]*$")
  3. file = string.gsub(fullpath,"." .. extension,"_orig." .. extension)
  4. return file
  5. end
  6. -- Generate correct html syntax with path to image
  7. function make_lightbox (path)
  8. return '<img tabindex=1 src="' .. path .. '"/><img class="f" src="' .. GetFileName(path) .. '" onerror="this.onerror=null;this.src=\'' .. path .. '\'" />'
  9. end
  10. -- Identify all images and change format
  11. function Image (elem)
  12. return pandoc.RawInline('html', make_lightbox(elem.src))
  13. end