public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* pandocfilters: return(Emph(Str(value)) not working
@ 2020-12-14 17:13 Stephan Boltzmann
       [not found] ` <e6346e7e-ab9b-4df9-9bec-88bec98fcd93n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Stephan Boltzmann @ 2020-12-14 17:13 UTC (permalink / raw)
  To: pandoc-discuss


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

Which additional diagnostics could I run to pin down the problem with the 
following filter:

#!/usr/bin/env python
from pandocfilters import toJSONFilter, Str, Emph
def change(key, value, format, meta):
  if format == 'odt':
    if key == 'Str' and value == 'and':
      return(Emph(Str(value)))
if __name__ == "__main__":
  toJSONFilter(change)

Using "pandoc -o text.odt --filter filter.py text.md" gives me the error 
message:

Error running filter filter.py:
Error in $.blocks[0].c[2].c: expected [a], encountered Object

-- 
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/e6346e7e-ab9b-4df9-9bec-88bec98fcd93n%40googlegroups.com.

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

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

* Re: pandocfilters: return(Emph(Str(value)) not working
       [not found] ` <e6346e7e-ab9b-4df9-9bec-88bec98fcd93n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2020-12-14 17:51   ` John MacFarlane
       [not found]     ` <m2k0tkz36n.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: John MacFarlane @ 2020-12-14 17:51 UTC (permalink / raw)
  To: Stephan Boltzmann, pandoc-discuss


Should Emph perhaps take a list on inlines as argument?

Emph([Str(value)])

Stephan Boltzmann <stephan2boltzmann-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Which additional diagnostics could I run to pin down the problem with the 
> following filter:
>
> #!/usr/bin/env python
> from pandocfilters import toJSONFilter, Str, Emph
> def change(key, value, format, meta):
>   if format == 'odt':
>     if key == 'Str' and value == 'and':
>       return(Emph(Str(value)))
> if __name__ == "__main__":
>   toJSONFilter(change)
>
> Using "pandoc -o text.odt --filter filter.py text.md" gives me the error 
> message:
>
> Error running filter filter.py:
> Error in $.blocks[0].c[2].c: expected [a], encountered Object
>
> -- 
> 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/e6346e7e-ab9b-4df9-9bec-88bec98fcd93n%40googlegroups.com.


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

* Re: pandocfilters: return(Emph(Str(value)) not working
       [not found]     ` <m2k0tkz36n.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
@ 2020-12-14 18:41       ` Stephan Boltzmann
  0 siblings, 0 replies; 3+ messages in thread
From: Stephan Boltzmann @ 2020-12-14 18:41 UTC (permalink / raw)
  To: pandoc-discuss


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

Thanks a lot! This solves my problem.
(I was sure to have tried a list as an argument and switched computers in 
between. This works on Ubuntu 18.04.)

John MacFarlane schrieb am Montag, 14. Dezember 2020 um 18:51:46 UTC+1:

>
> Should Emph perhaps take a list on inlines as argument?
>
> Emph([Str(value)])
>
> Stephan Boltzmann <stephan2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > Which additional diagnostics could I run to pin down the problem with 
> the 
> > following filter:
> >
> > #!/usr/bin/env python
> > from pandocfilters import toJSONFilter, Str, Emph
> > def change(key, value, format, meta):
> > if format == 'odt':
> > if key == 'Str' and value == 'and':
> > return(Emph(Str(value)))
> > if __name__ == "__main__":
> > toJSONFilter(change)
> >
> > Using "pandoc -o text.odt --filter filter.py text.md" gives me the error 
> > message:
> >
> > Error running filter filter.py:
> > Error in $.blocks[0].c[2].c: expected [a], encountered Object
> >
> > -- 
> > 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pandoc-discuss/e6346e7e-ab9b-4df9-9bec-88bec98fcd93n%40googlegroups.com
> .
>

-- 
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/15241f4c-5799-4ee7-bb10-81bb2fb4ab8fn%40googlegroups.com.

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

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

end of thread, other threads:[~2020-12-14 18:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-14 17:13 pandocfilters: return(Emph(Str(value)) not working Stephan Boltzmann
     [not found] ` <e6346e7e-ab9b-4df9-9bec-88bec98fcd93n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-12-14 17:51   ` John MacFarlane
     [not found]     ` <m2k0tkz36n.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
2020-12-14 18:41       ` Stephan Boltzmann

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