summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Options.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-03-05 10:24:39 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-03-05 10:24:39 +0100
commit95f2726ee74a7770bf0eb5fe5629c493addbe298 (patch)
tree9970c4febe033118e910e465e94aca9c41f34771 /src/Text/Pandoc/Options.hs
parent7fc6919f9039a3c71028b807d4372f18cf35bee8 (diff)
Added readerAbbreviations to ParserState.
Markdown reader now consults this to determine what is an abbreviation. Eventually it will be possible to specify a custom list (see #256).
Diffstat (limited to 'src/Text/Pandoc/Options.hs')
-rw-r--r--src/Text/Pandoc/Options.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index 6db53c3dc..0379b0ddf 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -47,6 +47,7 @@ module Text.Pandoc.Options ( module Text.Pandoc.Extensions
) where
import Data.Data (Data)
import Data.Default
+import qualified Data.Set as Set
import Data.Typeable (Typeable)
import GHC.Generics (Generic)
import Text.Pandoc.Extensions
@@ -60,6 +61,7 @@ data ReaderOptions = ReaderOptions{
, readerApplyMacros :: Bool -- ^ Apply macros to TeX math
, readerIndentedCodeClasses :: [String] -- ^ Default classes for
-- indented code blocks
+ , readerAbbreviations :: Set.Set String -- ^ Strings to treat as abbreviations
, readerDefaultImageExtension :: String -- ^ Default extension for images
, readerTrackChanges :: TrackChanges
} deriving (Show, Read, Data, Typeable, Generic)
@@ -72,10 +74,19 @@ instance Default ReaderOptions
, readerTabStop = 4
, readerApplyMacros = True
, readerIndentedCodeClasses = []
+ , readerAbbreviations = defaultAbbrevs
, readerDefaultImageExtension = ""
, readerTrackChanges = AcceptChanges
}
+defaultAbbrevs :: Set.Set String
+defaultAbbrevs = Set.fromList
+ [ "Mr.", "Mrs.", "Ms.", "Capt.", "Dr.", "Prof.",
+ "Gen.", "Gov.", "e.g.", "i.e.", "Sgt.", "St.",
+ "vol.", "vs.", "Sen.", "Rep.", "Pres.", "Hon.",
+ "Rev.", "Ph.D.", "M.D.", "M.A.", "p.", "pp.",
+ "ch.", "sec.", "cf.", "cp."]
+
--
-- Writer options
--