From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/17613 Path: news.gmane.org!.POSTED!not-for-mail From: Marlon Newsgroups: gmane.text.pandoc Subject: Re: --section-divs and frontmatter, bodymatter, backmatter Date: Mon, 15 May 2017 10:42:33 -0700 (PDT) Message-ID: References: <2c3cb541-bb46-47b6-8920-d8ae1a99a518@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_1689_1526821951.1494870153332" X-Trace: blaine.gmane.org 1494870155 28216 195.159.176.226 (15 May 2017 17:42:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 15 May 2017 17:42:35 +0000 (UTC) To: pandoc-discuss Original-X-From: pandoc-discuss+bncBC5IZP4K2YHBBCWR47EAKGQEGLX4SQQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon May 15 19:42:29 2017 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-ua0-f189.google.com ([209.85.217.189]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dAK0q-00078P-Ph for gtp-pandoc-discuss@m.gmane.org; Mon, 15 May 2017 19:42:29 +0200 Original-Received: by mail-ua0-f189.google.com with SMTP id w13sf11144234uaw.1 for ; Mon, 15 May 2017 10:42:34 -0700 (PDT) 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:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=enakuwiMAFNYt/4aoNMqogDpQs2DDmf402HI58Jip/M=; b=RUSIDJpYcKK57LUfxEM1Ysg6QknYSGBVw9YAJcEIhMu/M9yCym2EYFaViHK+pft1FI ltTuvw8qfACiqlJAXzSR29wA8ygD77LirYWJEUghwT4bbnIA0FaBtaoKAxwdIGtgFXB+ eMJA2k8C1yFAtmfVA6NxdkZ0I8UqfdnSqlBSSkGhi96IMwm/k+x3sWVCMdoSwhkUSJyo AguNV08HbW00D915mZXZODl2myl6IRRF/zS0p+YcV1e9O7A0ai/btplIcmUe/j+2kAkP 6mxb+AczwdlClUex7NodCtiY0kcwJ/6OpKulsNin2rpoa/52eDM/UyosckGkuVUoZkrh gEfA== 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 :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=enakuwiMAFNYt/4aoNMqogDpQs2DDmf402HI58Jip/M=; b=qpIJrpnRZZgkGZtKym7n0eF5Q+tHzoZIQwphmarAoXUHUnZQz/ILHYn/EVhl/tPcen fWrCIiGAzfkbAMsUv5fV4lmcrrxC+092/M86K04h556Ks3Hh+0lgjAIFXiJoJN13Knz6 ZOBK+BFZuKCU1BvWK07rZAwFtVnJH8GIl3hGXrVwrUbIbpm5C4HQwB9tazOyCynkQ5cl KKCgEEVh6nzuDcT/T6c0QdZhgDA7erlw9Na+4S+UukOip8hG08qmF7seaKpzVTUSEm2o IAxgYo6BN919Ht3V18Jc8SwIBwbECgPD6wUPEGkdyRMSAp0Mi+gHLzV3FeZKgFwotbQl JGFw== 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=enakuwiMAFNYt/4aoNMqogDpQs2DDmf402HI58Jip/M=; b=YkKDP9TAJEUcxCSX4xP/C1RmvX2L44t8gJUF7aARG3krbrNJgri27vA613HaU+wDjj tFwgir4erisTHR0+gMx2aYgXWfrTMrAMdI8PvY6RhEWwPJTAUTO6oPwv5wavDbodu9Vc m+ys6yM5TPxKwOxdTCZcvtVuD+nY/qBHY69RT7pJCx7MWDQZ2cAFs3oJJ+uJzhSeN6ep 7p9r+ui2iHLA726Zxm3oeWf1SkXxIcQtlSAhGoedoeCzLAcq/j0NhdcZFf5FWKe00Tvq tVW19hKyyKDmJZTH665jrqnt8kmCbMeeRx/C/SciW8CXn/4p7KAo81BcW7wawgFACX09 JJgA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AODbwcDpp6ZD4kVdZRz2wOYiK9X8biOkacBkciW8lg7AAHV0B2jjSnMo l6WRPt7S01ikzw== X-Received: by 10.157.60.148 with SMTP id z20mr149393otc.3.1494870154353; Mon, 15 May 2017 10:42:34 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.157.56.90 with SMTP id r26ls13622275otd.0.gmail; Mon, 15 May 2017 10:42:33 -0700 (PDT) X-Received: by 10.157.40.242 with SMTP id s105mr150771ota.5.1494870153831; Mon, 15 May 2017 10:42:33 -0700 (PDT) In-Reply-To: <2c3cb541-bb46-47b6-8920-d8ae1a99a518-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: marlon.or.ba-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-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:17613 Archived-At: ------=_Part_1689_1526821951.1494870153332 Content-Type: multipart/alternative; boundary="----=_Part_1690_1031427657.1494870153333" ------=_Part_1690_1031427657.1494870153333 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable As a workaround to this issue, the following can be done: - Place an empty div with an ad hoc class (super-part, in my case) and= =20 an id that describes de section that will begin, as in - Write a filter to 1. Get all divs with class super-part and return an empty

