That works perfectly.

Thanks ever so much!


On Thu, Jun 27, 2019 at 4:41 PM niszet niszet <niszet0016-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hi Nigel-san,

Sorry, I found more simple way to convert. Previous version has a limitation of use (only one <img> in <p> tag).

Updated version is,

```lua
function Image(e)
  if string.match(e.src, "svg$") then
    return(pandoc.RawInline("html", '<object data="' .. e.src .. '"></object>'))
  end
end
```

and then you will get,

```html
<p><object data="plantuml-images/9d8236ccdf925ce21eb481c9b4f6da4e7cb52ae1.svg"></object></p>
```

as an output.

niszet

2019年6月28日金曜日 0時18分30秒 UTC+9 niszet niszet:
Hi Nigel-san,

I wrote a simple example of lua filter as following (to use, save as img2svg.lua).

```
function Para(e)
  for k,v in pairs(e.content) do
    if v.tag == "Image" then
      if string.match(v.src, "svg$") then
        return(pandoc.Para(pandoc.RawInline("html", '<object data="' .. v.src .. '"></object>')))
      end
    end
  end
end
```

If you input following markdown file of input.md,

```
![](plantuml-images/9d8236ccdf925ce21eb481c9b4f6da4e7cb52ae1.svg)

```

and then convert by `pandoc -f markdown input.md -t html output.html --lua-filter img2svg.lua`. Then you can get

```
<p><object data="plantuml-images/9d8236ccdf925ce21eb481c9b4f6da4e7cb52ae1.svg"></object></p>
```

as an output of output.html.(in your example, file name is different but I think it is typo.)

niszet


2019年6月27日木曜日 6時31分17秒 UTC+9 Nigel Magnay:
Hi -

This has been created as an issue before, but sadly the gist is no longer available.

I use the plantuml filter to render diagrams to svg. This works, but the hyperlinks in the svg are inoperable because the SVG is included as
<p><img src="plantuml-images/9d8236ccdf925ce21eb481c9b4f6da4e7cb52ae1.svg" /></p>

When it needs to be something like

<p><object data="plantuml-images/d3750ee9e6613d2f461ba5905d7909460bd02f25.svg"></object></p>

What's my easiest route to fixing this (and/or is there an example that's close I could modify) ?

TIA,
Nigel

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/7567ff4b-a388-4720-9083-b1ab63017aab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAPYP83T4H7Ca45HxU7VJgLseN4aZPQv8APxWwT_JebzE51p0VQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.