public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Lua vs Python filters
@ 2020-04-20  9:07 Saša Janiška
       [not found] ` <20200420110708.269ec829-XQYBc/g6bIvul9oEyyxVyV6hYfS7NtTn@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Saša Janiška @ 2020-04-20  9:07 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Hello,

I'd like to write Tiki writer filter
(https://github.com/jgm/pandoc/issues/4825) and not being overly familiar with
either Lua or Python (although learning more Python* would probably provide
better investment of my time), I wonder which method is considered better
and/or easier Pandoc-wise? 


Sincerely,
Gour

* here I'm thinking about using e.g. Panflute

-- 
The working senses are superior to dull matter; mind is higher
than the senses; intelligence is still higher than the mind;
and he [the soul] is even higher than the intelligence.



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

* Re: Lua vs Python filters
       [not found] ` <20200420110708.269ec829-XQYBc/g6bIvul9oEyyxVyV6hYfS7NtTn@public.gmane.org>
@ 2020-05-14  8:17   ` Christophe Demko
  2020-05-14  9:39   ` Albert Krewinkel
  1 sibling, 0 replies; 3+ messages in thread
From: Christophe Demko @ 2020-05-14  8:17 UTC (permalink / raw)
  To: pandoc-discuss


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

If you choose python, panflute is a good choice

Le lundi 20 avril 2020 11:07:18 UTC+2, Saša Janiška a écrit :
>
> Hello, 
>
> I'd like to write Tiki writer filter 
> (https://github.com/jgm/pandoc/issues/4825) and not being overly familiar 
> with 
> either Lua or Python (although learning more Python* would probably 
> provide 
> better investment of my time), I wonder which method is considered better 
> and/or easier Pandoc-wise? 
>
>
> Sincerely, 
> Gour 
>
> * here I'm thinking about using e.g. Panflute 
>
> -- 
> The working senses are superior to dull matter; mind is higher 
> than the senses; intelligence is still higher than the mind; 
> and he [the soul] is even higher than the intelligence. 
>
>
>

-- 
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/e7d31a67-093f-42b0-be60-1ad0776e5d1c%40googlegroups.com.

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

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

* Re: Lua vs Python filters
       [not found] ` <20200420110708.269ec829-XQYBc/g6bIvul9oEyyxVyV6hYfS7NtTn@public.gmane.org>
  2020-05-14  8:17   ` Christophe Demko
@ 2020-05-14  9:39   ` Albert Krewinkel
  1 sibling, 0 replies; 3+ messages in thread
From: Albert Krewinkel @ 2020-05-14  9:39 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Hi,

Saša Janiška writes:
> I'd like to write Tiki writer filter
> (https://github.com/jgm/pandoc/issues/4825) and not being overly familiar with
> either Lua or Python (although learning more Python* would probably provide
> better investment of my time), I wonder which method is considered better
> and/or easier Pandoc-wise?

There may be a bit of a misunderstanding: for a custom writer, Lua is
the only option. Writers and filters both receive the internal document
representation ("the AST") as input, but filters only modify the
document. Writers on the other hand create a "flat" string in the
desired output format from the input.

The code of filters and writers looks similar, as both deal with the
same input structure. However, filter functions receive AST elements as
input, while writer functions receive plain strings.

So for a Tiki writer, I suggest to write the output of

    pandoc --print-default-data-file=sample.lua

to a file and modify it to suite your needs.

---

For completeness, here's a quick comparison of Lua and Python filters:

Lua

  * is built-in and doesn't require additional software,
  * may work better in combination with Windows (Python is less commonly
    installed on Windows), and
  * is generally faster due to the way it is integrated into pandoc.

Python

  * is widely used and has more learning resources available,
  * makes it easier to access parents and siblings of AST elements, and
  * may be a natural choice when doing machine learning or data
    science.

--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124

-- 
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/87d076kg81.fsf%40zeitkraut.de.


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

end of thread, other threads:[~2020-05-14  9:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-20  9:07 Lua vs Python filters Saša Janiška
     [not found] ` <20200420110708.269ec829-XQYBc/g6bIvul9oEyyxVyV6hYfS7NtTn@public.gmane.org>
2020-05-14  8:17   ` Christophe Demko
2020-05-14  9:39   ` Albert Krewinkel

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