From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/26315 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 17:25:44 +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="000000000000fdafcd05b0dad128" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3390"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pandoc-discuss To: John MacFarlane Original-X-From: pandoc-discuss+bncBCS4HJ6WSAHBBFPP475QKGQE5GEU5BA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sun Oct 04 18:26:00 2020 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-wm1-f60.google.com ([209.85.128.60]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kP6pk-0000lt-46 for gtp-pandoc-discuss@m.gmane-mx.org; Sun, 04 Oct 2020 18:26:00 +0200 Original-Received: by mail-wm1-f60.google.com with SMTP id t8sf1458291wmj.6 for ; Sun, 04 Oct 2020 09:26:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1601828759; cv=pass; d=google.com; s=arc-20160816; b=zE+wB10Vqn6Wa5bgcOaQEdHcJrUudV9SCJNlPSusAlbh35N4dFw8WzxrGDSyJIYUuH LctBKfVnI9bMw436B6KOSLDQLfcZrdpUgaUfHgO6Bsjcps4RjsGTUELMttEkou8e7X4m 8a752qq2zNT4xKgwyvaoaQYcCdvhyl6K7z5168BWkrmzrOuVO/g6ficIQkgJPLI+9bUy O8HbvxRw5EO38WQiWys8B5hB1p5S2fcnxqEuwX0P3WF8nx68jTHxYT/AD2VxCx+wMZ/v wlWApit9IFbcP80NnHCI6J9VNWw3/RYo2Ztnahru2zb4xVSQ6utb/hPe8URd6Ot19kcz UEMg== 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=oRW3wBGoPMnFg5k8Rd3a3ptCXAs5K+QwDYg1Sf/J8Wk=; b=kD1u26ipfM4ivLBR6gWVDlZQhgC0HgufRDKgSrHZr7YaaCoMalsNXdwkgjabi1loTk dfyrXuVDbDY0WlSdByHR369PgyMgnjlRBfAgi6TNIbU6lXelJoSheh5Nyp9JZUkYQAIT MSpUX3jMo5lztAROCsK79tLwTq3pF5kwVvoc/PcEAG7RuM5gnfaDYuUnjv944e4jx9Ww ojPvdcMSKBaZ9qyX9XZIgZNcGNF3ZlNUROdve4uZwk/3d6Vx28oNB86DPTAMQvelVTD+ P05liYmSlRTOzJLod/pAtZ/+du2g3wDI/FbhnucFeVm36Jz0qHiRQ6KZcupEBDDEMzjZ fxmQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@broadband-forum-org.20150623.gappssmtp.com header.s=20150623 header.b=O7kPTkaF; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::529 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=oRW3wBGoPMnFg5k8Rd3a3ptCXAs5K+QwDYg1Sf/J8Wk=; b=JHKOMgKH0/Ym8ZrEieAxy7ccn5lQHh75sUw6qaB5Di179Ed5R5SR5di3v1WsVjwSko 7XlpQ1iZf7vAfjBa8RWGYZDLEZNd49ez620ZM1JOMSHPoBPO7O8Qei9acFVbqmTegDbY 1EWOJz0xw2zAGvVLKa7zRdr3roQi6G5XKX0hb9kS9C/ePXzmHL7fJ8La3YTizW8ahGKI 6/sTbpmjI5+buQqe5bSWW84D4uZaktXaRPT7djMYX587vLrKLI6FgfE/LIviL8gUM7tT hmXFLRiEgQqc+ExeGD8DD+TUouOLjsyPvtZOnZykHbCORq/f1HOJiUZlWWQMh3wgJP+f iLKQ== 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=oRW3wBGoPMnFg5k8Rd3a3ptCXAs5K+QwDYg1Sf/J8Wk=; b=Z4Dp/YR8bUuh4sP3AtOvz+6DI+FAPzuR1jMJgQIt7H2zS0bh4+JuTCNrOTx1EESHw6 aM5xyrI6ScYvFmFE8XIK2psFPJcfPnNTWuplNaHVxO4K05YmXVkBUPHMN1pHx2g/Fk+l FY6Q0N9kh4a+Uwbvh+LKudvFcdw4qciiWhDw5bwhuNgxEOnRDf80g/x0rxZppOhhQdrh wQdJRFiCfLuyHenLLIAf9rlowHWMMwGimChwv467aCxQ4w0DoGKGtvcVLMk8RRxtsjUD lbT+59uub2pld8ITOTReRKWY8XaxWK2mzvDbe/bmfYbKrvEWA0tDgBX+/Bj3uUy5SwFo 3Ofw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM531FoELBsnhCjYrC5gTl4EbFAp9WjQMyRmCB749O5pIT5B6cMLOq DUJi5g5XXwdk/lQCkeUn7a8= X-Google-Smtp-Source: ABdhPJySpdhbp8/SLBSGtuaajpsg1Ix0wfB93zfk8wi+vZ+6LZIEYrh5fDs6YV7zs3BiKpa3h4wpaw== X-Received: by 2002:a1c:9a0c:: with SMTP id c12mr12920236wme.85.1601828759828; Sun, 04 Oct 2020 09:25:59 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a1c:4e19:: with SMTP id g25ls3415410wmh.2.gmail; Sun, 04 Oct 2020 09:25:56 -0700 (PDT) X-Received: by 2002:a1c:7205:: with SMTP id n5mr13115156wmc.175.1601828756344; Sun, 04 Oct 2020 09:25:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601828756; cv=none; d=google.com; s=arc-20160816; b=PyCJs+pQVn2RXNtL/h81HRgaZe7X1Z3uMPCgVBHH/r56phngj4gdLknN2FVj2lw23Q P/LlR5VF5Sx49B/cehmjVfbqZw0d8wlkCA2glLzP21mksntXMIQYv0XohXAfGtCXp8FH METXkFvTF477RM11dSG1VZeNaDBovZRAuu1orXQ1G95eB2tPv2vmYPqQHZpzEz3ssewk zxuBc+cGpxzz/GUTBZCsDM7RxTxXn8k67FMgcxHmWSENOlNqqlT9E3pGDLdUNLkfhZDA Ac0xN9Xc77r2CvyrtrgRYZiM66Xyyu34Y1sT+Bz7wGjVRq4Bx4EYx8+sxLH1vqCZYc35 VyYQ== 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=6deBgLbmSNLm0otXp2FVUWm4rqIa1FmUtQW0w458CNE=; b=rCLiIMYVJWfpq0MIJ90OUYi0ba+eYIIn3J86BwMI2siAeedp92t6QSHuohakvMo5Kf q4JJzVF9usXjnwHMrAodZXIfMOzm/9i1Or0hIUG4m6tDowrUbNOCeLO2r0h6RLcKQqKo hw0FyoQz8qhriHZYAaui3cQklw8AzLHRL3mcxeLKF0Y+SjgruUQSZpLBt2j9Raengiqi kIYuMqPyDJuhdVVikyHUak+Bs39XOyGlya2M9LASKVcMRKTiRuia6bBTDsk1UFhStBNL z0QWsh3Mm0XOKFxfTsH8yOv6IDNC3datGcyo5uWiUvodCh7586XMtC9GZ8OlK1hIEmvZ c1kQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@broadband-forum-org.20150623.gappssmtp.com header.s=20150623 header.b=O7kPTkaF; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::529 as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org Original-Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com. [2a00:1450:4864:20::529]) by gmr-mx.google.com with ESMTPS id f144si55471wmf.0.2020.10.04.09.25.56 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Oct 2020 09:25:56 -0700 (PDT) Received-SPF: pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::529 as permitted sender) client-ip=2a00:1450:4864:20::529; Original-Received: by mail-ed1-x529.google.com with SMTP id 33so6836265edq.13 for ; Sun, 04 Oct 2020 09:25:56 -0700 (PDT) X-Received: by 2002:aa7:c259:: with SMTP id y25mr12690987edo.249.1601828755968; Sun, 04 Oct 2020 09:25:55 -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=O7kPTkaF; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::529 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:26315 Archived-At: --000000000000fdafcd05b0dad128 Content-Type: text/plain; charset="UTF-8" [sorry for so many short posts] (continued) ...so can I (in the custom writer) tell that --table-of-contents was specified? (For another application, I resorted to passing --toc-depth as metadata in order to pick it up in a custom writer, so I guess I could do the same here for --table-of-contents, but perhaps there's a way to avoid the need?) On Sun, 4 Oct 2020 at 16:56, William Lupton wrote: > Also, I specified --table-of-contents on the command line, but didn't see > it set in the writer's Doc() function. Should I have expected to see it? > > On Sun, 4 Oct 2020, 16:54 William Lupton, > wrote: > >> 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_xxiqrjVZo70FaLC%3DfOfb-12DTpcjeuSCofoNCaPwo6tz_g%40mail.gmail.com. --000000000000fdafcd05b0dad128 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
[sorry for so many short posts]

(contin= ued) ...so can I (in the custom writer) tell that --table-of-contents was s= pecified?

(For another application, I resorted to passin= g --toc-depth as metadata in order to pick it up in a custom writer, so I g= uess I could do the same here for --table-of-contents, but perhaps there= 9;s a way to avoid the need?)

On Sun, 4 Oct 2020 at 16:56, Willi= am Lupton <wlupton@broadb= and-forum.org> wrote:
Also, I specified --table-of-contents on the= command line, but didn't see it set in the writer's Doc() function= . Should I have expected to see it?

On Sun, 4 Oct 2020, 16:54 William Lupton= , <wlup= ton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> wrote:
Great. Thanks. I can do this.

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

On Sun, 4 Oct 2020, 16:12 John MacFarlane, <jgm@berkeley= .edu> 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+unsubscri= be-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> To view this discussion on the web visit ht= tps://groups.google.com/d/msgid/pandoc-discuss/66e3e0f4-a77c-4ff6-b71e-6818= 2d95ac2an%40googlegroups.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_xxiqrjVZo70FaLC%3DfOfb-12DTpcjeuSC= ofoNCaPwo6tz_g%40mail.gmail.com.
--000000000000fdafcd05b0dad128--