From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/26313 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: William Lupton Newsgroups: gmane.text.pandoc Subject: Re: Custom lua writers and standalone documents Date: Sun, 4 Oct 2020 16:54:41 +0100 Message-ID: References: <66e3e0f4-a77c-4ff6-b71e-68182d95ac2an@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000a5ef3805b0da62a6" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33542"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pandoc-discuss To: John MacFarlane Original-X-From: pandoc-discuss+bncBCS4HJ6WSAHBBSHA475QKGQE67IFHKA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Oct 04 17:54:52 2020 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-wr1-f60.google.com ([209.85.221.60]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kP6Lc-0008dL-AJ for gtp-pandoc-discuss@m.gmane-mx.org; Sun, 04 Oct 2020 17:54:52 +0200 Original-Received: by mail-wr1-f60.google.com with SMTP id y3sf3007310wrl.21 for ; Sun, 04 Oct 2020 08:54:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1601826892; cv=pass; d=google.com; s=arc-20160816; b=xLx68VVRtw2/g///fkdhvF8F145v8OBDhQ+RexIiPuwwcGXd29EVLomr+/mtfhKRI5 SZ9j8xvwhTgh1fMPR23uMzPuHPwIKt2Jid9nbUnR8tpRrT+XKYlG/XLDJ270Mr9WD+yL SdHDv+Ev7TA/7pSXlcY6vPGQ56vAYg36iIlB1IJUn+nfolhGsa3dNpxhQzbclifJp1ZW 4SDoX6NdTNHauk6zAAHnxolUHJM2hRyGFVMs1/xo/POUVTQpKY4Rkog8kqZpFWadMVgl uCe0bDr2xNqgZ/2cFQvGulvMz9S9XX6M/CgU8wWfy501ZHxQ8ewbtCycnDoS3uIVM9oN A6sQ== 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:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:sender:dkim-signature; bh=Drzd8gaM0YemSioigXVoZrdAjVMfx4BLg8U6TvKhuBY=; b=ZzmE7edfQ5CofY0lW/5mnP0UxqYikn/NS5EPkofjxH9EEZdbkjVZsjvlQ1MhIpsTHp hfQ+E4Yhg+uwWaEH1jppzxiyouhBNtUdLjKwbWJaswq/BK/Lm/F7F9vHw3lU2KEr6Qpr uqsdYwWFfeCgylbqKqH5XHTWVTfpp8ghAeS6grg8EaU2xYmfC5NvG263kSFegOS6AJ5X fas/3LzNQZ9whCKdmTblrp998KTAg8UezjTq6o9NMD1dDhn8DwvjreBSBjl9AYGYWRPX GtqNIMTnAaSz7Q9LmaoaqTZnrMlpRk2u9oO6LVEGy5smDqpSpf6SSWkAbwHDP7SxE0J3 DN2w== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@broadband-forum-org.20150623.gappssmtp.com header.s=20150623 header.b=W0rRgmbc; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::52c as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:references:in-reply-to:from:date:message-id :subject:to:cc: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=Drzd8gaM0YemSioigXVoZrdAjVMfx4BLg8U6TvKhuBY=; b=M4e0gwBbcHC59/pd2cV16WRxbgF/RbsQTufeFeif0lDJsUahfIrkFFLpwr7IDT2JDz L0YTTGJTGhIBQc91orunVmLjlUhp0lQab0jfDSP5ZCWp2JiTwVFef18l93mgB/EjhvX8 bWC+7j2xHfUwGMzgDD7pRRF5YupsPNB6rwwU5nIgmtRwfAXIHdlUMeSFt2o42estD5TQ oQW1YkxxhJHnsQMnPe0YHog72/jr45XFE5AuUE8vqNChCUNO+A06PoD5svpk5CLaEXw2 QqKfgsO6ftNwKl8i5qW1BHMzWBEdWV7Bdd7fuitvEGVJJvn5bm4Cf2GRI4fLwwUrfus9 7NsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:references:in-reply-to:from :date:message-id:subject:to:cc: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=Drzd8gaM0YemSioigXVoZrdAjVMfx4BLg8U6TvKhuBY=; b=BKvIcmY408SkcvQ3dGVW2TmlaqChDXbvcIWGiktXET06+MSxBVEQh0MA7hYP/jkye5 HcNr1iXOCp64vGhpUUifpXpIS3CQ4t49KGuDmTw7AZGOeSAUf6kUb1siQnHqWtKbAgAL 1BUj85hImfh/EGjwtgoVGg89OQUgaRfxJOGnOjUCnANVWn5gYJHwGyV7ioLfm8hOBsiU XS0ifcOqtMtOEGcPjfbL6QMC+ivggRWKz0Jz8JDvZr9XaprqzRmegzQfIPHspoGHrjFg qv4fDqVDqtZSvHVya8gr7KtcGdDXNAaQQZ8G8uXNbu5PE+0muXHSp3mI+kOcwsEJ/VZo iJyQ== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM532rzNX8O7Gg1vjSK4bA0BsKJiLWJyq2t/LNSRs0UjOY3GaqMF3P aTuWk6SQA1uc4K2g1GdgCJM= X-Google-Smtp-Source: ABdhPJzvsGVnk1/yRQaCGCG5ufjd5dlTdVnuRsppOYkczCZh8zcbcfeqw9gAXydsmAZwIW/txt7A1Q== X-Received: by 2002:a1c:8187:: with SMTP id c129mr13257515wmd.82.1601826891927; Sun, 04 Oct 2020 08:54:51 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a1c:e08b:: with SMTP id x133ls1514813wmg.1.gmail; Sun, 04 Oct 2020 08:54:48 -0700 (PDT) X-Received: by 2002:a1c:7205:: with SMTP id n5mr13012807wmc.175.1601826888260; Sun, 04 Oct 2020 08:54:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601826888; cv=none; d=google.com; s=arc-20160816; b=sjMrGJBV+zr3dnb5UwsWi/YaYVvG2fLR7goiyCCgKZhQsio3m29dszsYReIo4QMPiK 7SzOXA/y6hc+sKX2JV8ku87mvzu9Qh8RPEt8qaenY513Wov5aoarL6WvAiKtPirhrDVv 1dLvunPlzGR8UIQWHTv69VNww2gpA4Hj2uWcJUnKVwUvYDvvGCiEEkhyAGZga1YbnzYr GsXtpFN1Nqto+5egLnn6mjecOXVoAH0QWTem9YnhWMbOLF+J3d0ZLulTdnNVGAONwHff h5uHWGoqDH3kM5Jd17mLfPlnC+bYx/EDgPdXW4KXsOjcZO6Mpy0h5zck/ZT1+uoe43Ej MONQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=dtHVpRDcYpa71bTfuR9DFDxT+ugECslnmX0BB48rnz8=; b=hPpQuqt9E+X9nwBKZoI71rIOON5ECjJ0p5juVbrAXLzpWrEerEzoQjOcWO0/I80u8m 61JC6NdLWsvQUXCYnQx6B0H3T5Ky+zsxDlrggPJtB08kBgK+6yQbTSrMy5nVMlutyH2Q SKfGYipnooXShQpp/Sj5okCHKOrusWxV3PMGn8cLMd/jHAvBR68H8eZ/4qpLeNxHNFYv 9M/3Tctb7/chYMdm/D6wylPSwivPJBpRvw2rt5KBf7cevyWzoi5DRd9fKrj+awR8xNoo MlI+AOl34ceGrQ51I7Yexd8moEnqRBrE6FN1YvLZGPVPs5AfyFHdBjwjHm6MBsXgPSO+ LGsQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@broadband-forum-org.20150623.gappssmtp.com header.s=20150623 header.b=W0rRgmbc; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::52c as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org Original-Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com. [2a00:1450:4864:20::52c]) by gmr-mx.google.com with ESMTPS id z62si193563wmb.0.2020.10.04.08.54.48 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Oct 2020 08:54:48 -0700 (PDT) Received-SPF: pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::52c as permitted sender) client-ip=2a00:1450:4864:20::52c; Original-Received: by mail-ed1-x52c.google.com with SMTP id dn5so6798068edb.10 for ; Sun, 04 Oct 2020 08:54:48 -0700 (PDT) X-Received: by 2002:aa7:d7c1:: with SMTP id e1mr7809940eds.4.1601826887946; Sun, 04 Oct 2020 08:54:47 -0700 (PDT) In-Reply-To: X-Original-Sender: wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@broadband-forum-org.20150623.gappssmtp.com header.s=20150623 header.b=W0rRgmbc; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::52c as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@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-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:26313 Archived-At: --000000000000a5ef3805b0da62a6 Content-Type: text/plain; charset="UTF-8" Great. Thanks. I can do this. But can I then use a template? I didn't mention this earlier, but I tried setting some variables in the Doc() function (e.g. 'toc') and they didn't seem to be seen by the template. On Sun, 4 Oct 2020, 16:12 John MacFarlane, wrote: > > The table of contents is generated by the HTML writer. > So, if you create a custom writer, you'll have to reproduce > this functionality in your writer. > > William Lupton writes: > > > Hello, > > > > % pandoc --version > > pandoc 2.9.2.1 > > > > I want to generate modified HTML for headers (to be specific, I want to > add > > a link to each header, like Sphinx does), so I decided to create a > custom > > lua writer. > > > > I started with the supplied sample.lua and modified the Header() > function, > > but I find (when I run with --standalone --table-of-contents) that I > don't > > get a ToC. And when I look at the variables in the Doc() function I > don't > > see 'toc' or 'table-of-contents'. > > > > Should I be able do this, or do I have to use my custom writer to > generate > > a fragment and then run pandoc again to process the fragment and > generate > > the ToC (I've tried this and it works)? > > > > Note: I tried to parse this comment in sample.lua Doc(), but am not > clear > > whether it's saying that I can use --template in the _same_ pandoc > > invocation or whether I need to use a separate invocation: > > * You could use the metadata table to fill variables in a custom lua > > template. Or, pass `--template=...` to pandoc, and pandoc will do the > > template processing as usual. > > > > I can supply more detailed info on request. > > > > Thanks, > > William Lupton > > > > -- > > 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/66e3e0f4-a77c-4ff6-b71e-68182d95ac2an%40googlegroups.com > . > -- 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/CAEe_xxjxAsHgd3nQtL%2B-Nrsfgk9tbOmhYz_8JJ2dMkCMAJ1aRA%40mail.gmail.com. --000000000000a5ef3805b0da62a6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Great. Thanks. I can do this.

=
But can I then use a template? I didn't mention this = earlier, but I tried setting some variables in the Doc() function (e.g. = 9;toc') and they didn't seem to be seen by the template.

