aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Options.hs
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert+github@zeitkraut.de>2016-11-27 20:31:04 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2016-11-27 20:31:04 +0100
commit1fc07ff4dae5b3673ac2090d0a52f69afc1f078e (patch)
treeee546210df74e004968a7383d2c62aaa92c9415a /src/Text/Pandoc/Options.hs
parent08bf8f2e9d1ee2bb522b95df9fb1df37f5919c30 (diff)
downloadpandoc-1fc07ff4dae5b3673ac2090d0a52f69afc1f078e.tar.gz
Refactor top-level division selection (#3261)
The "default" option is no longer represented as `Nothing` but via a new type constructor, making the `Maybe` wrapper superfluous. The default behavior of using heuristics can now be enabled explicitly by setting `--top-level-division=default`. API change (`Text.Pandoc.Options`): The `Division` type was renamed to `TopLevelDivision`. The `Section`, `Chapter`, and `Part` constructors were renamed to `TopLevelSection`, `TopLevelChapter`, and `TopLevelPart`, respectively. An additional `TopLevelDefault` constructor was added, which is now also the new default value of the `writerTopLevelDivision` field in `WriterOptions`.
Diffstat (limited to 'src/Text/Pandoc/Options.hs')
-rw-r--r--src/Text/Pandoc/Options.hs16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index b890d1b9a..b02a5181f 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -43,7 +43,7 @@ module Text.Pandoc.Options ( Extension(..)
, HTMLSlideVariant (..)
, EPUBVersion (..)
, WrapOption (..)
- , Division (..)
+ , TopLevelDivision (..)
, WriterOptions (..)
, TrackChanges (..)
, ReferenceLocation (..)
@@ -341,10 +341,12 @@ data WrapOption = WrapAuto -- ^ Automatically wrap to width
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)
+data TopLevelDivision = TopLevelPart -- ^ Top-level headers become parts
+ | TopLevelChapter -- ^ Top-level headers become chapters
+ | TopLevelSection -- ^ Top-level headers become sections
+ | TopLevelDefault -- ^ Top-level type is determined via
+ -- heuristics
+ deriving (Show, Read, Eq, Data, Typeable, Generic)
-- | Locations for footnotes and references in markdown output
data ReferenceLocation = EndOfBlock -- ^ End of block
@@ -382,7 +384,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
- , writerTopLevelDivision :: Maybe Division -- ^ Type of top-level divisions
+ , writerTopLevelDivision :: TopLevelDivision -- ^ Type of top-level divisions
, writerListings :: Bool -- ^ Use listings package for code
, writerHighlight :: Bool -- ^ Highlight source code
, writerHighlightStyle :: Style -- ^ Style to use for highlighting
@@ -430,7 +432,7 @@ instance Default WriterOptions where
, writerHtmlQTags = False
, writerBeamer = False
, writerSlideLevel = Nothing
- , writerTopLevelDivision = Nothing
+ , writerTopLevelDivision = TopLevelDefault
, writerListings = False
, writerHighlight = False
, writerHighlightStyle = pygments