Skip to content
This repository has been archived by the owner on Apr 30, 2021. It is now read-only.

Commit

Permalink
Reset LANG to style locale, for proper unicode collation.
Browse files Browse the repository at this point in the history
This change only affects pandoc-citeproc when compiled with
the `unicode_collation` flag.

Closes #122.
  • Loading branch information
jgm committed May 6, 2015
1 parent af5aee0 commit 1eedca6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Text/CSL/Pandoc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Text.Pandoc.Builder (setMeta, deleteMeta, Inlines, cite)
import Text.Pandoc.Shared (stringify)
import Text.HTML.TagSoup.Entity (lookupEntity)
import qualified Data.ByteString.Lazy as L
import System.Environment (setEnv)
import Control.Applicative ((<|>))
import Data.Aeson
import Data.Char ( isDigit, isPunctuation, isSpace )
Expand Down Expand Up @@ -127,6 +128,11 @@ processCites' (Pandoc meta blocks) = do
then L.readFile f
else getDefaultCSL
localizeCSL mbLocale $ parseCSL' raw
-- set LANG environment from locale; this affects unicode collation
-- if pandoc-citeproc compiled with unicode_collation flag
setEnv "LANG" $ case styleLocale csl of
(l:_) -> localeLang l
_ -> "en-US"
let cslAbbrevFile = lookupMeta "citation-abbreviations" meta >>= toPath
let skipLeadingSpace = L.dropWhile (\s -> s == 32 || (s >= 9 && s <= 13))
abbrevs <- maybe (return (Abbreviations M.empty))
Expand Down

0 comments on commit 1eedca6

Please # to comment.