From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/20815 Path: news.gmane.org!.POSTED!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: Thoughts trying to write a Lua filter Date: Sun, 19 Aug 2018 11:40:25 -0700 Message-ID: References: <6e09bd71-ee77-4de7-a002-953a62325234@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1534703914 28157 195.159.176.226 (19 Aug 2018 18:38:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 19 Aug 2018 18:38:34 +0000 (UTC) To: Samuele Pilleri , pandoc-discuss Original-X-From: pandoc-discuss+bncBCJZJHG45QDBBJ7T43NQKGQEZXELKAA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Aug 19 20:38:29 2018 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-oi0-f55.google.com ([209.85.218.55]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frSar-0007Dh-JX for gtp-pandoc-discuss@m.gmane.org; Sun, 19 Aug 2018 20:38:29 +0200 Original-Received: by mail-oi0-f55.google.com with SMTP id v4-v6sf12239334oix.2 for ; Sun, 19 Aug 2018 11:40:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1534704040; cv=pass; d=google.com; s=arc-20160816; b=020gY2rcKJAW4xVq3BhWtQ5MssbCVkjey1SB4nq6xQMcjWUgo5eLb0ZQp1M1abJDMj mIh7v6q4g39qA4YEK8Uc/pTRHyrEXBfpR/gm00zqgcF8LlwEa8qZwfHpMajmuyTUp2ty bmP26HZqewXRjarmxevXs4rnemPb2zeCGpNitLUcrClnUPaeyg1DrjZi5D7AH7fDmxma ODChu4vzltjXOb2SWdc6cLzFkeULyS7/EueUU1NOKyJ8JWlYhZW81xK0EWOih1KXFUhF 9v9BPIFxbYgzdrsb0Ub450KZNo7xUmB68oTFW0QNEmiYEW1aBhJHDtWYG0jS26AIo/KA QGLw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:mime-version:message-id :date:references:in-reply-to:subject:to:from :arc-authentication-results:arc-message-signature:sender :dkim-signature:arc-authentication-results; bh=Rh1B3gdpXoJ0suhjWsWqPDLsgqDv5GAZC83fG2kj7ic=; b=vvXTqIprSe3VpyJKb33pBAxbf/0IY4j/o4IUmyq5YC1Iicnpi8Kr8sRNVbp7pkRTnE Ux607/HHqL0WmqCb3U5QMI2c5zL1iHPtZj/oGwlZZYvkdy6sXsfQeSAh0Veou8WwJROd YNjhdVuYvjX7J+H3DeXY2r+Uig3nBz5ZLuZv8iwSo0TDS8poIwf3vj2MHhWZvxE3BuDz 4HcNzunjONgxS98S+05VHfJGhtkCABO1n73j3gTSo9S1zaJBhOSVc0tP2iWf0Tf8je1z G34d1Bp3iKBo7pLrzv4dQmn6An4GwVC6p9v/hf8v2H2eIT0hMW8c4nqgcO1ZTklQ8bpx 7s4w== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=Q8s8ugvz; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c01::231 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:subject:in-reply-to:references:date:message-id :mime-version:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=Rh1B3gdpXoJ0suhjWsWqPDLsgqDv5GAZC83fG2kj7ic=; b=h6OirIOkr3IcXpEKyCr68vRuDKNdPV7tACa/WR8xghMH1uoX+Pa/oKBwzcxCNPB7ft /LJ8ImAZX7fQh770AULYNsspIkNbevfEl26rjyv7R9vY6KDdxphhQusJdyUOyY7bCrb5 C4NIviTtkj4Q6HV+3H02hFEvGfUKeCehOtEEylfXhM3+pnTxoOmX325VZQo581KuGLm+ 5vZ0iDB+QX94liRzCeIv8bsthvDZBCz7k7PSFn/hJq1DH3H5vz13fhAEpd2bRT8AiSKF upHjNPBT647WFIMH/saQ+FSNkay6jTTPa2qfDfbidu18PyYybpYw9rHKOWtTCFWIuXWf 5CcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:subject:in-reply-to:references :date:message-id:mime-version:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=Rh1B3gdpXoJ0suhjWsWqPDLsgqDv5GAZC83fG2kj7ic=; b=GKL3yq5SWINEtSngD83M8KFAx4EE3GfhRDQnL0qoRhxhx+0F0qMp8RUVAPB+5UIFJC fAPHurVgQGbYsApzne2oDg58423B021HkyGApeeAcGD258OONWW4BEOmW7Qyt9fIGKBf VsCQRXT/iHz/6qFYvl805H5VWwri9dpoZ0z5F0wsjySGmuDreHq+u/2h3riVGFuyWttp niODXQAOdFUv0uYuked5z9bRI3EV8/btvjLiso+sS64go6v64ylnVtYTZHZo4qF02VdV yZtG3GDQfkjRNy4abTU+8Cs0l94U14zdld7T+m8kcn7WveMNnbkYEc4XsoB+lv+NgC+O F04A== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOUpUlED55RLJxeBYqAaFf8apvyJZFDwZFxbj/5JTFfWPAEvyuAZobFl g8bx0lAhJEeQN20J9S7J27Q= X-Google-Smtp-Source: AA+uWPzyX7uf3XrJRq/C1K54DudZBuC/7SAj4sD/tRS+VgUGB1wqthae8HYSvakdlDhd20C4sUJbDA== X-Received: by 2002:aca:eb15:: with SMTP id j21-v6mr1012744oih.6.1534704040003; Sun, 19 Aug 2018 11:40:40 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:aca:2819:: with SMTP id 25-v6ls1641203oix.23.gmail; Sun, 19 Aug 2018 11:40:39 -0700 (PDT) X-Received: by 2002:aca:c395:: with SMTP id t143-v6mr28596125oif.8.1534704039211; Sun, 19 Aug 2018 11:40:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534704039; cv=none; d=google.com; s=arc-20160816; b=ahzDIyVEIdceX2WxYCL1dPYuOVn0Ox0LhG6W9mYe4piXP9ZfZvBk1o6MjP++8HI8Pd xOA1hBAPBdikL3ZuskrwVYwHvFauGrFfJu+pThFacZ3BXcY/9xLqmDBKwI398chuqo1e B3t4lbh7FKj3ib/vr48xLS42l6gA/3ALxAig3RMadOI+fUaV4Wn4rjG7apVy9LrvG4fE uRancCIwQGCGfQzqYiEVKoAv6YkzxXsXnFfp66CGFZ9AM//y9ry7qPyF+5tlijOhS3L5 eOVtalQELDATMra1asSgN3cxeJ4x0rJIu1s3gIgR1MgqqxzmvViwRRHolFKVY+JIQQ9+ hlfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :dkim-signature:arc-authentication-results; bh=YLsIDT9ohhjAs21k/Chrp9LpqHuZOLL7FOiWsxZhSmk=; b=sRlsZqTy4cXYmCwwsAzFnbTc871W3xt71Z6YUWJOkpZybTV2Qlpk0W2uBf6x3erTvU hfHmNvrJd6wG0aPMUOiB7h2jaR2buQYfGrp1cXaQ/fc7Qgxm52FhHK9cvBeNKE1V8WBh kUBPnZ9XsaqZRLzjaQR3Of6ABV7s8+aLK2Nf2a0s2EnkCKZL7TBNfO4yh5tDQltvxmGC C8yyyfSnG2OAlWJA4+6cpZIbWQ5K15lA4u40TVYRooG111oN2Qyu3P3GAz8PZlIhb4WS ME6vW1I/VUHpQnUGJuDS2b2mCM1rjDXIkkKoyv3huCZe558CVQWNS9Pbbfqgi6EsLG0+ BlDw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=Q8s8ugvz; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c01::231 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Original-Received: from mail-pl0-x231.google.com (mail-pl0-x231.google.com. [2607:f8b0:400e:c01::231]) by gmr-mx.google.com with ESMTPS id j13-v6si289582oiw.4.2018.08.19.11.40.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Aug 2018 11:40:39 -0700 (PDT) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c01::231 as permitted sender) client-ip=2607:f8b0:400e:c01::231; Original-Received: by mail-pl0-x231.google.com with SMTP id f6-v6so5998681plo.1 for ; Sun, 19 Aug 2018 11:40:39 -0700 (PDT) X-Received: by 2002:a17:902:16a4:: with SMTP id h33-v6mr30677513plh.156.1534704038521; Sun, 19 Aug 2018 11:40:38 -0700 (PDT) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by smtp.gmail.com with ESMTPSA id g5-v6sm9379308pfh.63.2018.08.19.11.40.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 19 Aug 2018 11:40:37 -0700 (PDT) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id 5E52AA15F; Sun, 19 Aug 2018 14:40:26 -0400 (EDT) In-Reply-To: <6e09bd71-ee77-4de7-a002-953a62325234-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=Q8s8ugvz; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c01::231 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Spam-Checked-In-Group: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:20815 Archived-At: Samuele Pilleri 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!