On Su= n, 4 Oct 2020, 16:12 John MacFarlane, <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote:
=
The table of contents is generated by the HTML writer.
So, if you create a custom writer, you'll have to reproduce
this functionality in your writer.

William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> writes:

> Hello,
>
> % pandoc --version
> pandoc 2.9.2.1
>
> I want to generate modified HTML for headers (to be specific, I want t= o add
> a link to each header, like Sphinx does), so I decided to create a cus= tom
> lua writer.
>
> I started with the supplied sample.lua and modified the Header() funct= ion,
> but I find (when I run with --standalone --table-of-contents) that I d= on't
> get a ToC. And when I look at the variables in the Doc() function I do= n't
> see 'toc' or 'table-of-contents'.
>
> Should I be able do this, or do I have to use my custom writer to gene= rate
> a fragment and then run pandoc again to process the fragment and gener= ate
> the ToC (I've tried this and it works)?
>
> Note: I tried to parse this comment in sample.lua Doc(), but am not cl= ear
> whether it's saying that I can use --template in the _same_ pandoc=
> invocation or whether I need to use a separate invocation:
> * You could use the metadata table to fill variables in a custom lua <= br> > template.=C2=A0 Or, pass `--template=3D...` to pandoc, and pandoc will= do the
> template processing as usual.
>
> I can supply more detailed info on request.
>
> Thanks,
> William Lupton
>
> --
> You received this message because you are subscribed to the Google Gro= ups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send= an email to pandoc-discuss+unsubscribe@googlegr= oups.com.
> To view this discussion on the web visit https://group= s.google.com/d/msgid/pandoc-discuss/66e3e0f4-a77c-4ff6-b71e-68182d95ac2an%4= 0googlegroups.com.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://group= s.google.com/d/msgid/pandoc-discuss/CAEe_xxjxAsHgd3nQtL%2B-Nrsfgk9tbOmhYz_8= JJ2dMkCMAJ1aRA%40mail.gmail.com.
--000000000000a5ef3805b0da62a6--