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).
This commit is contained in:
John MacFarlane 2017-03-16 22:16:41 +01:00
parent 2fe806e9ac
commit c93d069d49
3 changed files with 34 additions and 4 deletions

28
data/abbreviations Normal file
View file

@ -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.

View file

@ -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

View file

@ -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