From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/21807 Path: news.gmane.org!.POSTED!not-for-mail From: Axel Rauschmayer Newsgroups: gmane.text.pandoc Subject: Chapter TOC via filter? Date: Sun, 6 Jan 2019 20:10:33 -0800 (PST) Message-ID: <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_1431_581355546.1546834233753" X-Trace: blaine.gmane.org 1546835315 19457 195.159.176.226 (7 Jan 2019 04:28:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 7 Jan 2019 04:28:35 +0000 (UTC) To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDYNJWVNWQLBB25LZPQQKGQESL4UMZY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Jan 07 05:28:30 2019 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-oi1-f189.google.com ([209.85.167.189]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ggMWc-0004rE-PY for gtp-pandoc-discuss@m.gmane.org; Mon, 07 Jan 2019 05:28:30 +0100 Original-Received: by mail-oi1-f189.google.com with SMTP id w128sf29871123oie.20 for ; Sun, 06 Jan 2019 20:30:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=YEWrKiijdZ+CZjGnnmg0dy7OMP5g0YGjSkx0ztXQaKQ=; b=IP8prFhwQhZbxrWIv4/64oRQ1YCg4PSZmEi2n4LDtDR93fbAOxxwmt6v7ahXvNSeGM 2dd4OKGYUL7jfWJbYvn/ZJEF7xz9yYNN7HisKnTpry6lozmTg2ZsyXjorW44IYkQtlJy 0QEobFc+EsVCpZaFAH3Whi/EivoB4/PmjRXSe6VGgoc5UUgOvmtn6aX5a280qbyBLQQk rVtMq4NMs2sNn9XD+4IqdWNZjIa1t2pG44pnvz2GJ8Tw6p7nDEHyk280VFAb4PxLxQ7O ANmTdH3iuoWJAJsCEhIAwXF5F6YRJqvCldqShZM7l4kxi1g8/Z/4RTJtKYtlvb5QiDEM zIjQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:subject:mime-version:x-original-sender :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=YEWrKiijdZ+CZjGnnmg0dy7OMP5g0YGjSkx0ztXQaKQ=; b=ZGdEz8YNRKcE2ivtIQBEbeTbB8AuhB2nbX5Y2/6ieZo2wTP2WHI9+UDY+tslzKCFxx byxMyL+DnAT9UZ1cDrE0Bs0YOAoBKeXJb0R6jKZ33JyD0KRpmsyVwUik15zh2mT/AzZl qy2Ctf0AK4IaWGmserlT7xjXqF16Y7tukRq1NIEk2zWzfxtrj69yrza/qv0PXDAQY2hL HPWp3VIO7sG9D3Jepj0ctjXauxG1IH1XACCNsqLp263vRP5V2+YjhIeN8HCp/LKo2+Za eEUsnSajzMk7n7t0GPXVtKyxVweFEyFgw0jlWtlhNJgxHoUuVzmj2/qdtgKP/jteGedN IEcA== 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: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=YEWrKiijdZ+CZjGnnmg0dy7OMP5g0YGjSkx0ztXQaKQ=; b=iPRqucYZrxwAInkBSnPpcbMsVtUrOrrp5lE5ZwOzivMJAtSm4PUSAzTXVgoQx1FkJh Ns5gLlUhqQYRkhVfMalULbl3NX3gC70/Dr+8hGYAeI2WQK5vo+xM1ABxTDOnuOMmfxSn 85kQf6BJ6hiOOqYaexRV5xl0Wk8gKaMhwx9D+0/7nEBT/6k5poMVJwRgllgzHz24v5/s y0etaypsHbc51oWXMHFb5mV7sL8fyLd9pc1O8z7pNk2flcrhJeeIrGdW+NqwGjot4wn/ rqB/Qwmo/edfYpm0JifIb08wZmP9AbQNMlK+Vscvi6P1Ii6WM8dq3oggaBnUBAwFPZS4 65nw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AJcUukeN6XxynWeA/HigAKL4rdqlv1k8eGhNMx+Tq9a0s/FEKQyihw7l 9oJ82pHQk4SSON9AYV4lv/M= X-Google-Smtp-Source: ALg8bN6PsXXWtEfI+W9zVs7EdjWQhoeQv5gajZFli+JayycEWW9zMKXeiSF5nDSL3v6yTwDD9Z5AZA== X-Received: by 2002:a9d:24c3:: with SMTP id z61mr1214493ota.1.1546835436517; Sun, 06 Jan 2019 20:30:36 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:aca:d40f:: with SMTP id l15ls5831523oig.6.gmail; Sun, 06 Jan 2019 20:30:35 -0800 (PST) X-Received: by 2002:aca:c703:: with SMTP id x3mr744450oif.5.1546834234445; Sun, 06 Jan 2019 20:10:34 -0800 (PST) X-Original-Sender: rauschma-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:21807 Archived-At: ------=_Part_1431_581355546.1546834233753 Content-Type: multipart/alternative; boundary="----=_Part_1432_1798098125.1546834233753" ------=_Part_1432_1798098125.1546834233753 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I=E2=80=99m considering writing a filter that inserts chapter TOCs via \Cha= pterTOC: 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 filter = does not=20 have access to the numbers and numbering works differently for LaTeX and= =20 HTML. Thus, I=E2=80=99ll probably extend my filter that numbers text uni= ts for=20 HTML, to additionally create TOCs (for LaTeX, it would only do the latte= r):=20 https://groups.google.com/d/topic/pandoc-discuss/N4Qv0Bvgt_E/discussion - 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 tra= nslated=20 to HTML, PDF, etc., I wrote a shell script that inserted the chapter TOC= =20 into the text file. For pandoc, I=E2=80=99d prefer to use a filter. The = output of=20 the shell script looks as=20 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=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/1bb6e5f4-04ce-4209-8223-f928f2943998%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. ------=_Part_1432_1798098125.1546834233753 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I=E2=80=99m considering writing a filter that inserts chap= ter TOCs via \ChapterTOC:
=

INPUT (# is for parts, ## is for chapters, etc.):=

## Chapter on animals {#animals}
### Se= ction on dogs {#dogs}
#### Subsection on poodles
### Se= ction on cats {#cats}

CHAPTER TOC (number of c= hapter is 12):

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

Considerations:
  • Gett= ing the numbering right is challenging =E2=80=93 AFAICT, a filter does not = have access to the numbers and numbering works differently for LaTeX and HT= ML. Thus, I=E2=80=99ll probably extend my filter that numbers text units fo= r HTML, to additionally create TOCs (for LaTeX, it would only do the latter= ): https://groups.google.com/d/topic/pandoc-discuss/N4Qv0Bvgt_E/discussion<= /li>
  • Alternatively, things would be easier if one omitted the chapter nu= mber. 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 the chapter TOC into the te= xt file. For pandoc, I=E2=80=99d prefer to use a filter. The output of the = shell script looks as follows:=C2=A0http://exploringjs.com/es6/ch_symbols.h= tml
  • 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 I= Ds.
Is there something I=E2=80=99m overlooking? Any tips or sugges= tions?

--
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/1bb6e5f4-04ce-4209-8223-f928f2943998%40googlegroups.co= m.
For more options, visit http= s://groups.google.com/d/optout.
------=_Part_1432_1798098125.1546834233753-- ------=_Part_1431_581355546.1546834233753--