aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/LaTeX
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2021-05-16 21:33:32 +0200
committerGitHub <noreply@github.com>2021-05-16 12:33:32 -0700
commitd92622ba3cae5ced69a256472d367a53fc5878a1 (patch)
tree47c5ee2f2700ac4e5a45e797fe05f536fb07af00 /src/Text/Pandoc/Writers/LaTeX
parent5a6399d9f62c4306fa073ae1311675158dd6a203 (diff)
downloadpandoc-d92622ba3cae5ced69a256472d367a53fc5878a1.tar.gz
LaTeX template: define commands for zero width non-joiner character
Closes: #6639 The zero-width non-joiner character is used to avoid ligatures (e.g. in German).
Diffstat (limited to 'src/Text/Pandoc/Writers/LaTeX')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX/Types.hs3
-rw-r--r--src/Text/Pandoc/Writers/LaTeX/Util.hs7
2 files changed, 6 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX/Types.hs b/src/Text/Pandoc/Writers/LaTeX/Types.hs
index d598794ad..c06b7e923 100644
--- a/src/Text/Pandoc/Writers/LaTeX/Types.hs
+++ b/src/Text/Pandoc/Writers/LaTeX/Types.hs
@@ -40,7 +40,7 @@ data WriterState =
, stCsquotes :: Bool -- ^ true if document uses csquotes
, stHighlighting :: Bool -- ^ true if document has highlighted code
, stIncremental :: Bool -- ^ true if beamer lists should be
- -- displayed bit by bit
+ , stZwnj :: Bool -- ^ true if document has a ZWNJ character
, stInternalLinks :: [Text] -- ^ list of internal link targets
, stBeamer :: Bool -- ^ produce beamer
, stEmptyLine :: Bool -- ^ true if no content on line
@@ -74,6 +74,7 @@ startingState options =
, stCsquotes = False
, stHighlighting = False
, stIncremental = writerIncremental options
+ , stZwnj = False
, stInternalLinks = []
, stBeamer = False
, stEmptyLine = True
diff --git a/src/Text/Pandoc/Writers/LaTeX/Util.hs b/src/Text/Pandoc/Writers/LaTeX/Util.hs
index 56bb792ae..c34338121 100644
--- a/src/Text/Pandoc/Writers/LaTeX/Util.hs
+++ b/src/Text/Pandoc/Writers/LaTeX/Util.hs
@@ -22,6 +22,7 @@ module Text.Pandoc.Writers.LaTeX.Util (
where
import Control.Applicative ((<|>))
+import Control.Monad (when)
import Text.Pandoc.Class (PandocMonad, toLang)
import Text.Pandoc.Options (WriterOptions(..), isEnabled)
import Text.Pandoc.Writers.LaTeX.Types (LW, WriterState(..))
@@ -30,7 +31,7 @@ import Text.Pandoc.Highlighting (toListingsLanguage)
import Text.DocLayout
import Text.Pandoc.Definition
import Text.Pandoc.ImageSize (showFl)
-import Control.Monad.State.Strict (gets)
+import Control.Monad.State.Strict (gets, modify)
import Data.Text (Text)
import qualified Data.Text as T
import Text.Pandoc.Extensions (Extension(Ext_smart))
@@ -49,6 +50,8 @@ data StringContext = TextString
stringToLaTeX :: PandocMonad m => StringContext -> Text -> LW m Text
stringToLaTeX context zs = do
opts <- gets stOptions
+ when ('\x200c' `elemText` zs) $
+ modify (\s -> s { stZwnj = True })
return $ T.pack $
foldr (go opts context) mempty $ T.unpack $
if writerPreferAscii opts
@@ -270,5 +273,3 @@ mbBraced :: Text -> Text
mbBraced x = if not (T.all isAlphaNum x)
then "{" <> x <> "}"
else x
-
-