with the= =20 same id 2. Get all headers and increment their level (from

to

, etc.= ) =20 - Compile with pandoc - Post-process the html file to 1. Delete all empty

2. Replace

with

,

with

, etc. 3. Reduce the *level* classes of the (from level1 to level0,= =20 level2 to level1, etc) Im my case, I postprocess the file with the sed Linux command, so it will= =20 be automated, as I convert my files with a shell script. This, however is very impractical for ePubs, because in that case one would= =20 have to extract the files, make this replacements to all and only the=20 relevant files, then compress it again. I hope that someday would be a way to get a valid output for this cases=20 natively. El jueves, 20 de abril de 2017, 18:23:46 (UTC-5), Marlon escribi=C3=B3: > > I=E2=80=99m trying to write a book in pandoc markdown, but I=E2=80=99m ha= ving an issue=20 > with --section-divs to enclose each matter in a definite block with its o= wn=20 > id. > > Suppose a markdown document like this > >
> ## Introduction > =E2=80=A6 >
>
> # Chapter I > =E2=80=A6 > #Chapter II > =E2=80=A6 >
>
> # Appendix A > =E2=80=A6 > # Appendix B >
> > > > If used with --section-divs, the section opened by the previous heading= =20 > won=E2=80=99t close until the next heading. Resulting in something like (= assuming=20 > -t html5) > >
>
>

Introduction

> =E2=80=A6 >
>
> >
>

Chapter I

> =E2=80=A6 > > > > Is there a way to tell pandoc to close all pending
before=20 > another header? > Or for pandoc to recognize
,
,
,
as=20 > containers so it closes the sections when finding
, ,=20 >
, ? (before those closing tags, of course). > --=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/aef1b11a-d336-4218-b4ec-1ae08e723c42%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. ------=_Part_1690_1031427657.1494870153333 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
As a workaround to this issue, the following can be done:<= br>
  • Place an empty div with an ad hoc class (super-part, in my c= ase) and an id that describes de section that will begin, as in <div class=3D"super-part&q= uot; id=3D"frontmatter"></div>
  • Write a fi= lter to
    1. Get all divs with class super-part and return = an empty <h1> with the same id
    2. Get all headers and increment their level (fro= m <h1> to = <h2>, etc.= )
  • Compile with pandoc
  • Post-process the html f= ile to
  1. Delete all empty <h1>
  2. Re= place <h2>= with <h1>= , <h3> wit= h <h2>, et= c.
  3. Reduce the level classes of the <sections> (from level1 to level0, = level2 to level1, etc)

Im my case, I postprocess the file with= the sed Linux c= ommand, so it will be automated, as I convert my files with a shell script.=

This, however is very impractical for ePubs, because in that case o= ne would have to extract the files, make this replacements to all and only = the relevant files, then compress it again.

I hope that someday woul= d be a way to get a valid output for this cases natively.

El jueves,= 20 de abril de 2017, 18:23:46 (UTC-5), Marlon escribi=C3=B3:
I=E2=80=99m trying to write= a book in pandoc markdown, but I=E2=80=99m having an issue with --section-= divs to enclose each matter in a definite block with its own id.

Sup= pose a markdown document like this

<header id=3D"frontmatter">
##= Introduction
=E2=80=A6
</header= >
<article id=3D"bodymatter">
# Chapter I
=E2=80=A6
#Chapter II
=E2= =80=A6
</article>
<footer<= span style=3D"color:#000"> id=3D"backmatter= ">
# Appendix A
=E2=80=A6
# Appendix B
</footer>



If used wit= h --section-divs, the section opened by the previous heading won=E2=80=99t = close until the next heading. Resulting in something like (assuming -t html= 5)

<header id=3D"frontmatter"&g= t;
&= lt;section class=3D"level2">
<h2>= Introduction&l= t;/h2>
=E2=80=A6
</header>
<article id=3D= "bodymatter">
</section>
<section= class= =3D"level1">
<h1>Chapter I</h1><= br>=E2=80=A6



Is there a way to tell pa= ndoc to close all pending <section> before another header?
Or for = pandoc to recognize <header>, <main>, <article>, <foot= er> as containers so it closes the sections when finding </header>= , </main>, </article>, </footer>? (before those closing t= ags, of course).

--
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/aef1b11a-d336-4218-b4ec-1ae08e723c42%40googlegroups.co= m.
For more options, visit http= s://groups.google.com/d/optout.
------=_Part_1690_1031427657.1494870153333-- ------=_Part_1689_1526821951.1494870153332--