From c93d069d49fcf724fc59405b82587d608724c2c6 Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Thu, 16 Mar 2017 22:16:41 +0100
Subject: [PATCH] Add default abbreviations file (data/abbreviations).

This contains a list of strings that will be recognized by pandoc's
Markdown parser as abbreviations.  (A nonbreaking space will
be inserted after the period, preventing a sentence space in
formats like LaTeX.)

Users can override the default by putting a file abbreviations
in their user data directory (`~/.pandoc` on *nix).
---
 data/abbreviations     | 28 ++++++++++++++++++++++++++++
 pandoc.cabal           |  2 ++
 src/Text/Pandoc/App.hs |  8 ++++----
 3 files changed, 34 insertions(+), 4 deletions(-)
 create mode 100644 data/abbreviations

diff --git a/data/abbreviations b/data/abbreviations
new file mode 100644
index 000000000..0d346226f
--- /dev/null
+++ b/data/abbreviations
@@ -0,0 +1,28 @@
+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.
diff --git a/pandoc.cabal b/pandoc.cabal
index 8b895a015..56c2ddbc8 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -100,6 +100,8 @@ Data-Files:
                  data/LaTeXMathML.js
                  -- data for dzslides writer
                  data/dzslides/template.html
+                 -- default abbreviations file
+                 data/abbreviations
                  -- sample lua custom writer
                  data/sample.lua
                  -- bash completion template
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs
index 9c2e076c5..34eadb6e0 100644
--- a/src/Text/Pandoc/App.hs
+++ b/src/Text/Pandoc/App.hs
@@ -280,10 +280,10 @@ convertWithOpts opts = do
                                                      uriFragment = "" }
                                 _ -> Nothing
 
-  abbrevs <- case optAbbreviations opts of
-                  Nothing -> return $ readerAbbreviations def
-                  Just f  -> (Set.fromList . filter (not . null) . lines)
-                                <$> UTF8.readFile f
+  abbrevs <- (Set.fromList . filter (not . null) . lines) <$>
+             case optAbbreviations opts of
+                  Nothing -> readDataFileUTF8 datadir "abbreviations"
+                  Just f  -> UTF8.readFile f
 
   let readerOpts = def{ readerStandalone = standalone
                       , readerColumns = optColumns opts