public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Felix SOEDJEDE <soefelix-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Pandoc 2.18 - Custom writer working example
Date: Wed, 1 Jun 2022 16:01:26 -0700 (PDT)	[thread overview]
Message-ID: <8528d41a-d6dd-4ca7-b38a-13955a9d1eabn@googlegroups.com> (raw)


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

Hello everyone,

In Pandoc 2.18, custom writers were added: 
https://pandoc.org/custom-writers.html#new-style

I tried to use it but it's not working and I don't know if it's an error or 
I'm using it the wrong way.

I have a lua filter
--
PANDOC_VERSION:must_be_at_least '2.18'
print(PANDOC_DOCUMENT)
function Writer(doc, opts)
print('We enter don\'t enter "Writer"')
return pandoc.write(doc, 'markdown', opts)
end

function Doc(body, meta, vars)
print('We enter don\'t enter "Doc"')
vars.date = vars.date or meta.data or os.date '%B %e, %Y'
return body, vars
end

function Pandoc(doc)
print('We enter "Pandoc"')
end

function Header(header)
print('We enter "Header"')
end
--
Command used "pandoc --standalone --verbose --lua-filter=sample.lua 
--output=output.md sample.md"

   - None of *Doc*, *Writer* is called.
   

   - "print(PANDOC_DOCUMENT)" returns "nil"
   

Some links
- https://github.com/jgm/pandoc/pull/7897 (The MR to see "Writer" was 
implemented)
- https://gist.github.com/tarleb/5a9c3fbfa47b0e6d3643efd8af2994b9 : exemple 
filter I tested but not working
- https://groups.google.com/g/pandoc-discuss/c/Ti4Qsehn1Z8/m/Btu_uE6IBwAJ: 
Question asked but another person before the fonctionnality was released. 
It does not contains an answer to my question

Question:
Does anyone have a minimal working example for "Doc" or "Writer" I could 
use?

Regards


-- 
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/8528d41a-d6dd-4ca7-b38a-13955a9d1eabn%40googlegroups.com.

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

             reply	other threads:[~2022-06-01 23:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01 23:01 Felix SOEDJEDE [this message]
     [not found] ` <8528d41a-d6dd-4ca7-b38a-13955a9d1eabn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-06-02  5:27   ` Albert Krewinkel
     [not found]     ` <87fskn6345.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2022-06-02  8:10       ` Felix SOEDJEDE
     [not found]         ` <cde6d369-8813-41ed-a1ea-253901014b46n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-06-02  8:43           ` Albert Krewinkel
     [not found]             ` <87bkvb5tay.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2022-06-02 14:40               ` Felix SOEDJEDE
     [not found]                 ` <56920de7-922c-4491-86ee-c981beb37b78n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-06-02 16:40                   ` Albert Krewinkel
     [not found]                     ` <87tu933tb0.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2022-06-03  7:31                       ` Felix SOEDJEDE

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8528d41a-d6dd-4ca7-b38a-13955a9d1eabn@googlegroups.com \
    --to=soefelix-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).