From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/21820 Path: news.gmane.org!.POSTED!not-for-mail From: Christophe Demko Newsgroups: gmane.text.pandoc Subject: Re: Chapter TOC via filter? Date: Wed, 9 Jan 2019 06:29:07 -0800 (PST) Message-ID: <6fe9c4df-2625-4508-8608-da8499e81599@googlegroups.com> References: <1bb6e5f4-04ce-4209-8223-f928f2943998@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_2568_1290566124.1547044147349" X-Trace: blaine.gmane.org 1547044023 18113 195.159.176.226 (9 Jan 2019 14:27:03 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 9 Jan 2019 14:27:03 +0000 (UTC) To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDN5TJEC4AEBBNEK3DQQKGQEIE5OXTQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Jan 09 15:26:59 2019 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-ot1-f59.google.com ([209.85.210.59]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ghEos-0004Ys-IZ for gtp-pandoc-discuss@m.gmane.org; Wed, 09 Jan 2019 15:26:58 +0100 Original-Received: by mail-ot1-f59.google.com with SMTP id w24sf2961851otk.22 for ; Wed, 09 Jan 2019 06:29:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=dn6qBetg/gXy3zK7orCyhaH7VAEGywvuYcRrgu+4Q3w=; b=eGOFsThFyhsFA6RyHRphtxuZvVbYoQwop7NlSnSQW2YVt+wFsRNXpYpCs45lbSK4kI W0RlSrtbKTiffwDtlb6J1FoByELxmBwamzJjNJ0009PU9sR3XnNEzJhXI6+qV8ydqmgL GpEVOY18it4T+0pbfkLnrv3I0z+VU0pNxqkdVLDJADirdQ72eXvzh2gsWDM7wUi9aeqz 94sFzC5DfgZKSlD8PsqLUBNtABUCzgBNVa+7e4QsFzu/MoYNTv5DUW9HaZf/b8vSurRm +myGCykf6JKh1lITRIWoN41DHZpK5wbFZmoPvxNMIBJgk3SwXzlMcVcthFlmKEzSE6Eu AJ9A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=dn6qBetg/gXy3zK7orCyhaH7VAEGywvuYcRrgu+4Q3w=; b=riiQkGCluRNNedV4AFdSRSqSpdQc3xR4lb/Za6rykTqIGunGInSmBkX8+kxxf0P5LB JhVMGnjDccHGavVgSJ3YhiigsLRTfVBblxS/49ZsPPK6PKZEP1KwViP4tMUr3CQFEqJz 6n+nv0T/ebjogOe+ubp6Djv9p7cGd8jmrMPNp6pQjEcKC/DRPKqJbP9LvITpMTFSwfyV BIkDPsxent7MOY9kYlg9Th2W2t4THb6ADy9GBg/l+QRf2vY3ttT1GAw2MHkICAHIBVHR 89DICVl9SFYKOCogKrWb4X9LjzplEZbNZXXIYtnNuNI3TPu3Rbw2AGoPOyi6402ggSlT D46Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=dn6qBetg/gXy3zK7orCyhaH7VAEGywvuYcRrgu+4Q3w=; b=kLYt+CttMYl7Mx17EFoCJ+cThJFpzsc02hI7KV3Fs3TbboCJmx697l+9Pu9RSwBAUh JpvtExzvHN+v7eAQEEMNzD8ccBCrM5NiFLMyLPiXioNdY/rTBjbGFCqznY5r9z+4S72E QPUhvXWwvh3eQ/imiYeL2AiIbgg4L1H9iKBifQCRl1uBA6GzHNkRyreTKBn5kgGMJc6H siQd+mhuTstwJXrhkOp0sIcwNXHc7lr/DgWScHqRK2JosJ5v3CEXAJV0sBB1+gQQb5hz FRDHcdc9FEBFCfAfvX/aAdoD0GhB0mw/Dmk5v3uASvW92tCS4fkxJRXJXnW6msTHf4q5 qloA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AJcUukdHKPCNMLI+oHnx9siNPST1tXxyFg3gy1IJaxITu3vx0rGy1jOn NS7bwhqErbRW7On1/2MxcmU= X-Google-Smtp-Source: ALg8bN5b1QV9L2SWoztRp2T5jHuFiz/HMfqS+zCob8SBtTZNNb2CsE/9QNGNOw8Gu8JmT4ymtIPVbg== X-Received: by 2002:aca:308d:: with SMTP id w135mr17213oiw.0.1547044149260; Wed, 09 Jan 2019 06:29:09 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:aca:d40f:: with SMTP id l15ls3605660oig.6.gmail; Wed, 09 Jan 2019 06:29:08 -0800 (PST) X-Received: by 2002:aca:cc0f:: with SMTP id c15mr16549oig.3.1547044147885; Wed, 09 Jan 2019 06:29:07 -0800 (PST) In-Reply-To: <1bb6e5f4-04ce-4209-8223-f928f2943998-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: chdemko-Re5JQEeQqe8AvxtiuMwx3w@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:21820 Archived-At: ------=_Part_2568_1290566124.1547044147349 Content-Type: multipart/alternative; boundary="----=_Part_2569_342403206.1547044147349" ------=_Part_2569_342403206.1547044147349 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=20 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 \C= hapterTOC > : > > 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 filte= r does=20 > not have access to the numbers and numbering works differently for LaT= eX=20 > and HTML. Thus, I=E2=80=99ll probably extend my filter that numbers te= xt units for=20 > HTML, to additionally create TOCs (for LaTeX, it would only do the lat= ter):=20 > https://groups.google.com/d/topic/pandoc-discuss/N4Qv0Bvgt_E/discussio= n > - Alternatively, things would be easier if one omitted the chapter=20 > 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= =20 > translated to HTML, PDF, etc., I wrote a shell script that inserted th= e=20 > chapter TOC into the text file. For pandoc, I=E2=80=99d prefer to use = a filter. The=20 > output of the shell script looks as follows:=20 > 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=20 > look into retrieving pandoc=E2=80=99s auto-generated IDs. > > Is there something I=E2=80=99m overlooking? Any tips or suggestions? > --=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/6fe9c4df-2625-4508-8608-da8499e81599%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. ------=_Part_2569_342403206.1547044147349 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
It would be be better if a local TOC is created when a cla= ss 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=C2=A0:
I=E2=80=99m consider= ing 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}
<= br>
CHAPTER TOC (number of chapter is 12):

