@@ -34,7 +34,7 @@ import qualified Data.Set as Set
3434import Data.Text (Text)
3535import qualified Data.Text as T
3636import System.FilePath (addExtension, replaceExtension, takeExtension)
37−import Text.Pandoc.BCP47 (Lang (..), renderLang)
37+import Text.Pandoc.BCP47 (renderLang)
3838import Text.Pandoc.Builder as B
3939import Text.Pandoc.Class.PandocPure (PandocPure)
4040import Text.Pandoc.Class.PandocMonad (PandocMonad (..), getResourcePath,
@@ -58,11 +58,12 @@ import Text.Pandoc.Readers.LaTeX.Math (dollarsMath, inlineEnvironments,
5858 theoremEnvironment)
5959import Text.Pandoc.Readers.LaTeX.Table (tableEnvironments)
6060import Text.Pandoc.Readers.LaTeX.Macro (macroDef)
61−import Text.Pandoc.Readers.LaTeX.Lang (polyglossiaLangToBCP47,
61+import Text.Pandoc.Readers.LaTeX.Lang (inlineLanguageCommands,
6262 babelLangToBCP47, setDefaultLanguage)
6363import Text.Pandoc.Readers.LaTeX.SIunitx (siunitxCommands)
6464import Text.Pandoc.Readers.LaTeX.Inline (acronymCommands, refCommands,
6565 nameCommands, charCommands,
66+ biblatexInlineCommands,
6667 verbCommands, rawInlineOr,
6768 listingsLanguage)
6869import Text.Pandoc.Shared
@@ -350,8 +351,7 @@ unescapeURL = T.concat . go . T.splitOn "\\"
350351
351352inlineCommands :: PandocMonad m => M.Map Text (LP m Inlines)
352353inlineCommands = M.unions
353− [ inlineLanguageCommands
354− , accentCommands tok
354+ [ accentCommands tok
355355 , citationCommands inline
356356 , siunitxCommands tok
357357 , acronymCommands
@@ -359,6 +359,8 @@ inlineCommands = M.unions
359359 , nameCommands
360360 , verbCommands
361361 , charCommands
362+ , inlineLanguageCommands tok
363+ , biblatexInlineCommands tok
362364 , rest ]
363365 where
364366 rest = M.fromList
@@ -373,12 +375,6 @@ inlineCommands = M.unions
373375 , ("texttt", ttfamily)
374376 , ("sout", extractSpaces strikeout <$> tok)
375377 , ("alert", skipopts >> spanWith ("",["alert"],[]) <$> tok) -- beamer
376− , ("lq", return (str "‘"))
377− , ("rq", return (str "’"))
378− , ("textquoteleft", return (str "‘"))
379− , ("textquoteright", return (str "’"))
380− , ("textquotedblleft", return (str "“"))
381− , ("textquotedblright", return (str "”"))
382378 , ("textsuperscript", extractSpaces superscript <$> tok)
383379 , ("textsubscript", extractSpaces subscript <$> tok)
384380 , ("textbf", extractSpaces strong <$> tok)
@@ -447,11 +443,6 @@ inlineCommands = M.unions
447443 , ("toggletrue", braced >>= setToggle True)
448444 , ("togglefalse", braced >>= setToggle False)
449445 , ("iftoggle", try $ ifToggle >> inline)
450− -- biblatex misc
451− , ("RN", romanNumeralUpper)
452− , ("Rn", romanNumeralLower)
453− -- babel
454− , ("foreignlanguage", foreignlanguage)
455446 -- include
456447 , ("input", rawInlineOr "input" $ include "input")
457448 -- soul package
@@ -460,24 +451,6 @@ inlineCommands = M.unions
460451 , ("uline", underline <$> tok)
461452 -- plain tex stuff that should just be passed through as raw tex
462453 , ("ifdim", ifdim)
463− -- bibtex
464− , ("mkbibquote", spanWith nullAttr . doubleQuoted <$> tok)
465− , ("mkbibemph", spanWith nullAttr . emph <$> tok)
466− , ("mkbibitalic", spanWith nullAttr . emph <$> tok)
467− , ("mkbibbold", spanWith nullAttr . strong <$> tok)
468− , ("mkbibparens",
469− spanWith nullAttr . (\x -> str "(" <> x <> str ")") <$> tok)
470− , ("mkbibbrackets",
471− spanWith nullAttr . (\x -> str "[" <> x <> str "]") <$> tok)
472− , ("autocap", spanWith nullAttr <$> tok)
473− , ("textnormal", spanWith ("",["nodecor"],[]) <$> tok)
474− , ("bibstring",
475− (\x -> spanWith ("",[],[("bibstring",x)]) (str x)) . untokenize
476− <$> braced)
477− , ("adddot", pure (str "."))
478− , ("adddotspace", pure (spanWith nullAttr (str "." <> space)))
479− , ("addabbrvspace", pure space)
480− , ("hyphen", pure (str "-"))
481454 ]
482455
483456lettrine :: PandocMonad m => LP m Inlines
@@ -502,26 +475,6 @@ alterStr :: (Text -> Text) -> Inline -> Inline
502475alterStr f (Str xs) = Str (f xs)
503476alterStr _ x = x
504477
505−foreignlanguage :: PandocMonad m => LP m Inlines
506−foreignlanguage = do
507− babelLang <- untokenize <$> braced
508− case babelLangToBCP47 babelLang of
509− Just lang -> spanWith ("", [], [("lang", renderLang lang)]) <$> tok
510− _ -> tok
511−
512−inlineLanguageCommands :: PandocMonad m => M.Map Text (LP m Inlines)
513−inlineLanguageCommands = M.fromList $ mk <$> M.toList polyglossiaLangToBCP47
514− where
515− mk (polyglossia, bcp47Func) =
516− ("text" <> polyglossia, inlineLanguage bcp47Func)
517−
518−inlineLanguage :: PandocMonad m => (Text -> Lang) -> LP m Inlines
519−inlineLanguage bcp47Func = do
520− o <- option "" $ T.filter (\c -> c /= '[' && c /= ']')
521− <$> rawopt
522− let lang = renderLang $ bcp47Func o
523− extractSpaces (spanWith ("", [], [("lang", lang)])) <$> tok
524−
525478hyperlink :: PandocMonad m => LP m Inlines
526479hyperlink = try $ do
527480 src <- untokenize <$> braced
@@ -542,31 +495,6 @@ hypertargetInline = try $ do
542495 ils <- grouped inline
543496 return $ spanWith (ref, [], []) ils
544497
545−romanNumeralUpper :: (PandocMonad m) => LP m Inlines
546−romanNumeralUpper =
547− str . toRomanNumeral <$> romanNumeralArg
548−
549−romanNumeralLower :: (PandocMonad m) => LP m Inlines
550−romanNumeralLower =
551− str . T.toLower . toRomanNumeral <$> romanNumeralArg
552−
553−romanNumeralArg :: (PandocMonad m) => LP m Int
554−romanNumeralArg = spaces *> (parser <|> inBraces)
555− where
556− inBraces = do
557− symbol '{'
558− spaces
559− res <- parser
560− spaces
561− symbol '}'
562− return res
563− parser = do
564− s <- untokenize <$> many1 (satisfyTok isWordTok)
565− let (digits, rest) = T.span isDigit s
566− unless (T.null rest) $
567− Prelude.fail "Non-digits in argument to \\Rn or \\RN"
568− safeRead digits
569−
570498newToggle :: (Monoid a, PandocMonad m) => [Tok] -> LP m a
571499newToggle name = do
572500 updateState $ \st ->