aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Options.hs
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2016-10-19 13:12:57 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2016-10-19 13:12:57 +0200
commit595a171407debfa67436e13e1390d298a3899e74 (patch)
treef36d85988e33ea8c6b86356d137fd78bb816b2aa /src/Text/Pandoc/Options.hs
parentaca695ab0bb5e18e3a2ea6d7b81d9814885c1b00 (diff)
downloadpandoc-595a171407debfa67436e13e1390d298a3899e74.tar.gz
Add option for top-level division type
The `--chapters` option is replaced with `--top-level-division` which allows users to specify the type as which top-level headers should be output. Possible values are `section` (the default), `chapter`, or `part`. The formats LaTeX, ConTeXt, and Docbook allow `part` as top-level division, TEI only allows to set the `type` attribute on `div` containers. The writers are altered to respect this option in a sensible way.
Diffstat (limited to 'src/Text/Pandoc/Options.hs')
-rw-r--r--src/Text/Pandoc/Options.hs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index 856fa259f..575250b9e 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -43,6 +43,7 @@ module Text.Pandoc.Options ( Extension(..)
, HTMLSlideVariant (..)
, EPUBVersion (..)
, WrapOption (..)
+ , Division (..)
, WriterOptions (..)
, TrackChanges (..)
, ReferenceLocation (..)
@@ -337,6 +338,12 @@ data WrapOption = WrapAuto -- ^ Automatically wrap to width
| WrapPreserve -- ^ Preserve wrapping of input source
deriving (Show, Read, Eq, Data, Typeable, Generic)
+-- | Options defining the type of top-level headers.
+data Division = Part -- ^ Top-level headers become parts
+ | Chapter -- ^ Top-level headers become chapters
+ | Section -- ^ Top-level headers become sections
+ deriving (Show, Read, Eq, Ord, Data, Typeable, Generic)
+
-- | Locations for footnotes and references in markdown output
data ReferenceLocation = EndOfBlock -- ^ End of block
| EndOfSection -- ^ prior to next section header (or end of document)
@@ -373,8 +380,7 @@ data WriterOptions = WriterOptions
, writerHtmlQTags :: Bool -- ^ Use @<q>@ tags for quotes in HTML
, writerBeamer :: Bool -- ^ Produce beamer LaTeX slide show
, writerSlideLevel :: Maybe Int -- ^ Force header level of slides
- , writerChapters :: Bool -- ^ Use "chapter" for top-level sects
- , writerParts :: Bool -- ^ Use "part" for top-level sects in LaTeX
+ , writerTopLevelDivision :: Division -- ^ Type of top-level divisions
, writerListings :: Bool -- ^ Use listings package for code
, writerHighlight :: Bool -- ^ Highlight source code
, writerHighlightStyle :: Style -- ^ Style to use for highlighting
@@ -422,8 +428,7 @@ instance Default WriterOptions where
, writerHtmlQTags = False
, writerBeamer = False
, writerSlideLevel = Nothing
- , writerChapters = False
- , writerParts = False
+ , writerTopLevelDivision = Section
, writerListings = False
, writerHighlight = False
, writerHighlightStyle = pygments