From c6e936dec2fc0f0e4d15b7c6f7c4ed6934dd233a Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Wed, 30 Oct 2019 16:51:33 +0100 Subject: docbook reader: fix nesting of chapters and sections (#5864) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Set dbBook to true when traversing a chapter too. Currently, a `` in a chapter and in a `<section/>` below that chapter have the same level if they're not inside a `<book/>`. This can happen in a multi-file book project. Also see the example at https://tdg.docbook.org/tdg/4.5/chapter.html Co-authored-by: Félix Baylac-Jacqué <felix@alternativebit.fr> * Add docbook-chapter test This tests nested `<section/>` and makes sure `<title/>` in the first `<section/>` below `<chapter/>` is one level deeper than the `<chapter/>`'s `<title/>`, also when not inside a `<book/>`. Co-authored-by: Félix Baylac-Jacqué <felix@alternativebit.fr> --- src/Text/Pandoc/Readers/DocBook.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs index 80b7798a0..4ea5f6657 100644 --- a/src/Text/Pandoc/Readers/DocBook.hs +++ b/src/Text/Pandoc/Readers/DocBook.hs @@ -726,7 +726,7 @@ parseBlock (Elem e) = mapM parseGlossEntry (filterChildren (named "glossentry") e) "glosslist" -> definitionList <$> mapM parseGlossEntry (filterChildren (named "glossentry") e) - "chapter" -> sect 0 + "chapter" -> modify (\st -> st{ dbBook = True}) >> sect 0 "appendix" -> sect 0 "preface" -> sect 0 "bridgehead" -> para . strong <$> getInlines e -- cgit v1.2.3