@@ -57,6 +57,7 @@ import Text.Pandoc.Parsing hiding (blankline, many, mathDisplay, mathInline,
57import Text.Pandoc.Readers.LaTeX.Types (ExpansionPoint (..), Macro (..),
57import Text.Pandoc.Readers.LaTeX.Types (ExpansionPoint (..), Macro (..),
58 ArgSpec (..), Tok (..), TokType (..))
58 ArgSpec (..), Tok (..), TokType (..))
59import Text.Pandoc.Readers.LaTeX.Parsing
59import Text.Pandoc.Readers.LaTeX.Parsing
60+import Text.Pandoc.Readers.LaTeX.Accent (accentCommands)
60import Text.Pandoc.Readers.LaTeX.Lang (polyglossiaLangToBCP47,
61import Text.Pandoc.Readers.LaTeX.Lang (polyglossiaLangToBCP47,
61 babelLangToBCP47)
62 babelLangToBCP47)
62import Text.Pandoc.Readers.LaTeX.SIunitx
63import Text.Pandoc.Readers.LaTeX.SIunitx
@@ -64,7 +65,6 @@ import Text.Pandoc.Shared
64import qualified Text.Pandoc.Translations as Translations
65import qualified Text.Pandoc.Translations as Translations
65import Text.Pandoc.Walk
66import Text.Pandoc.Walk
66import qualified Text.Pandoc.Builder as B
67import qualified Text.Pandoc.Builder as B
67−import qualified Data.Text.Normalize as Normalize
68import Safe
68import Safe
70-- for debugging:
70-- for debugging:
@@ -247,9 +247,6 @@ doxspace =
247 startsWithLetter _ = False
247 startsWithLetter _ = False
250−lit :: Text -> LP m Inlines
253removeDoubleQuotes :: Text -> Text
250removeDoubleQuotes :: Text -> Text
254removeDoubleQuotes t =
251removeDoubleQuotes t =
255 Data.Maybe.fromMaybe t $ T.stripPrefix "\"" t >>= T.stripSuffix "\""
252 Data.Maybe.fromMaybe t $ T.stripPrefix "\"" t >>= T.stripSuffix "\""
@@ -296,6 +293,9 @@ quoted' f starter ender = do
296 cs -> cs)
293 cs -> cs)
297 else lit startchs
294 else lit startchs
296+lit :: Text -> LP m Inlines
299enquote :: PandocMonad m => Bool -> Maybe Text -> LP m Inlines
299enquote :: PandocMonad m => Bool -> Maybe Text -> LP m Inlines
300enquote starred mblang = do
300enquote starred mblang = do
@@ -631,7 +631,10 @@ inlineEnvironments = M.fromList [
633inlineCommands :: PandocMonad m => M.Map Text (LP m Inlines)
633inlineCommands :: PandocMonad m => M.Map Text (LP m Inlines)
634−inlineCommands = M.union inlineLanguageCommands $ M.fromList
635+ M.union inlineLanguageCommands $
636+ M.union (accentCommands tok) $
635 [ ("emph", extractSpaces emph <$> tok)
638 [ ("emph", extractSpaces emph <$> tok)
636 , ("textit", extractSpaces emph <$> tok)
639 , ("textit", extractSpaces emph <$> tok)
637 , ("textsl", extractSpaces emph <$> tok)
640 , ("textsl", extractSpaces emph <$> tok)
@@ -703,48 +706,6 @@ inlineCommands = M.union inlineLanguageCommands $ M.fromList
703 , ("MakeTextLowercase", makeLowercase <$> tok)
706 , ("MakeTextLowercase", makeLowercase <$> tok)
704 , ("lowercase", makeLowercase <$> tok)
707 , ("lowercase", makeLowercase <$> tok)
705 , ("/", pure mempty) -- italic correction
708 , ("/", pure mempty) -- italic correction
717− , ("pounds", lit "£")
719− , ("copyright", lit "©")
720− , ("textasciicircum", lit "^")
721− , ("textasciitilde", lit "~")
722− , ("H", accent '\779' Nothing) -- hungarumlaut
723− , ("`", accent '\768' (Just '`')) -- grave
724− , ("'", accent '\769' (Just '\'')) -- acute
725− , ("^", accent '\770' (Just '^')) -- circ
726− , ("~", accent '\771' (Just '~')) -- tilde
727− , ("\"", accent '\776' Nothing) -- umlaut
728− , (".", accent '\775' Nothing) -- dot
729− , ("=", accent '\772' Nothing) -- macron
730− , ("|", accent '\781' Nothing) -- vertical line above
731− , ("b", accent '\817' Nothing) -- macron below
732− , ("c", accent '\807' Nothing) -- cedilla
733− , ("G", accent '\783' Nothing) -- doublegrave
734− , ("h", accent '\777' Nothing) -- hookabove
735− , ("d", accent '\803' Nothing) -- dotbelow
736− , ("f", accent '\785' Nothing) -- inverted breve
737− , ("r", accent '\778' Nothing) -- ringabove
738− , ("t", accent '\865' Nothing) -- double inverted breve
739− , ("U", accent '\782' Nothing) -- double vertical line above
740− , ("v", accent '\780' Nothing) -- hacek
741− , ("u", accent '\774' Nothing) -- breve
742− , ("k", accent '\808' Nothing) -- ogonek
743− , ("textogonekcentered", accent '\808' Nothing) -- ogonek
744− , ("i", lit "ı") -- dotless i
745− , ("j", lit "ȷ") -- dotless j
746− , ("newtie", accent '\785' Nothing) -- inverted breve
747− , ("textcircled", accent '\8413' Nothing) -- combining circle
748 , ("\\", linebreak <$ (do inTableCell <- sInTableCell <$> getState
709 , ("\\", linebreak <$ (do inTableCell <- sInTableCell <$> getState
749 guard $ not inTableCell
710 guard $ not inTableCell
750 optional opt
711 optional opt
@@ -960,19 +921,6 @@ inlineCommands = M.union inlineLanguageCommands $ M.fromList
960 , ("hyphen", pure (str "-"))
921 , ("hyphen", pure (str "-"))
963−accent :: PandocMonad m => Char -> Maybe Char -> LP m Inlines
964−accent combiningAccent fallBack = try $ do
967− (Str (T.uncons -> Just (x, xs)) : ys) -> return $ fromList $
968− -- try to normalize to the combined character:
969− Str (Normalize.normalize Normalize.NFC
970− (T.pack [x, combiningAccent]) <> xs) : ys
971− [Space] -> return $ str $ T.singleton $ fromMaybe combiningAccent fallBack
972− [] -> return $ str $ T.singleton $ fromMaybe combiningAccent fallBack
976lettrine :: PandocMonad m => LP m Inlines
924lettrine :: PandocMonad m => LP m Inlines
977lettrine = do
925lettrine = do
978 optional opt
926 optional opt