public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Finding out the filename of a path with pandoc
@ 2021-08-11 11:01 ch_...-S0/GAf8tV78@public.gmane.org
       [not found] ` <b953bc0c-3b12-48bb-88b3-4c22be661458n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: ch_...-S0/GAf8tV78@public.gmane.org @ 2021-08-11 11:01 UTC (permalink / raw)
  To: pandoc-discuss


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


Hi

I try to find out the filename of a path in a lua filter with

    function Image(img)
        p = pandoc.path.filename(img.src)
        print(img.src, p)
        return nil
    end 

but I get an error

Error running filter dark_images.lua:
dark_images.lua:45: attempt to index a nil value (field 'path')
stack traceback:
    dark_images.lua:45: in function 'Image'

I'm using the newest pandoc 2.14.1, precompiled deb from github

-- 
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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/b953bc0c-3b12-48bb-88b3-4c22be661458n%40googlegroups.com.

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

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

* Re: Finding out the filename of a path with pandoc
       [not found] ` <b953bc0c-3b12-48bb-88b3-4c22be661458n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-08-11 11:39   ` Bastien DUMONT
  2021-08-11 14:40     ` ch_...-S0/GAf8tV78@public.gmane.org
  0 siblings, 1 reply; 3+ messages in thread
From: Bastien DUMONT @ 2021-08-11 11:39 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

For some reason, you have to load the module explicitely, so:

```
local path = require 'pandoc.path'

function Image(img)
    p = path.filename(img.src)
    print(img.src, p)
    return nil
end
```

Le Wednesday 11 August 2021 à 04:01:37AM, ch_...-S0/GAf8tV78@public.gmane.org a écrit :
> 
> Hi
> 
> I try to find out the filename of a path in a lua filter with
> 
>     function Image(img)
>         p = pandoc.path.filename(img.src)
>         print(img.src, p)
>         return nil
>     end
> 
> but I get an error
> 
> Error running filter dark_images.lua:
> dark_images.lua:45: attempt to index a nil value (field 'path')
> stack traceback:
>     dark_images.lua:45: in function 'Image'
> 
> I'm using the newest pandoc 2.14.1, precompiled deb from github
> 
> --
> 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 [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit [2]https://groups.google.com/d/msgid/
> pandoc-discuss/b953bc0c-3b12-48bb-88b3-4c22be661458n%40googlegroups.com.
> 
> References:
> 
> [1] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [2] https://groups.google.com/d/msgid/pandoc-discuss/b953bc0c-3b12-48bb-88b3-4c22be661458n%40googlegroups.com?utm_medium=email&utm_source=footer

-- 
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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/YRO23IrxpfehM9Ri%40localhost.


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

* Re: Finding out the filename of a path with pandoc
  2021-08-11 11:39   ` Bastien DUMONT
@ 2021-08-11 14:40     ` ch_...-S0/GAf8tV78@public.gmane.org
  0 siblings, 0 replies; 3+ messages in thread
From: ch_...-S0/GAf8tV78@public.gmane.org @ 2021-08-11 14:40 UTC (permalink / raw)
  To: pandoc-discuss


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

thank you very much!

Bastien Dumont schrieb am Mittwoch, 11. August 2021 um 13:40:06 UTC+2:

> For some reason, you have to load the module explicitely, so:
>
> ```
> local path = require 'pandoc.path'
>
> function Image(img)
> p = path.filename(img.src)
> print(img.src, p)
> return nil
> end
> ```
>
> Le Wednesday 11 August 2021 à 04:01:37AM, ch_...-S0/GAf8tV78@public.gmane.org a écrit :
> > 
> > Hi
> > 
> > I try to find out the filename of a path in a lua filter with
> > 
> > function Image(img)
> > p = pandoc.path.filename(img.src)
> > print(img.src, p)
> > return nil
> > end
> > 
> > but I get an error
> > 
> > Error running filter dark_images.lua:
> > dark_images.lua:45: attempt to index a nil value (field 'path')
> > stack traceback:
> > dark_images.lua:45: in function 'Image'
> > 
> > I'm using the newest pandoc 2.14.1, precompiled deb from github
> > 
> > --
> > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To view this discussion on the web visit [2]
> https://groups.google.com/d/msgid/
> > pandoc-discuss/b953bc0c-3b12-48bb-88b3-4c22be661458n%40googlegroups.com.
> > 
> > References:
> > 
> > [1] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> > [2] 
> https://groups.google.com/d/msgid/pandoc-discuss/b953bc0c-3b12-48bb-88b3-4c22be661458n%40googlegroups.com?utm_medium=email&utm_source=footer
>
>

-- 
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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/fdc03efb-3207-41af-abb1-a0833d4df581n%40googlegroups.com.

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

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

end of thread, other threads:[~2021-08-11 14:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 11:01 Finding out the filename of a path with pandoc ch_...-S0/GAf8tV78@public.gmane.org
     [not found] ` <b953bc0c-3b12-48bb-88b3-4c22be661458n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-11 11:39   ` Bastien DUMONT
2021-08-11 14:40     ` ch_...-S0/GAf8tV78@public.gmane.org

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).