summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Options.hs
blob: aef18e7eb4f1abb23f65835292b4cce710a48f56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{-
Copyright (C) 2012 John MacFarlane <jgm@berkeley.edu>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-}

{- |
   Module      : Text.Pandoc.Options
   Copyright   : Copyright (C) 2012 John MacFarlane
   License     : GNU GPL, version 2 or above

   Maintainer  : John MacFarlane <jgm@berkeley.edu>
   Stability   : alpha
   Portability : portable

Data structures and functions for representing parser and writer
options.
-}
module Text.Pandoc.Options ( Extension(..)
                           , ReaderOptions(..)
                           ) where
import Data.Set (Set)
import qualified Data.Set as Set
import Data.Default

-- | Individually selectable syntax extensions.
data Extension = Footnotes
               | TeX_math
               | Delimited_code_blocks
               | Markdown_in_HTML_blocks
               | Fancy_lists
               | Definition_lists
               | Header_identifiers
               | All_symbols_escapable
               | Intraword_underscores
               | Blank_before_blockquote
               | Blank_before_header
               | Significant_bullets
               deriving (Show, Read, Enum, Eq, Ord, Bounded)

data ReaderOptions = ReaderOptions{
         readerExtensions      :: Set Extension  -- ^ Syntax extensions
       , readerSmart           :: Bool -- ^ Smart punctuation
       , readerStrict          :: Bool -- ^ FOR TRANSITION ONLY
       , readerParseRaw        :: Bool -- ^ Parse raw HTML, LaTeX
       , readerColumns         :: Int  -- ^ Number of columns in terminal
       , readerTabStop         :: Int  -- ^ Tab stop
       , readerOldDashes       :: Bool -- ^ Use pandoc <= 1.8.2.1 behavior
                                       --   in parsing dashes; -- is em-dash;
                                       --   - before numerial is en-dash
       , readerLiterateHaskell :: Bool -- ^ Interpret as literate Haskell
       , readerCitations       :: [String] -- ^ List of available citations
       , readerApplyMacros     :: Bool -- ^ Apply macros to TeX math
       , readerIndentedCodeClasses :: [String] -- ^ Default classes for
                                       -- indented code blocks
} deriving (Show, Read)

instance Default ReaderOptions
  where def = ReaderOptions{
                 readerExtensions          = Set.fromList [minBound..maxBound]
               , readerSmart               = False
               , readerStrict              = False
               , readerParseRaw            = False
               , readerColumns             = 80
               , readerTabStop             = 4
               , readerOldDashes           = False
               , readerLiterateHaskell     = False
               , readerCitations           = []
               , readerApplyMacros         = True
               , readerIndentedCodeClasses = []
               }