git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: Add missing languages.

Updates the list from the hyphenation files at <http://mirror.ctan.org/language/hyph-utf8/tex/generic/hyph-utf8/loadhyph/>.

commit9765ef2ce6abda60be0fa9f50571e752bd42009c authorAndrew Dunning <adunning@users.noreply.github.com> dateThu 31 Mar 2016, 02:51 (11 years ago) parent676b800
2 files changed+18−8
src/Text/Pandoc/Writers/LaTeX.hs+17−7 tests/writers-lang-and-dir.latex+1−1
src/Text/Pandoc/Writers/LaTeX.hs+17−7
@@ -1125,7 +1125,7 @@ toPolyglossiaEnv l =
11251125
11261126-- Takes a list of the constituents of a BCP 47 language code and
11271127-- converts it to a Polyglossia (language, options) tuple
1128−-- http://mirrors.concertpass.com/tex-archive/macros/latex/contrib/polyglossia/polyglossia.pdf
1128+-- http://mirrors.ctan.org/macros/latex/contrib/polyglossia/polyglossia.pdf
11291129toPolyglossia :: [String] -> (String, String)
11301130toPolyglossia ("ar":"DZ":_) = ("arabic", "locale=algeria")
11311131toPolyglossia ("ar":"IQ":_) = ("arabic", "locale=mashriq")
@@ -1153,18 +1153,21 @@ toPolyglossia ("en":"UK":_) = ("english", "variant=british")
11531153toPolyglossia ("en":"US":_) = ("english", "variant=american")
11541154toPolyglossia ("grc":_) = ("greek", "variant=ancient")
11551155toPolyglossia ("hsb":_) = ("usorbian", "")
1156−toPolyglossia ("la":"x-classic":_) = ("latin", "variant=classic")
1156+toPolyglossia ("la":"x":"classic":_) = ("latin", "variant=classic")
11571157toPolyglossia ("sl":_) = ("slovenian", "")
11581158toPolyglossia x = (commonFromBcp47 x, "")
11591159
11601160-- Takes a list of the constituents of a BCP 47 language code and
11611161-- converts it to a Babel language string.
1162−-- http://mirrors.concertpass.com/tex-archive/macros/latex/required/babel/base/babel.pdf
1163−-- Note that the PDF unfortunately does not contain a complete list of supported languages.
1162+-- http://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf
1163+-- List of supported languages (slightly outdated):
1164+-- http://tug.ctan.org/language/hyph-utf8/doc/generic/hyph-utf8/hyphenation.pdf
11641165toBabel :: [String] -> String
11651166toBabel ("de":"1901":_) = "german"
11661167toBabel ("de":"AT":"1901":_) = "austrian"
11671168toBabel ("de":"AT":_) = "naustrian"
1169+toBabel ("de":"CH":"1901":_) = "swissgerman"
1170+toBabel ("de":"CH":_) = "nswissgerman"
11681171toBabel ("de":_) = "ngerman"
11691172toBabel ("dsb":_) = "lowersorbian"
11701173toBabel ("el":"polyton":_) = "polutonikogreek"
@@ -1178,7 +1181,7 @@ toBabel ("fr":"CA":_) = "canadien"
11781181toBabel ("fra":"aca":_) = "acadian"
11791182toBabel ("grc":_) = "polutonikogreek"
11801183toBabel ("hsb":_) = "uppersorbian"
1181−toBabel ("la":"x-classic":_) = "classiclatin"
1184+toBabel ("la":"x":"classic":_) = "classiclatin"
11821185toBabel ("sl":_) = "slovene"
11831186toBabel x = commonFromBcp47 x
11841187
@@ -1187,12 +1190,15 @@ toBabel x = commonFromBcp47 x
11871190-- https://tools.ietf.org/html/bcp47#section-2.1
11881191commonFromBcp47 :: [String] -> String
11891192commonFromBcp47 [] = ""
1190−commonFromBcp47 ("pt":"BR":_) = "brazilian"
1193+commonFromBcp47 ("pt":"BR":_) = "brazilian"
1194+commonFromBcp47 ("sr":"Cyrl":_) = "serbianc"
1195+commonFromBcp47 ("zh":"Latn":"pinyin":_) = "pinyin"
11911196commonFromBcp47 x = fromIso $ head x
11921197 where
11931198 fromIso "af" = "afrikaans"
11941199 fromIso "am" = "amharic"
11951200 fromIso "ar" = "arabic"
1201+ fromIso "as" = "assamese"
11961202 fromIso "ast" = "asturian"
11971203 fromIso "bg" = "bulgarian"
11981204 fromIso "bn" = "bengali"
@@ -1216,12 +1222,13 @@ commonFromBcp47 x = fromIso $ head x
12161222 fromIso "fur" = "friulan"
12171223 fromIso "ga" = "irish"
12181224 fromIso "gd" = "scottish"
1225+ fromIso "gez" = "ethiopic"
12191226 fromIso "gl" = "galician"
12201227 fromIso "he" = "hebrew"
12211228 fromIso "hi" = "hindi"
12221229 fromIso "hr" = "croatian"
1223− fromIso "hy" = "armenian"
12241230 fromIso "hu" = "magyar"
1231+ fromIso "hy" = "armenian"
12251232 fromIso "ia" = "interlingua"
12261233 fromIso "id" = "indonesian"
12271234 fromIso "ie" = "interlingua"
@@ -1229,6 +1236,7 @@ commonFromBcp47 x = fromIso $ head x
12291236 fromIso "it" = "italian"
12301237 fromIso "jp" = "japanese"
12311238 fromIso "km" = "khmer"
1239+ fromIso "kmr" = "kurmanji"
12321240 fromIso "kn" = "kannada"
12331241 fromIso "ko" = "korean"
12341242 fromIso "la" = "latin"
@@ -1244,6 +1252,7 @@ commonFromBcp47 x = fromIso $ head x
12441252 fromIso "no" = "norsk"
12451253 fromIso "nqo" = "nko"
12461254 fromIso "oc" = "occitan"
1255+ fromIso "pa" = "panjabi"
12471256 fromIso "pl" = "polish"
12481257 fromIso "pms" = "piedmontese"
12491258 fromIso "pt" = "portuguese"
@@ -1260,6 +1269,7 @@ commonFromBcp47 x = fromIso $ head x
12601269 fromIso "ta" = "tamil"
12611270 fromIso "te" = "telugu"
12621271 fromIso "th" = "thai"
1272+ fromIso "ti" = "ethiopic"
12631273 fromIso "tk" = "turkmen"
12641274 fromIso "tr" = "turkish"
12651275 fromIso "uk" = "ukrainian"
tests/writers-lang-and-dir.latex+1−1
@@ -27,7 +27,7 @@
2727 breaklinks=true}
2828\urlstyle{same} % don't use monospace font for urls
2929\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
30− \usepackage[shorthands=off,ngerman,british,ngerman,spanish,french,main=english]{babel}
30+ \usepackage[shorthands=off,ngerman,british,nswissgerman,spanish,french,main=english]{babel}
3131 \newcommand{\textgerman}[2][]{\foreignlanguage{ngerman}{#2}}
3232 \newenvironment{german}[1]{\begin{otherlanguage}{ngerman}}{\end{otherlanguage}}
3333 \newcommand{\textenglish}[2][]{\foreignlanguage{british}{#2}}