public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* filter img="file.svg" to <object data="file.svg">
@ 2019-06-26 21:31 Nigel Magnay
       [not found] ` <3a3cda8b-e33d-4bb9-ab7e-8f53ab58ff61-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Nigel Magnay @ 2019-06-26 21:31 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1133 bytes --]

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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/3a3cda8b-e33d-4bb9-ab7e-8f53ab58ff61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 1797 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: filter img="file.svg" to <object data="file.svg">
       [not found] ` <3a3cda8b-e33d-4bb9-ab7e-8f53ab58ff61-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-06-27 15:18   ` niszet niszet
       [not found]     ` <6903cda7-24a2-4c8a-819e-8ee558b94c15-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: niszet niszet @ 2019-06-27 15:18 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2111 bytes --]

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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/6903cda7-24a2-4c8a-819e-8ee558b94c15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 3320 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: filter img="file.svg" to <object data="file.svg">
       [not found]     ` <6903cda7-24a2-4c8a-819e-8ee558b94c15-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-06-27 15:41       ` niszet niszet
       [not found]         ` <7567ff4b-a388-4720-9083-b1ab63017aab-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: niszet niszet @ 2019-06-27 15:41 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2761 bytes --]

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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.

[-- Attachment #1.2: Type: text/html, Size: 4399 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: filter img="file.svg" to <object data="file.svg">
       [not found]         ` <7567ff4b-a388-4720-9083-b1ab63017aab-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-06-27 15:48           ` Nigel Magnay
  0 siblings, 0 replies; 4+ messages in thread
From: Nigel Magnay @ 2019-06-27 15:48 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 3779 bytes --]

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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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
> <https://groups.google.com/d/msgid/pandoc-discuss/7567ff4b-a388-4720-9083-b1ab63017aab%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.

[-- Attachment #2: Type: text/html, Size: 6215 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-27 15:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-26 21:31 filter img="file.svg" to <object data="file.svg"> Nigel Magnay
     [not found] ` <3a3cda8b-e33d-4bb9-ab7e-8f53ab58ff61-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-06-27 15:18   ` niszet niszet
     [not found]     ` <6903cda7-24a2-4c8a-819e-8ee558b94c15-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-06-27 15:41       ` niszet niszet
     [not found]         ` <7567ff4b-a388-4720-9083-b1ab63017aab-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-06-27 15:48           ` Nigel Magnay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).