public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
To: Samuele Pilleri
	<pillerisamuele-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	pandoc-discuss
	<pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Thoughts trying to write a Lua filter
Date: Sun, 19 Aug 2018 11:40:25 -0700	[thread overview]
Message-ID: <m2wosm5heu.fsf@johnmacfarlane.net> (raw)
In-Reply-To: <6e09bd71-ee77-4de7-a002-953a62325234-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>

Samuele Pilleri <pillerisamuele-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> However, PANDOC_READER_OPTIONS doesn't provide --dpi such option. I think 
> it would be cool if Pandoc could handle it itself *before* calling the 
> writers, or at least provide a conversion function within the API.

You don't say why this would be useful in your case --
could you elaborate?

> I suppose it could be a bug, or maybe LaTeX doesn't support underline 
> within the context of a caption.

LaTeX writer doesn't currently support underline spans
at all.  In fact, only the docx writer has special
support for them.  (In HTML, you get the span, which
you could style yourself.)

We could think about adding underline support more
widely, but I'm reluctant to do that unless we add Underline
as a proper INline constructor.  Some discussion here:
https://groups.google.com/d/topic/pandoc-discuss/o98bsCVZ-2w/discussion

> However I think some clarification is 
> needed and the AST passed to Lua should be revised as well since it's 
> pretty a mess:
>
> ![[caption]{.underline}](image.png)
> 1:
>   c:
>     1:
>       1:
>       2:
>         1: underline
>       3:
>     2:
>       1:
>         c: caption
>
> ![caption](image.png)
> 1:
>   c: caption
>
> ![*caption*](image.png)
> 1:
>   c:
>     1:
>       c: caption
>
> (*): these tables refer to el.c[2] only

If the question is why the lua table serialization is
not more "human readable," Albert Krewinkel might be able
to say more. But it's basically isomorphic to the JSON
representation.

Note: You shouldn't need to deal with this manually; use the
functions provided by pandoc to retrieve attributes
and such.

> Also, I couldn't find any good documentation on parameter's fields (at 
> least for images) and it took me a couple of hours to understand it. I 
> would add something like this to the docs:
>
> -- Creates an image identical to the one given
> function Image (el)
>     local id, classes, attrs = unpack(el.c[1])
>     local caption = el.c[2]
>     local src, title = unpack(el.c[3])

Here you can just do:

   local id = el.identifier
   local classes = el.classes
   local attrs = el.attributes
   local caption = el.caption

But I don't think these shortcuts have been properly
documented. I only know about them from looking at
examples. (@tarleb, can you add something to the docs
on this?)

I can imagine it was difficult to figure this out
without knowing about these shortcuts!


  parent reply	other threads:[~2018-08-19 18:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-17 17:42 Samuele Pilleri
     [not found] ` <6e09bd71-ee77-4de7-a002-953a62325234-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-08-19 18:40   ` John MacFarlane [this message]
     [not found]     ` <m2wosm5heu.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2018-08-20 19:47       ` Samuele Pilleri
     [not found]         ` <9da35dc5-3eec-446b-8464-889ec1eb26f4-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-09-17 16:08           ` EBkysko

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=m2wosm5heu.fsf@johnmacfarlane.net \
    --to=jgm-tvlzxgkolnx2fbvcvol8/a@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=pillerisamuele-Re5JQEeQqe8AvxtiuMwx3w@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).