* 12.1. [Section on dogs](#dogs)
* 12.1.2. Subsection on poodl= es
* 12.2. [Section on cats](#cats)

= Considerations:
  • Getting the numbering right is challengin= g =E2=80=93 AFAICT, a filter does not have access to the numbers and number= ing works differently for LaTeX and HTML. Thus, I=E2=80=99ll probably exten= d 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/pandoc-di= scuss/N4Qv0Bvgt_E/discussion
  • Alternatively, things would b= e 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 tha= t inserted the chapter TOC into the text file. For pandoc, I=E2=80=99d pref= er to use a filter. The output of the shell script looks as follows:=C2=A0<= a href=3D"http://exploringjs.com/es6/ch_symbols.html" target=3D"_blank" rel= =3D"nofollow" onmousedown=3D"this.href=3D'http://www.google.com/url?q\x= 3dhttp%3A%2F%2Fexploringjs.com%2Fes6%2Fch_symbols.html\x26sa\x3dD\x26sntz\x= 3d1\x26usg\x3dAFQjCNHq5V3U3ivDvLsawHpbBonVDSHkBg';return true;" onclick= =3D"this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Fexploringj= s.com%2Fes6%2Fch_symbols.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHq5V3= U3ivDvLsawHpbBonVDSHkBg';return true;">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=99= s 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 &= 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://groups.google.com/d/= msgid/pandoc-discuss/6fe9c4df-2625-4508-8608-da8499e81599%40googlegroups.co= m.
For more options, visit http= s://groups.google.com/d/optout.
------=_Part_2569_342403206.1547044147349-- ------=_Part_2568_1290566124.1547044147349--