public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* --section-divs and frontmatter, bodymatter, backmatter
@ 2017-04-20 23:23 Marlon
       [not found] ` <2c3cb541-bb46-47b6-8920-d8ae1a99a518-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Marlon @ 2017-04-20 23:23 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1637 bytes --]

I’m trying to write a book in pandoc markdown, but I’m having an issue with 
--section-divs to enclose each matter in a definite block with its own id.

Suppose a markdown document like this

<header id="frontmatter">
## Introduction
…
</header>
<article id="bodymatter">
# Chapter I
…
#Chapter II
…
</article>
<footer id="backmatter">
# Appendix A
…
# Appendix B
</footer>



If used with --section-divs, the section opened by the previous heading 
won’t close until the next heading. Resulting in something like (assuming 
-t html5)

<header id="frontmatter">
<section class="level2">
<h2>Introduction</h2>
…
</header>
<article id="bodymatter">
</section>
<section class="level1">
<h1>Chapter I</h1>
…



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

-- 
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/2c3cb541-bb46-47b6-8920-d8ae1a99a518%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 6837 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: --section-divs and frontmatter, bodymatter, backmatter
       [not found] ` <2c3cb541-bb46-47b6-8920-d8ae1a99a518-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2017-05-15 17:42   ` Marlon
  0 siblings, 0 replies; 2+ messages in thread
From: Marlon @ 2017-05-15 17:42 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2924 bytes --]

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 
   an id that describes de section that will begin, as in <div 
   class="super-part" id="frontmatter"></div>
   - Write a filter 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 (from <h1> to <h2>, etc.)
   

   - Compile with pandoc
   - Post-process the html file to


   1. Delete all empty <h1>
   2. Replace <h2> with <h1>, <h3> with <h2>, etc.
   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 command, 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 one would 
have to extract the files, make this replacements to all and only the 
relevant files, then compress it again.

I hope that someday would 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ó:
>
> I’m trying to write a book in pandoc markdown, but I’m having an issue 
> with --section-divs to enclose each matter in a definite block with its own 
> id.
>
> Suppose a markdown document like this
>
> <header id="frontmatter">
> ## Introduction
> …
> </header>
> <article id="bodymatter">
> # Chapter I
> …
> #Chapter II
> …
> </article>
> <footer id="backmatter">
> # Appendix A
> …
> # Appendix B
> </footer>
>
>
>
> If used with --section-divs, the section opened by the previous heading 
> won’t close until the next heading. Resulting in something like (assuming 
> -t html5)
>
> <header id="frontmatter">
> <section class="level2">
> <h2>Introduction</h2>
> …
> </header>
> <article id="bodymatter">
> </section>
> <section class="level1">
> <h1>Chapter I</h1>
> …
>
>
>
> Is there a way to tell pandoc to close all pending <section> before 
> another header?
> Or for pandoc to recognize <header>, <main>, <article>, <footer> as 
> containers so it closes the sections when finding </header>, </main>, 
> </article>, </footer>? (before those closing tags, of course).
>

-- 
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/aef1b11a-d336-4218-b4ec-1ae08e723c42%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 6831 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-15 17:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-20 23:23 --section-divs and frontmatter, bodymatter, backmatter Marlon
     [not found] ` <2c3cb541-bb46-47b6-8920-d8ae1a99a518-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-05-15 17:42   ` Marlon

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