git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #2829 from adunning/patch-1
cc0527bJohn MacFarlane
src/Text/Pandoc/Writers/LaTeX.hs+17−7
@@ -1126,7 +1126,7 @@ toPolyglossiaEnv l =
1126
1126
1127-- Takes a list of the constituents of a BCP 47 language code and
1127-- Takes a list of the constituents of a BCP 47 language code and
1128-- converts it to a Polyglossia (language, options) tuple
1128-- converts it to a Polyglossia (language, options) tuple
1129−-- http://mirrors.concertpass.com/tex-archive/macros/latex/contrib/polyglossia/polyglossia.pdf
1129+-- http://mirrors.ctan.org/macros/latex/contrib/polyglossia/polyglossia.pdf
1130toPolyglossia :: [String] -> (String, String)
1130toPolyglossia :: [String] -> (String, String)
1131toPolyglossia ("ar":"DZ":_) = ("arabic", "locale=algeria")
1131toPolyglossia ("ar":"DZ":_) = ("arabic", "locale=algeria")
1132toPolyglossia ("ar":"IQ":_) = ("arabic", "locale=mashriq")
1132toPolyglossia ("ar":"IQ":_) = ("arabic", "locale=mashriq")
@@ -1154,18 +1154,21 @@ toPolyglossia ("en":"UK":_) = ("english", "variant=british")
1154toPolyglossia ("en":"US":_) = ("english", "variant=american")
1154toPolyglossia ("en":"US":_) = ("english", "variant=american")
1155toPolyglossia ("grc":_) = ("greek", "variant=ancient")
1155toPolyglossia ("grc":_) = ("greek", "variant=ancient")
1156toPolyglossia ("hsb":_) = ("usorbian", "")
1156toPolyglossia ("hsb":_) = ("usorbian", "")
1157−toPolyglossia ("la":"x-classic":_) = ("latin", "variant=classic")
1157+toPolyglossia ("la":"x":"classic":_) = ("latin", "variant=classic")
1158toPolyglossia ("sl":_) = ("slovenian", "")
1158toPolyglossia ("sl":_) = ("slovenian", "")
1159toPolyglossia x = (commonFromBcp47 x, "")
1159toPolyglossia x = (commonFromBcp47 x, "")
1160
1160
1161-- Takes a list of the constituents of a BCP 47 language code and
1161-- Takes a list of the constituents of a BCP 47 language code and
1162-- converts it to a Babel language string.
1162-- converts it to a Babel language string.
1163−-- http://mirrors.concertpass.com/tex-archive/macros/latex/required/babel/base/babel.pdf
1163+-- http://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf
1164−-- Note that the PDF unfortunately does not contain a complete list of supported languages.
1164+-- List of supported languages (slightly outdated):
1165+-- http://tug.ctan.org/language/hyph-utf8/doc/generic/hyph-utf8/hyphenation.pdf
1165toBabel :: [String] -> String
1166toBabel :: [String] -> String
1166toBabel ("de":"1901":_) = "german"
1167toBabel ("de":"1901":_) = "german"
1167toBabel ("de":"AT":"1901":_) = "austrian"
1168toBabel ("de":"AT":"1901":_) = "austrian"
1168toBabel ("de":"AT":_) = "naustrian"
1169toBabel ("de":"AT":_) = "naustrian"
1170+toBabel ("de":"CH":"1901":_) = "swissgerman"
1171+toBabel ("de":"CH":_) = "nswissgerman"
1169toBabel ("de":_) = "ngerman"
1172toBabel ("de":_) = "ngerman"
1170toBabel ("dsb":_) = "lowersorbian"
1173toBabel ("dsb":_) = "lowersorbian"
1171toBabel ("el":"polyton":_) = "polutonikogreek"
1174toBabel ("el":"polyton":_) = "polutonikogreek"
@@ -1179,7 +1182,7 @@ toBabel ("fr":"CA":_) = "canadien"
1179toBabel ("fra":"aca":_) = "acadian"
1182toBabel ("fra":"aca":_) = "acadian"
1180toBabel ("grc":_) = "polutonikogreek"
1183toBabel ("grc":_) = "polutonikogreek"
1181toBabel ("hsb":_) = "uppersorbian"
1184toBabel ("hsb":_) = "uppersorbian"
1182−toBabel ("la":"x-classic":_) = "classiclatin"
1185+toBabel ("la":"x":"classic":_) = "classiclatin"
1183toBabel ("sl":_) = "slovene"
1186toBabel ("sl":_) = "slovene"
1184toBabel x = commonFromBcp47 x
1187toBabel x = commonFromBcp47 x
1185
1188
@@ -1188,12 +1191,15 @@ toBabel x = commonFromBcp47 x
1188-- https://tools.ietf.org/html/bcp47#section-2.1
1191-- https://tools.ietf.org/html/bcp47#section-2.1
1189commonFromBcp47 :: [String] -> String
1192commonFromBcp47 :: [String] -> String
1190commonFromBcp47 [] = ""
1193commonFromBcp47 [] = ""
1191−commonFromBcp47 ("pt":"BR":_) = "brazilian"
1194+commonFromBcp47 ("pt":"BR":_) = "brazilian"
1195+commonFromBcp47 ("sr":"Cyrl":_) = "serbianc"
1196+commonFromBcp47 ("zh":"Latn":"pinyin":_) = "pinyin"
1192commonFromBcp47 x = fromIso $ head x
1197commonFromBcp47 x = fromIso $ head x
1193 where
1198 where
1194 fromIso "af" = "afrikaans"
1199 fromIso "af" = "afrikaans"
1195 fromIso "am" = "amharic"
1200 fromIso "am" = "amharic"
1196 fromIso "ar" = "arabic"
1201 fromIso "ar" = "arabic"
1202+ fromIso "as" = "assamese"
1197 fromIso "ast" = "asturian"
1203 fromIso "ast" = "asturian"
1198 fromIso "bg" = "bulgarian"
1204 fromIso "bg" = "bulgarian"
1199 fromIso "bn" = "bengali"
1205 fromIso "bn" = "bengali"
@@ -1217,12 +1223,13 @@ commonFromBcp47 x = fromIso $ head x
1217 fromIso "fur" = "friulan"
1223 fromIso "fur" = "friulan"
1218 fromIso "ga" = "irish"
1224 fromIso "ga" = "irish"
1219 fromIso "gd" = "scottish"
1225 fromIso "gd" = "scottish"
1226+ fromIso "gez" = "ethiopic"
1220 fromIso "gl" = "galician"
1227 fromIso "gl" = "galician"
1221 fromIso "he" = "hebrew"
1228 fromIso "he" = "hebrew"
1222 fromIso "hi" = "hindi"
1229 fromIso "hi" = "hindi"
1223 fromIso "hr" = "croatian"
1230 fromIso "hr" = "croatian"
1224− fromIso "hy" = "armenian"
1225 fromIso "hu" = "magyar"
1231 fromIso "hu" = "magyar"
1232+ fromIso "hy" = "armenian"
1226 fromIso "ia" = "interlingua"
1233 fromIso "ia" = "interlingua"
1227 fromIso "id" = "indonesian"
1234 fromIso "id" = "indonesian"
1228 fromIso "ie" = "interlingua"
1235 fromIso "ie" = "interlingua"
@@ -1230,6 +1237,7 @@ commonFromBcp47 x = fromIso $ head x
1230 fromIso "it" = "italian"
1237 fromIso "it" = "italian"
1231 fromIso "jp" = "japanese"
1238 fromIso "jp" = "japanese"
1232 fromIso "km" = "khmer"
1239 fromIso "km" = "khmer"
1240+ fromIso "kmr" = "kurmanji"
1233 fromIso "kn" = "kannada"
1241 fromIso "kn" = "kannada"
1234 fromIso "ko" = "korean"
1242 fromIso "ko" = "korean"
1235 fromIso "la" = "latin"
1243 fromIso "la" = "latin"
@@ -1245,6 +1253,7 @@ commonFromBcp47 x = fromIso $ head x
1245 fromIso "no" = "norsk"
1253 fromIso "no" = "norsk"
1246 fromIso "nqo" = "nko"
1254 fromIso "nqo" = "nko"
1247 fromIso "oc" = "occitan"
1255 fromIso "oc" = "occitan"
1256+ fromIso "pa" = "panjabi"
1248 fromIso "pl" = "polish"
1257 fromIso "pl" = "polish"
1249 fromIso "pms" = "piedmontese"
1258 fromIso "pms" = "piedmontese"
1250 fromIso "pt" = "portuguese"
1259 fromIso "pt" = "portuguese"
@@ -1261,6 +1270,7 @@ commonFromBcp47 x = fromIso $ head x
1261 fromIso "ta" = "tamil"
1270 fromIso "ta" = "tamil"
1262 fromIso "te" = "telugu"
1271 fromIso "te" = "telugu"
1263 fromIso "th" = "thai"
1272 fromIso "th" = "thai"
1273+ fromIso "ti" = "ethiopic"
1264 fromIso "tk" = "turkmen"
1274 fromIso "tk" = "turkmen"
1265 fromIso "tr" = "turkish"
1275 fromIso "tr" = "turkish"
1266 fromIso "uk" = "ukrainian"
1276 fromIso "uk" = "ukrainian"
tests/writers-lang-and-dir.latex+1−1
@@ -27,7 +27,7 @@
27 breaklinks=true}
27 breaklinks=true}
28\urlstyle{same} % don't use monospace font for urls
28\urlstyle{same} % don't use monospace font for urls
29\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
29\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}
31 \newcommand{\textgerman}[2][]{\foreignlanguage{ngerman}{#2}}
31 \newcommand{\textgerman}[2][]{\foreignlanguage{ngerman}{#2}}
32 \newenvironment{german}[1]{\begin{otherlanguage}{ngerman}}{\end{otherlanguage}}
32 \newenvironment{german}[1]{\begin{otherlanguage}{ngerman}}{\end{otherlanguage}}
33 \newcommand{\textenglish}[2][]{\foreignlanguage{british}{#2}}
33 \newcommand{\textenglish}[2][]{\foreignlanguage{british}{#2}}