From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/21821 Path: news.gmane.org!.POSTED!not-for-mail From: Gareth Stockwell Newsgroups: gmane.text.pandoc Subject: Re: Chapter TOC via filter? Date: Wed, 9 Jan 2019 14:58:10 +0000 Message-ID: References: <1bb6e5f4-04ce-4209-8223-f928f2943998@googlegroups.com> <6fe9c4df-2625-4508-8608-da8499e81599@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000006c9c3d057f07b1fa" X-Trace: blaine.gmane.org 1547045781 2211 195.159.176.226 (9 Jan 2019 14:56:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 9 Jan 2019 14:56:21 +0000 (UTC) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBDILDYGZGAII5GGY4ECRUBAHXTFDY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Jan 09 15:56:16 2019 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-io1-f64.google.com ([209.85.166.64]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ghFHA-0000OI-WA for gtp-pandoc-discuss@m.gmane.org; Wed, 09 Jan 2019 15:56:13 +0100 Original-Received: by mail-io1-f64.google.com with SMTP id v8sf6631633ioh.11 for ; Wed, 09 Jan 2019 06:58:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1547045903; cv=pass; d=google.com; s=arc-20160816; b=Eqydqk/4hd2hrzKIDIAHwBS+9N2OycBJ+vGZe8JQy9klZa/2qCCf84HpAengPu2A+Z uUXCxlVy4IN8uWYhNtCSlsm7W043YIZ4yHlocbUDG23t1otMJVPkwCQgXQ35N5g1zp6z jDXX37FrW7jpcA/JQXFqG1bv/R0zAV3esLILbKxWx/6ZOTaFovKIBhSn9YnyPEv2yKNs cW7BheWDcLxjVzTeo7QjNN3eIU9V92twwD3E/pj/Dd4WyovldKjnuYpC76UviGgzPIdE 0sYB1Tto6mFXp7IxeiQcJS0kEa007uYe21m/udHRiDhtpYuzugI/aCrbKx+QEVc1GQl6 ozZQ== 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:to:subject:message-id:date :from:in-reply-to:references:mime-version:sender:dkim-signature :dkim-signature; bh=itkTjyfWeADJkKxRzjsHh6g84x0YatMWWiQByYRaPOU=; b=RclssYqQK7PhNSWlA2kNKF1+TGO+92sy20ztKDIzOb+o3prGSxrrUA+KUSNUk0k6VX +FBrLcsE0Bd2o1zMVoZmPlWWGXAfXnRq97XF5mVtQy+0inpE++lzLlP5aAVBJx7ykD/r OnW/RuqRVwVQzyf+Udc7zf/DbVx/uL2c41R1Aflt+rntuLK1LnRwTp0ztUT9bxvms5Yj t0EhN84dTwqbY8LVkGJ9Jtl1kbmpJWhCb5Zu9U01di6j/OoqDqlZLXTyBRZro5gFA0RY pgSEk+6/aP234w2dXQBeuvXlsy6v6vcGyrZlMHVlb9NuoPXRgasuhicTZTDVf3aqzVzh kI4A== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qGPLa9D6; spf=pass (google.com: domain of gareth.stockwell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::934 as permitted sender) smtp.mailfrom=gareth.stockwell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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: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=itkTjyfWeADJkKxRzjsHh6g84x0YatMWWiQByYRaPOU=; b=n6Noac0ixq9mDboOr8k8TZW4tDhuzIgG7uMgSG7zH1uDxEIwUryf2iYqqsqD1bji1Q t0jRspFcmrzqVS7EUhTlU2oXa7EjbsrcYssMCPJIfkAvURcdlMjV6hP/i6FssAmqgFLA BMVRlm3QGcRVWNJ7W3+8lFY51Zxq08M3Y2RU7svRk0bglFtR1E0wjPSYM6RAlqF8+10b 3AGjp9/zhvmI5twRW/kcHygeI6kVJttpK3cJQ1UJTe96IFnkQ/8xf1gzTU+iDGwjzITk rS3MEdLYet4419PA2LpyqHhGsKwy1WziFIasvTCogUK1QbdnQ3lm/zKFZNqWmoMrY2R0 PsbA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :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=itkTjyfWeADJkKxRzjsHh6g84x0YatMWWiQByYRaPOU=; b=P0rRbrk+mL/vSrjC6gXGzgw+yanInSj0DzW0YhYvzc6G7/4r3Qmrk9JQ/lC9Eok5vn dgCpRagnixfawXDVum0Uwjmj4OgESgXD84L/Xzwq1vlKwfqpmk+Ei0eYmYNCHDVZP0sk JX7BX/rSyTuIPyuTMcv9m+swKr0ZL0DuWrDXbqC9ab3R9yjey9mwUlME+leHZE7SNZ79 +iHZ2mhDiampkxK6RbQ1pakteLSiCvUoyUM32Al65Zs3p/I7K3atUlVB3wmjz8XFXPyH 0SkMwdS6APPl0O7KbkfRC0LRFj23XmJhR6thendnp/awAmkfBnYAKK3WTXOFcK1Lk8CI aXvw== 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: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=itkTjyfWeADJkKxRzjsHh6g84x0YatMWWiQByYRaPOU=; b=RNxACeB1U4vyp6mZqcLgJYc5AJDPCsggUPaOLUthW201jmevtLyNursp2YCvkQNaRr 78ie++9lCTluG9jn59lfFAPYVmb1tiIlofWGHp+yHOD/tOVNY8rpK4bMg6ZQLU/DeIP3 UztHs7KknGMhOV/ZYqmbpsAUjiWqUxDVRrEh3QwubTV9/5Lfe1WzYSRlY2brWT2O33Ta ECf9FCKsUotPmswuAKv1HApxum8hpzC0r3ALRm4oJBbSb9A+pdZjx3tq6MrvUgZODTtI D4c8A0xePF4eszHIUYsQXmIz0pedQq/9ZaVaMyfoMpSCHOM7UnZgosk9AQhCFU9M1JLh GA1g== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AJcUukcfKCEpdsYVD/LN8NjjzDFOTCZrjhwrWsRZt6U+IxUMV4SV6sXP fONz+2lXQsXI17dTQ2EwJS8= X-Google-Smtp-Source: ALg8bN5RHNmiyMuPoPe9VdIR2FlcY+QkzF/FEw1yH4A1LwV618LZH1DIDCl0hYpEU79lUDm4p9/rpg== X-Received: by 2002:a24:7309:: with SMTP id y9mr4318itb.2.1547045903731; Wed, 09 Jan 2019 06:58:23 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a9d:3648:: with SMTP id w66ls4120892otb.3.gmail; Wed, 09 Jan 2019 06:58:22 -0800 (PST) X-Received: by 2002:a05:6830:1591:: with SMTP id i17mr840497otr.15.1547045902537; Wed, 09 Jan 2019 06:58:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547045902; cv=none; d=google.com; s=arc-20160816; b=tLVJ5YtaVFfG3R6dn7ZfYpzyAI/EeOvvg23Da8D//WnFXmsBrgqGb4R5ct5QKsQTgt rbPIDIAb9Fr5FOoWw41mUcP9mIa1lMEZIHUIyoZkw0eitFPgeiL1KtqvRs4oy/9mYd3z uH1r4RQbnmMgD8i1AiI6lH4bccTTiy35Z+fdBsqBOLBtBczsYwluQ58Ta0rZiIyzp1m+ v+KR/EwPPgdWGnxqkG8CQkOQcnlIDzJAH23iDrGEvgxZqtu8tsOwi1d6nd+gAKpy9jXG Sk/St0/x+biG+nkIqO5FabrXcJo2OrtLWyDijZNECUxqUjwg3HtjU086lvgWQkKHkpnA +sOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=eSEmTS+s8+Rqe1K3b4bQIHXhwkzhvuzue/TF3tquxk4=; b=NgMqFcuqSfGOQXFmUe5/Nm5882TPU+2+jIPJw8epk6IuSGBqqeIaDopMCWlzCxmvue CKKI/ZtTlo8dZ+cFiJNPBmqxk3VlAYLAM15Y3ziP80MCg+p2qk4EPPAa5P1bPpdZB+DD OQSdLYaM1QoA/LAoG2vRfleqSfDsBzd1JL0RcXXi0ZLJ+1ntfFSHxNuvnRZIGUCfMNct YOZFq+YGvTaKudg4xuWHBvRa0pjKdGZvkXogNKT2wvZBd85IGRrgJALyMlmk9L2RNdDd lc/d6U8UBY73usAal7bvjg20+wm2I/jNvCV0F2os1UfMWaXqddCt9qRfV1YP0fvTlAOl 1upA== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qGPLa9D6; spf=pass (google.com: domain of gareth.stockwell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::934 as permitted sender) smtp.mailfrom=gareth.stockwell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Original-Received: from mail-ua1-x934.google.com (mail-ua1-x934.google.com. [2607:f8b0:4864:20::934]) by gmr-mx.google.com with ESMTPS id 88si2416526oth.5.2019.01.09.06.58.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Jan 2019 06:58:22 -0800 (PST) Received-SPF: pass (google.com: domain of gareth.stockwell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::934 as permitted sender) client-ip=2607:f8b0:4864:20::934; Original-Received: by mail-ua1-x934.google.com with SMTP id z24so2496875ual.8 for ; Wed, 09 Jan 2019 06:58:22 -0800 (PST) X-Received: by 2002:ab0:2a01:: with SMTP id o1mr1629648uar.121.1547045901735; Wed, 09 Jan 2019 06:58:21 -0800 (PST) In-Reply-To: <6fe9c4df-2625-4508-8608-da8499e81599-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: gareth.stockwell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qGPLa9D6; spf=pass (google.com: domain of gareth.stockwell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::934 as permitted sender) smtp.mailfrom=gareth.stockwell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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:21821 Archived-At: --0000000000006c9c3d057f07b1fa Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > It would be be better if a local TOC is created when a class is added to the header (.local-top for example) That would remove the ability of the author to control where the local ToC appears, for example # My section Here is some introduction. Body of the section. For "insert local ToC here", I would suggest using some markup which is agnostic of output format, for example
Then the filter can convert this to markup which is appropriate for each supported output format - e.g. for latex, convert to \ChapterTOC Gareth On Wed, Jan 9, 2019 at 2:29 PM Christophe Demko wrote: > It would be be better if a local TOC is created when a class is added to > the header (.local-top for example) > Ch.D > > Le lundi 7 janvier 2019 05:10:33 UTC+1, Axel Rauschmayer a =C3=A9crit : >> >> I=E2=80=99m considering writing a filter that inserts chapter TOCs via >> \ChapterTOC: >> >> INPUT (# is for parts, ## is for chapters, etc.): >> >> ## Chapter on animals {#animals} >> ### Section on dogs {#dogs} >> #### Subsection on poodles >> ### Section on cats {#cats} >> >> CHAPTER TOC (number of chapter is 12): >> >> * 12.1. [Section on dogs](#dogs) >> * 12.1.2. Subsection on poodles >> * 12.2. [Section on cats](#cats) >> >> Considerations: >> >> - Getting the numbering right is challenging =E2=80=93 AFAICT, a filt= er does >> not have access to the numbers and numbering works differently for La= TeX >> and HTML. Thus, I=E2=80=99ll probably extend my filter that numbers t= ext units for >> HTML, to additionally create TOCs (for LaTeX, it would only do the la= tter): >> https://groups.google.com/d/topic/pandoc-discuss/N4Qv0Bvgt_E/discussi= on >> - Alternatively, things would be easier if one omitted the chapter >> number. But then the numbers in the TOC are not as nice. >> - For another book, where I couldn=E2=80=99t change how Markdown was >> translated to HTML, PDF, etc., I wrote a shell script that inserted t= he >> chapter TOC into the text file. For pandoc, I=E2=80=99d prefer to use= a filter. The >> output of the shell script looks as follows: >> http://exploringjs.com/es6/ch_symbols.html >> - The shell script complains if sections don=E2=80=99t have IDs. I=E2= =80=99ll have to >> look into retrieving pandoc=E2=80=99s auto-generated IDs. >> >> Is there something I=E2=80=99m overlooking? Any tips or suggestions? >> > -- > 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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/6fe9c4df-2625-4508-8608-= da8499e81599%40googlegroups.com > > . > For more options, visit https://groups.google.com/d/optout. > --=20 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 e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/CAGewFGCx%2BTTcC4Vv-VoQv_v8LkM9frr7F1r4W1puhKK7nc5oiQ%40mail= .gmail.com. For more options, visit https://groups.google.com/d/optout. --0000000000006c9c3d057f07b1fa Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
>=C2=A0It would be be better if a loca= l TOC is created when a class is added to the header (.local-top for exampl= e)

That would remove the ability of th= e author to control where the local ToC appears, for example

=
=C2=A0 =C2=A0 # My section

=C2=A0 =C2= =A0 Here is some introduction.

=C2=A0 =C2=A0 <i= nsert local ToC here>

=C2=A0 =C2=A0 Body of the= section.

For "insert local ToC here", I= would suggest using some markup which is agnostic of output format, for ex= ample

=C2=A0 =C2=A0 <div class=3D"local-to= c"></div>

Then the filter can conver= t this to markup which is appropriate for each supported output format - e.= g. for latex, convert to \ChapterTOC

Gareth
<= div>

On Wed,= Jan 9, 2019 at 2:29 PM Christophe Demko <chdemko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
It would be be better if a local T= OC is created when a class is added to the header (.local-top for example)<= div>Ch.D

Le lundi 7 janvier 2019 05:10:33 UTC+1, Axel Rauschmayer a = =C3=A9crit=C2=A0:
I=E2=80=99m considering writing a filter that inserts chapter TOCs= via \ChapterTOC:
INPUT (# is for parts, ## is for chapters, etc.):

## Chapter on animals {#animals}
### Section on= dogs {#dogs}
#### Subsection on poodles
### Section on= cats {#cats}

CHAPTER TOC (number of chapter i= s 12):

* 12.1. [Section on dogs](#dogs)
= * 12.1.2. Subsection on poodles
* 12.2. [Section on cats](#cats)<= br>

Considerations:
  • Getting the = numbering right is challenging =E2=80=93 AFAICT, a filter does not have acc= ess to the numbers and numbering works differently for LaTeX and HTML. Thus= , I=E2=80=99ll probably extend my filter that numbers text units for HTML, = to additionally create TOCs (for LaTeX, it would only do the latter): https://groups.google.com/d/topic/pa= ndoc-discuss/N4Qv0Bvgt_E/discussion
  • Alternatively, things would= be easier if one omitted the chapter number. But then the numbers in the T= OC are not as nice.
  • For another book, where I couldn=E2=80=99t chan= ge how Markdown was translated to HTML, PDF, etc., I wrote a shell script t= hat inserted the chapter TOC into the text file. For pandoc, I=E2=80=99d pr= efer to use a filter. The output of the shell script looks as follows:=C2= =A0http://exploringjs.com/es6/ch_symbols.html
  • Th= e shell script complains if sections don=E2=80=99t have IDs. I=E2=80=99ll h= ave to look into retrieving pandoc=E2=80=99s auto-generated IDs.
I= s there something I=E2=80=99m overlooking? Any tips or suggestions?

--
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 pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https:= //groups.google.com/d/msgid/pandoc-discuss/6fe9c4df-2625-4508-8608-da8499e8= 1599%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://group= s.google.com/d/msgid/pandoc-discuss/CAGewFGCx%2BTTcC4Vv-VoQv_v8LkM9frr7F1r4= W1puhKK7nc5oiQ%40mail.gmail.com.
For more options, visit http= s://groups.google.com/d/optout.
--0000000000006c9c3d057f07b1fa--