public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Gareth Stockwell <gareth.stockwell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: Chapter TOC via filter?
Date: Wed, 9 Jan 2019 14:58:10 +0000	[thread overview]
Message-ID: <CAGewFGCx+TTcC4Vv-VoQv_v8LkM9frr7F1r4W1puhKK7nc5oiQ@mail.gmail.com> (raw)
In-Reply-To: <6fe9c4df-2625-4508-8608-da8499e81599-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 3848 bytes --]

> 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.

    <insert local ToC here>

    Body of the section.

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

    <div class="local-toc"></div>

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 <chdemko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 écrit :
>>
>> I’m 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 – AFAICT, a filter does
>>    not have access to the numbers and numbering works differently for LaTeX
>>    and HTML. Thus, I’ll 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/pandoc-discuss/N4Qv0Bvgt_E/discussion
>>    - 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’t change how Markdown was
>>    translated to HTML, PDF, etc., I wrote a shell script that inserted the
>>    chapter TOC into the text file. For pandoc, I’d 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’t have IDs. I’ll have to
>>    look into retrieving pandoc’s auto-generated IDs.
>>
>> Is there something I’m 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
> <https://groups.google.com/d/msgid/pandoc-discuss/6fe9c4df-2625-4508-8608-da8499e81599%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAGewFGCx%2BTTcC4Vv-VoQv_v8LkM9frr7F1r4W1puhKK7nc5oiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 5542 bytes --]

  parent reply	other threads:[~2019-01-09 14:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-07  4:10 Axel Rauschmayer
     [not found] ` <1bb6e5f4-04ce-4209-8223-f928f2943998-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-01-07  4:11   ` Axel Rauschmayer
2019-01-09 14:29   ` Christophe Demko
     [not found]     ` <6fe9c4df-2625-4508-8608-da8499e81599-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-01-09 14:58       ` Gareth Stockwell [this message]
2019-01-09 16:46   ` John MacFarlane
     [not found]     ` <m2va2xvkwl.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2019-01-10 19:50       ` Axel Rauschmayer
     [not found]         ` <4f0905e3-c55d-4d97-958c-8478ada10bcf-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-01-10 23:09           ` John MacFarlane
     [not found]             ` <yh480ka7k8155j.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2019-01-10 23:58               ` Axel Rauschmayer
     [not found]                 ` <e9ec0801-2490-4119-88cd-74adbcd9afe6-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-01-11  5:14                   ` John MacFarlane
     [not found]                     ` <m2o98nvkqc.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2019-01-11 12:56                       ` Axel Rauschmayer
     [not found]                         ` <6e119a06-0158-452e-84e3-b248a4efd4a6-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-01-11 17:21                           ` BPJ
     [not found]                             ` <CADAJKhDkztkE+k35A4r4XuZJFoy9ivEm3=48YHkbdfNJbMYhrA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-02-07  1:40                               ` Cormac Relf
2019-01-11 19:22                           ` John MacFarlane

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGewFGCx+TTcC4Vv-VoQv_v8LkM9frr7F1r4W1puhKK7nc5oiQ@mail.gmail.com \
    --to=gareth.stockwell-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).