* Writing inside a Lua filter
@ 2021-02-08 12:36 Thomas Hodgson
[not found] ` <c242bb76-13f9-4b50-8650-55f2e66fdd5dn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Hodgson @ 2021-02-08 12:36 UTC (permalink / raw)
To: pandoc-discuss
[-- Attachment #1.1: Type: text/plain, Size: 1079 bytes --]
I am wondering what the best way to write a string in different formats as
part of a Lua filter is.
For example, a block might have an attribute called 'label' which is a
Markdown string, e.g., 'An *emphasised* idea'. I could use `pandoc.read` to
turn that into a Document object. Can I turn the Document object into,
e.g., a string which is HTML? I'm thinking of a 'write' function which
corresponds to read.
The solution that occurred to me is to use `pandoc.pipe` and pass the
string to Pandoc, like so: `pandoc.pipe("pandoc", {"--to", "html"}, label)`
('label' is assigned a string). I get '<p>An <em>emphasised</em> idea</p>'.
Is that a good approach?
--
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/c242bb76-13f9-4b50-8650-55f2e66fdd5dn%40googlegroups.com.
[-- Attachment #1.2: Type: text/html, Size: 1450 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Writing inside a Lua filter
[not found] ` <c242bb76-13f9-4b50-8650-55f2e66fdd5dn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-02-08 18:14 ` John MacFarlane
0 siblings, 0 replies; 2+ messages in thread
From: John MacFarlane @ 2021-02-08 18:14 UTC (permalink / raw)
To: Thomas Hodgson, pandoc-discuss
Thomas Hodgson <thomas.hodgson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
> I am wondering what the best way to write a string in different formats as
> part of a Lua filter is.
>
> For example, a block might have an attribute called 'label' which is a
> Markdown string, e.g., 'An *emphasised* idea'. I could use `pandoc.read` to
> turn that into a Document object. Can I turn the Document object into,
> e.g., a string which is HTML? I'm thinking of a 'write' function which
> corresponds to read.
>
> The solution that occurred to me is to use `pandoc.pipe` and pass the
> string to Pandoc, like so: `pandoc.pipe("pandoc", {"--to", "html"}, label)`
> ('label' is assigned a string). I get '<p>An <em>emphasised</em> idea</p>'.
> Is that a good approach?
That's probably the best you can do for now.
We don't export writers for Lua.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-08 18:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08 12:36 Writing inside a Lua filter Thomas Hodgson
[not found] ` <c242bb76-13f9-4b50-8650-55f2e66fdd5dn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-02-08 18:14 ` John MacFarlane
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).