diff options
| author | John MacFarlane <[email protected]> | 2024-06-10 19:33:43 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2024-06-10 19:33:43 -0700 |
| commit | cd9753d4af6286dfdd8e587314d1204f8e76801b (patch) | |
| tree | f3d5e92b542b45913934339dccb918a3a11fa064 /src/Text | |
| parent | c9a3f5466e42ec984b5f105bb9b2023407b44997 (diff) | |
LaTeX writer/template: specify language option for `selnolig`...
...and only include it if `english` or `german` is used.
Since 3d8f011, the babel language is not specified as a
class option any more; so now we need to explicitly specify
the language option when we load `selnolig`. Only `german`
and `english` are valid, so we construct the variable
`selnolig-langs` in the writer and include `selnolig` if it
is nonempty.
This should restore proper ligature suppression when
lualatex is used.
Closes #9863. Supersedes #9864.
Thanks to @fkohrt for the initial fix.
Diffstat (limited to 'src/Text')
| -rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 2e6cd6649..bbd8591a7 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -33,13 +33,14 @@ import Control.Monad import Data.Containers.ListUtils (nubOrd) import Data.Char (isDigit) import Data.List (intersperse, (\\)) -import Data.Maybe (catMaybes, fromMaybe, isJust, mapMaybe, isNothing) +import Data.Maybe (catMaybes, fromMaybe, isJust, mapMaybe, isNothing, + maybeToList) import Data.Monoid (Any (..)) import Data.Text (Text) import qualified Data.Text as T import Network.URI (unEscapeString) import Text.DocTemplates (FromContext(lookupContext), renderTemplate) -import Text.Collate.Lang (renderLang) +import Text.Collate.Lang (renderLang, Lang(langLanguage)) import Text.Pandoc.Class.PandocMonad (PandocMonad, report, toLang) import Text.Pandoc.Definition import Text.Pandoc.Highlighting (formatLaTeXBlock, formatLaTeXInline, highlight, @@ -262,6 +263,11 @@ pandocToLaTeX options (Pandoc meta blocks) = do (map literal (nubOrd . catMaybes . filter (/= babelLang) $ map toBabel docLangs)) + $ defField "selnolig-langs" + (literal . T.intercalate "," $ + let langs = docLangs ++ maybeToList mblang + in (["english" | any ((== "en") . langLanguage) langs] ++ + ["german" | any ((== "de") . langLanguage) langs])) $ defField "latex-dir-rtl" ((render Nothing <$> getField "dir" context) == Just ("rtl" :: Text)) context |
