{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}
module Text.Pandoc.Readers.LaTeX.Inline
( acronymCommands
, verbCommands
, charCommands
, accentCommands
, miscCommands
, nameCommands
, biblatexInlineCommands
, refCommands
, rawInlineOr
, listingsLanguage
)
where
import qualified Data.Map as M
import Data.Text (Text)
import qualified Data.Text as T
import Text.Pandoc.Builder
import Text.Pandoc.Shared (toRomanNumeral, safeRead)
import Text.Pandoc.TeX (Tok (..), TokType (..))
import Control.Applicative (optional, (<|>))
import Control.Monad (guard, mzero, mplus, unless)
import Text.Pandoc.Class.PandocMonad (PandocMonad (..))
import Text.Pandoc.Translations (translateTerm)
import Text.Pandoc.Readers.LaTeX.Parsing
import Text.Pandoc.Extensions (extensionEnabled, Extension(..))
import Text.Pandoc.Parsing (getOption, updateState, getState, notFollowedBy,
manyTill, getInput, setInput, incSourceColumn,
option, many1)
import Data.Char (isDigit)
import Text.Pandoc.Highlighting (fromListingsLanguage,)
import Data.Maybe (maybeToList, fromMaybe)
import Text.Pandoc.Options (ReaderOptions(..))
import qualified Data.Text.Normalize as Normalize
import qualified Text.Pandoc.Translations as Translations
rawInlineOr :: PandocMonad m => Text -> LP m Inlines -> LP m Inlines
rawInlineOr :: forall (m :: * -> *).
PandocMonad m =>
Text -> LP m (Many Inline) -> LP m (Many Inline)
rawInlineOr Text
name' LP m (Many Inline)
fallback = do
parseRaw <- Extension -> Extensions -> Bool
extensionEnabled Extension
Ext_raw_tex (Extensions -> Bool)
-> ParsecT TokStream LaTeXState m Extensions
-> ParsecT TokStream LaTeXState m Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ReaderOptions -> Extensions)
-> ParsecT TokStream LaTeXState m Extensions
forall st s (m :: * -> *) t b.
(HasReaderOptions st, Stream s m t) =>
(ReaderOptions -> b) -> ParsecT s st m b
forall s (m :: * -> *) t b.
Stream s m t =>
(ReaderOptions -> b) -> ParsecT s LaTeXState m b
getOption ReaderOptions -> Extensions
readerExtensions
if parseRaw
then rawInline "latex" <$> getRawCommand name' ("\\" <> name')
else fallback
dolabel :: PandocMonad m => LP m Inlines
dolabel :: forall (m :: * -> *). PandocMonad m => LP m (Many Inline)
dolabel = do
v <- LP m [Tok]
forall (m :: * -> *). PandocMonad m => LP m [Tok]
braced
let refstr = [Tok] -> Text
untokenize [Tok]
v
updateState $ \LaTeXState
st ->
LaTeXState
st{ sLastLabel = Just refstr }
return $ spanWith (refstr,[],[("label", refstr)]) mempty
doref :: PandocMonad m => Text -> LP m Inlines
doref :: forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doref Text
cls = do
v <- LP m [Tok]
forall (m :: * -> *). PandocMonad m => LP m [Tok]
braced
let refstr = [Tok] -> Text
untokenize [Tok]
v
return $ linkWith ("",[],[ ("reference-type", cls)
, ("reference", refstr)])
("#" <> refstr)
""
(inBrackets $ str refstr)
inBrackets :: Inlines -> Inlines
inBrackets :: Many Inline -> Many Inline
inBrackets Many Inline
x = Text -> Many Inline
str Text
"[" Many Inline -> Many Inline -> Many Inline
forall a. Semigroup a => a -> a -> a
<> Many Inline
x Many Inline -> Many Inline -> Many Inline
forall a. Semigroup a => a -> a -> a
<> Text -> Many Inline
str Text
"]"
doTerm :: PandocMonad m => Translations.Term -> LP m Inlines
doTerm :: forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
term = Text -> Many Inline
str (Text -> Many Inline)
-> ParsecT TokStream LaTeXState m Text
-> ParsecT TokStream LaTeXState m (Many Inline)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Term -> ParsecT TokStream LaTeXState m Text
forall (m :: * -> *). PandocMonad m => Term -> m Text
translateTerm Term
term
lit :: Text -> LP m Inlines
lit :: forall (m :: * -> *). Text -> LP m (Many Inline)
lit = Many Inline -> ParsecT TokStream LaTeXState m (Many Inline)
forall a. a -> ParsecT TokStream LaTeXState m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Many Inline -> ParsecT TokStream LaTeXState m (Many Inline))
-> (Text -> Many Inline)
-> Text
-> ParsecT TokStream LaTeXState m (Many Inline)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Many Inline
str
doverb :: PandocMonad m => LP m Inlines
doverb :: forall (m :: * -> *). PandocMonad m => LP m (Many Inline)
doverb = do
Tok _ Symbol t <- LP m Tok
forall (m :: * -> *). PandocMonad m => LP m Tok
anySymbol
marker <- case T.uncons t of
Just (Char
c, Text
ts) | Text -> Bool
T.null Text
ts -> Char -> ParsecT TokStream LaTeXState m Char
forall a. a -> ParsecT TokStream LaTeXState m a
forall (m :: * -> *) a. Monad m => a -> m a
return Char
c
Maybe (Char, Text)
_ -> ParsecT TokStream LaTeXState m Char
forall a. ParsecT TokStream LaTeXState m a
forall (m :: * -> *) a. MonadPlus m => m a
mzero
withVerbatimMode $
code . untokenize <$>
manyTill (notFollowedBy newlineTok >> verbTok marker) (symbol marker)
verbTok :: PandocMonad m => Char -> LP m Tok
verbTok :: forall (m :: * -> *). PandocMonad m => Char -> LP m Tok
verbTok Char
stopchar = do
t@(Tok pos toktype txt) <- LP m Tok
forall (m :: * -> *). PandocMonad m => LP m Tok
anyTok
case T.findIndex (== stopchar) txt of
Maybe Int
Nothing -> Tok -> LP m Tok
forall a. a -> ParsecT TokStream LaTeXState m a
forall (m :: * -> *) a. Monad m => a -> m a
return Tok
t
Just Int
i -> do
let (Text
t1, Text
t2) = Int -> Text -> (Text, Text)
T.splitAt Int
i Text
txt
TokStream macrosExpanded inp <- ParsecT TokStream LaTeXState m TokStream
forall (m :: * -> *) s u. Monad m => ParsecT s u m s
getInput
setInput $ TokStream macrosExpanded
$ Tok (incSourceColumn pos i) Symbol (T.singleton stopchar)
: tokenize (incSourceColumn pos (i + 1)) (T.drop 1 t2) ++ inp
return $ Tok pos toktype t1
listingsLanguage :: [(Text, Text)] -> Maybe Text
listingsLanguage :: [(Text, Text)] -> Maybe Text
listingsLanguage [(Text, Text)]
opts =
case Text -> [(Text, Text)] -> Maybe Text
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup Text
"language" [(Text, Text)]
opts of
Maybe Text
Nothing -> Maybe Text
forall a. Maybe a
Nothing
Just Text
l -> Text -> Maybe Text
fromListingsLanguage Text
l Maybe Text -> Maybe Text -> Maybe Text
forall a. Maybe a -> Maybe a -> Maybe a
forall (m :: * -> *) a. MonadPlus m => m a -> m a -> m a
`mplus` Text -> Maybe Text
forall a. a -> Maybe a
Just Text
l
dolstinline :: PandocMonad m => LP m Inlines
dolstinline :: forall (m :: * -> *). PandocMonad m => LP m (Many Inline)
dolstinline = do
options <- [(Text, Text)]
-> ParsecT TokStream LaTeXState m [(Text, Text)]
-> ParsecT TokStream LaTeXState m [(Text, Text)]
forall s (m :: * -> *) t a u.
Stream s m t =>
a -> ParsecT s u m a -> ParsecT s u m a
option [] ParsecT TokStream LaTeXState m [(Text, Text)]
forall (m :: * -> *). PandocMonad m => LP m [(Text, Text)]
keyvals
let classes = Maybe Text -> [Text]
forall a. Maybe a -> [a]
maybeToList (Maybe Text -> [Text]) -> Maybe Text -> [Text]
forall a b. (a -> b) -> a -> b
$ [(Text, Text)] -> Maybe Text
listingsLanguage [(Text, Text)]
options
doinlinecode classes
domintinline :: PandocMonad m => LP m Inlines
domintinline :: forall (m :: * -> *). PandocMonad m => LP m (Many Inline)
domintinline = do
LP m ()
forall (m :: * -> *). PandocMonad m => LP m ()
skipopts
cls <- [Tok] -> Text
untokenize ([Tok] -> Text)
-> ParsecT TokStream LaTeXState m [Tok]
-> ParsecT TokStream LaTeXState m Text
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT TokStream LaTeXState m [Tok]
forall (m :: * -> *). PandocMonad m => LP m [Tok]
braced
doinlinecode [cls]
doinlinecode :: PandocMonad m => [Text] -> LP m Inlines
doinlinecode :: forall (m :: * -> *). PandocMonad m => [Text] -> LP m (Many Inline)
doinlinecode [Text]
classes = do
Tok _ Symbol t <- LP m Tok
forall (m :: * -> *). PandocMonad m => LP m Tok
anySymbol
marker <- case T.uncons t of
Just (Char
c, Text
ts) | Text -> Bool
T.null Text
ts -> Char -> ParsecT TokStream LaTeXState m Char
forall a. a -> ParsecT TokStream LaTeXState m a
forall (m :: * -> *) a. Monad m => a -> m a
return Char
c
Maybe (Char, Text)
_ -> ParsecT TokStream LaTeXState m Char
forall a. ParsecT TokStream LaTeXState m a
forall (m :: * -> *) a. MonadPlus m => m a
mzero
let stopchar = if Char
marker Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
'{' then Char
'}' else Char
marker
withVerbatimMode $
codeWith ("",classes,[]) . T.map nlToSpace . untokenize <$>
manyTill (verbTok stopchar) (symbol stopchar)
nlToSpace :: Char -> Char
nlToSpace :: Char -> Char
nlToSpace Char
'\n' = Char
' '
nlToSpace Char
x = Char
x
romanNumeralUpper :: (PandocMonad m) => LP m Inlines
romanNumeralUpper :: forall (m :: * -> *). PandocMonad m => LP m (Many Inline)
romanNumeralUpper =
Text -> Many Inline
str (Text -> Many Inline) -> (Int -> Text) -> Int -> Many Inline
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Text
toRomanNumeral (Int -> Many Inline)
-> ParsecT TokStream LaTeXState m Int
-> ParsecT TokStream LaTeXState m (Many Inline)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT TokStream LaTeXState m Int
forall (m :: * -> *). PandocMonad m => LP m Int
romanNumeralArg
romanNumeralLower :: (PandocMonad m) => LP m Inlines
romanNumeralLower :: forall (m :: * -> *). PandocMonad m => LP m (Many Inline)
romanNumeralLower =
Text -> Many Inline
str (Text -> Many Inline) -> (Int -> Text) -> Int -> Many Inline
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Text
T.toLower (Text -> Text) -> (Int -> Text) -> Int -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Text
toRomanNumeral (Int -> Many Inline)
-> ParsecT TokStream LaTeXState m Int
-> ParsecT TokStream LaTeXState m (Many Inline)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT TokStream LaTeXState m Int
forall (m :: * -> *). PandocMonad m => LP m Int
romanNumeralArg
romanNumeralArg :: (PandocMonad m) => LP m Int
romanNumeralArg :: forall (m :: * -> *). PandocMonad m => LP m Int
romanNumeralArg = LP m ()
forall (m :: * -> *). PandocMonad m => LP m ()
spaces LP m ()
-> ParsecT TokStream LaTeXState m Int
-> ParsecT TokStream LaTeXState m Int
forall a b.
ParsecT TokStream LaTeXState m a
-> ParsecT TokStream LaTeXState m b
-> ParsecT TokStream LaTeXState m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (ParsecT TokStream LaTeXState m Int
parser ParsecT TokStream LaTeXState m Int
-> ParsecT TokStream LaTeXState m Int
-> ParsecT TokStream LaTeXState m Int
forall a.
ParsecT TokStream LaTeXState m a
-> ParsecT TokStream LaTeXState m a
-> ParsecT TokStream LaTeXState m a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> ParsecT TokStream LaTeXState m Int
inBraces)
where
inBraces :: ParsecT TokStream LaTeXState m Int
inBraces = do
Char -> LP m Tok
forall (m :: * -> *). PandocMonad m => Char -> LP m Tok
symbol Char
'{'
LP m ()
forall (m :: * -> *). PandocMonad m => LP m ()
spaces
res <- ParsecT TokStream LaTeXState m Int
parser
spaces
symbol '}'
return res
parser :: ParsecT TokStream LaTeXState m Int
parser = do
s <- [Tok] -> Text
untokenize ([Tok] -> Text)
-> ParsecT TokStream LaTeXState m [Tok]
-> ParsecT TokStream LaTeXState m Text
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LP m Tok -> ParsecT TokStream LaTeXState m [Tok]
forall s u (m :: * -> *) a. ParsecT s u m a -> ParsecT s u m [a]
many1 ((Tok -> Bool) -> LP m Tok
forall (m :: * -> *). PandocMonad m => (Tok -> Bool) -> LP m Tok
satisfyTok Tok -> Bool
isWordTok)
let (digits, rest) = T.span isDigit s
unless (T.null rest) $
Prelude.fail "Non-digits in argument to \\Rn or \\RN"
safeRead digits
accentWith :: PandocMonad m
=> LP m Inlines -> Char -> Maybe Char -> LP m Inlines
accentWith :: forall (m :: * -> *).
PandocMonad m =>
LP m (Many Inline) -> Char -> Maybe Char -> LP m (Many Inline)
accentWith LP m (Many Inline)
tok Char
combiningAccent Maybe Char
fallBack = do
ils <- Many Inline -> LP m (Many Inline) -> LP m (Many Inline)
forall s (m :: * -> *) t a u.
Stream s m t =>
a -> ParsecT s u m a -> ParsecT s u m a
option Many Inline
forall a. Monoid a => a
mempty LP m (Many Inline)
tok
case toList ils of
(Str (Text -> Maybe (Char, Text)
T.uncons -> Just (Char
x, Text
xs)) : [Inline]
ys) -> Many Inline -> LP m (Many Inline)
forall a. a -> ParsecT TokStream LaTeXState m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Many Inline -> LP m (Many Inline))
-> Many Inline -> LP m (Many Inline)
forall a b. (a -> b) -> a -> b
$ [Inline] -> Many Inline
forall a. [a] -> Many a
fromList ([Inline] -> Many Inline) -> [Inline] -> Many Inline
forall a b. (a -> b) -> a -> b
$
Text -> Inline
Str (NormalizationMode -> Text -> Text
Normalize.normalize NormalizationMode
Normalize.NFC
(String -> Text
T.pack [Char
x, Char
combiningAccent]) Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
xs) Inline -> [Inline] -> [Inline]
forall a. a -> [a] -> [a]
: [Inline]
ys
[Inline
Space] -> Many Inline -> LP m (Many Inline)
forall a. a -> ParsecT TokStream LaTeXState m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Many Inline -> LP m (Many Inline))
-> Many Inline -> LP m (Many Inline)
forall a b. (a -> b) -> a -> b
$ Text -> Many Inline
str (Text -> Many Inline) -> Text -> Many Inline
forall a b. (a -> b) -> a -> b
$ Char -> Text
T.singleton
(Char -> Text) -> Char -> Text
forall a b. (a -> b) -> a -> b
$ Char -> Maybe Char -> Char
forall a. a -> Maybe a -> a
fromMaybe Char
combiningAccent Maybe Char
fallBack
[] -> Many Inline -> LP m (Many Inline)
forall a. a -> ParsecT TokStream LaTeXState m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Many Inline -> LP m (Many Inline))
-> Many Inline -> LP m (Many Inline)
forall a b. (a -> b) -> a -> b
$ Text -> Many Inline
str (Text -> Many Inline) -> Text -> Many Inline
forall a b. (a -> b) -> a -> b
$ Char -> Text
T.singleton
(Char -> Text) -> Char -> Text
forall a b. (a -> b) -> a -> b
$ Char -> Maybe Char -> Char
forall a. a -> Maybe a -> a
fromMaybe Char
combiningAccent Maybe Char
fallBack
[Inline]
_ -> Many Inline -> LP m (Many Inline)
forall a. a -> ParsecT TokStream LaTeXState m a
forall (m :: * -> *) a. Monad m => a -> m a
return Many Inline
ils
verbCommands :: PandocMonad m => M.Map Text (LP m Inlines)
verbCommands :: forall (m :: * -> *).
PandocMonad m =>
Map Text (LP m (Many Inline))
verbCommands = [(Text, LP m (Many Inline))] -> Map Text (LP m (Many Inline))
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList
[ (Text
"verb", LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => LP m (Many Inline)
doverb)
, (Text
"lstinline", LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => LP m (Many Inline)
dolstinline)
, (Text
"mintinline", LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => LP m (Many Inline)
domintinline)
, (Text
"Verb", LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => LP m (Many Inline)
doverb)
]
miscCommands :: PandocMonad m => M.Map Text (LP m Inlines)
miscCommands :: forall (m :: * -> *).
PandocMonad m =>
Map Text (LP m (Many Inline))
miscCommands =
[(Text, LP m (Many Inline))] -> Map Text (LP m (Many Inline))
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList
[ (Text
"pounds", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"£")
, (Text
"euro", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"€")
, (Text
"copyright", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"©")
, (Text
"textasciicircum", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"^")
, (Text
"textasciitilde", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"~")
, (Text
"textbaht", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"฿")
, (Text
"textblank", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"␢")
, (Text
"textbigcircle", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"○")
, (Text
"textbrokenbar", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"¦")
, (Text
"textbullet", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"•")
, (Text
"textcentoldstyle", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"¢")
, (Text
"textcopyright", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"©")
, (Text
"textdagger", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"†")
, (Text
"textdegree", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"°")
, (Text
"textdollar", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"$")
, (Text
"textdong", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"₫")
, (Text
"textlira", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"₤")
, (Text
"textmu", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"μ")
, (Text
"textmusicalnote", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"♪")
, (Text
"textonehalf", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"½")
, (Text
"textonequarter", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"¼")
, (Text
"textparagraph", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"¶")
, (Text
"textpertenthousand", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"‱")
, (Text
"textpeso", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"₱")
, (Text
"textquotesingle", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"'")
, (Text
"textregistered", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"®")
, (Text
"textsection", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"§")
, (Text
"textsterling", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"£")
, (Text
"textthreequarters", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"¾")
, (Text
"textthreesuperior", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"³")
, (Text
"texttwosuperior", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"²")
, (Text
"textyen", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"¥")
]
accentCommands :: PandocMonad m => LP m Inlines -> M.Map Text (LP m Inlines)
accentCommands :: forall (m :: * -> *).
PandocMonad m =>
LP m (Many Inline) -> Map Text (LP m (Many Inline))
accentCommands LP m (Many Inline)
tok =
let accent :: Char -> Maybe Char -> LP m (Many Inline)
accent = LP m (Many Inline) -> Char -> Maybe Char -> LP m (Many Inline)
forall (m :: * -> *).
PandocMonad m =>
LP m (Many Inline) -> Char -> Maybe Char -> LP m (Many Inline)
accentWith LP m (Many Inline)
tok
in [(Text, LP m (Many Inline))] -> Map Text (LP m (Many Inline))
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList
[ (Text
"aa", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"å")
, (Text
"AA", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"Å")
, (Text
"ss", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"ß")
, (Text
"o", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"ø")
, (Text
"O", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"Ø")
, (Text
"L", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"Ł")
, (Text
"l", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"ł")
, (Text
"ae", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"æ")
, (Text
"AE", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"Æ")
, (Text
"oe", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"œ")
, (Text
"OE", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"Œ")
, (Text
"H", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\779' Maybe Char
forall a. Maybe a
Nothing)
, (Text
"`", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\768' (Char -> Maybe Char
forall a. a -> Maybe a
Just Char
'`'))
, (Text
"'", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\769' (Char -> Maybe Char
forall a. a -> Maybe a
Just Char
'\''))
, (Text
"^", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\770' (Char -> Maybe Char
forall a. a -> Maybe a
Just Char
'^'))
, (Text
"~", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\771' (Char -> Maybe Char
forall a. a -> Maybe a
Just Char
'~'))
, (Text
"\"", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\776' Maybe Char
forall a. Maybe a
Nothing)
, (Text
".", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\775' Maybe Char
forall a. Maybe a
Nothing)
, (Text
"=", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\772' Maybe Char
forall a. Maybe a
Nothing)
, (Text
"|", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\781' Maybe Char
forall a. Maybe a
Nothing)
, (Text
"b", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\817' Maybe Char
forall a. Maybe a
Nothing)
, (Text
"c", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\807' Maybe Char
forall a. Maybe a
Nothing)
, (Text
"G", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\783' Maybe Char
forall a. Maybe a
Nothing)
, (Text
"h", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\777' Maybe Char
forall a. Maybe a
Nothing)
, (Text
"d", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\803' Maybe Char
forall a. Maybe a
Nothing)
, (Text
"f", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\785' Maybe Char
forall a. Maybe a
Nothing)
, (Text
"r", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\778' Maybe Char
forall a. Maybe a
Nothing)
, (Text
"t", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\865' Maybe Char
forall a. Maybe a
Nothing)
, (Text
"U", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\782' Maybe Char
forall a. Maybe a
Nothing)
, (Text
"v", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\780' Maybe Char
forall a. Maybe a
Nothing)
, (Text
"u", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\774' Maybe Char
forall a. Maybe a
Nothing)
, (Text
"k", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\808' Maybe Char
forall a. Maybe a
Nothing)
, (Text
"textogonekcentered", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\808' Maybe Char
forall a. Maybe a
Nothing)
, (Text
"i", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"ı")
, (Text
"j", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"ȷ")
, (Text
"newtie", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\785' Maybe Char
forall a. Maybe a
Nothing)
, (Text
"textcircled", Char -> Maybe Char -> LP m (Many Inline)
accent Char
'\8413' Maybe Char
forall a. Maybe a
Nothing)
]
charCommands :: PandocMonad m => M.Map Text (LP m Inlines)
charCommands :: forall (m :: * -> *).
PandocMonad m =>
Map Text (LP m (Many Inline))
charCommands = [(Text, LP m (Many Inline))] -> Map Text (LP m (Many Inline))
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList
[ (Text
"ldots", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"…")
, (Text
"vdots", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"\8942")
, (Text
"dots", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"…")
, (Text
"mdots", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"…")
, (Text
"sim", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"~")
, (Text
"sep", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
",")
, (Text
"P", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"¶")
, (Text
"S", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"§")
, (Text
"$", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"$")
, (Text
"%", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"%")
, (Text
"&", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"&")
, (Text
"#", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"#")
, (Text
"_", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"_")
, (Text
"{", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"{")
, (Text
"}", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"}")
, (Text
"-", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"\x00ad")
, (Text
"qed", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"\a0\x25FB")
, (Text
"lq", Many Inline -> LP m (Many Inline)
forall a. a -> ParsecT TokStream LaTeXState m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Text -> Many Inline
str Text
"‘"))
, (Text
"rq", Many Inline -> LP m (Many Inline)
forall a. a -> ParsecT TokStream LaTeXState m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Text -> Many Inline
str Text
"’"))
, (Text
"textquoteleft", Many Inline -> LP m (Many Inline)
forall a. a -> ParsecT TokStream LaTeXState m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Text -> Many Inline
str Text
"‘"))
, (Text
"textquoteright", Many Inline -> LP m (Many Inline)
forall a. a -> ParsecT TokStream LaTeXState m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Text -> Many Inline
str Text
"’"))
, (Text
"textquotedblleft", Many Inline -> LP m (Many Inline)
forall a. a -> ParsecT TokStream LaTeXState m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Text -> Many Inline
str Text
"“"))
, (Text
"textquotedblright", Many Inline -> LP m (Many Inline)
forall a. a -> ParsecT TokStream LaTeXState m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Text -> Many Inline
str Text
"”"))
, (Text
"/", Many Inline -> LP m (Many Inline)
forall a. a -> ParsecT TokStream LaTeXState m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Many Inline
forall a. Monoid a => a
mempty)
, (Text
"\\", Many Inline
linebreak Many Inline
-> ParsecT TokStream LaTeXState m () -> LP m (Many Inline)
forall a b.
a
-> ParsecT TokStream LaTeXState m b
-> ParsecT TokStream LaTeXState m a
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ (do inTableCell <- LaTeXState -> Bool
sInTableCell (LaTeXState -> Bool)
-> ParsecT TokStream LaTeXState m LaTeXState
-> ParsecT TokStream LaTeXState m Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT TokStream LaTeXState m LaTeXState
forall (m :: * -> *) s u. Monad m => ParsecT s u m u
getState
guard $ not inTableCell
optional rawopt
spaces))
, (Text
",", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"\8198")
, (Text
"@", Many Inline -> LP m (Many Inline)
forall a. a -> ParsecT TokStream LaTeXState m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Many Inline
forall a. Monoid a => a
mempty)
, (Text
" ", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"\160")
, (Text
"ps", Many Inline -> LP m (Many Inline)
forall a. a -> ParsecT TokStream LaTeXState m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Many Inline -> LP m (Many Inline))
-> Many Inline -> LP m (Many Inline)
forall a b. (a -> b) -> a -> b
$ Text -> Many Inline
str Text
"PS." Many Inline -> Many Inline -> Many Inline
forall a. Semigroup a => a -> a -> a
<> Many Inline
space)
, (Text
"TeX", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"TeX")
, (Text
"LaTeX", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"LaTeX")
, (Text
"bar", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"|")
, (Text
"textless", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"<")
, (Text
"textgreater", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
">")
, (Text
"textbackslash", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"\\")
, (Text
"backslash", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"\\")
, (Text
"slash", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"/")
, (Text
"faCheck", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"\10003")
, (Text
"faClose", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"\10007")
, (Text
"bshyp", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"\\\173")
, (Text
"fshyp", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"/\173")
, (Text
"dothyp", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
".\173")
, (Text
"colonhyp", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
":\173")
, (Text
"hyp", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"-")
, (Text
"glq", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"‚")
, (Text
"grq", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"‘")
, (Text
"glqq", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"„")
, (Text
"grqq", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"“")
, (Text
"flq", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"‹")
, (Text
"frq", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"›")
, (Text
"flqq", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"«")
, (Text
"frqq", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"»")
, (Text
"dq", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"\"")
, (Text
"guillemetleft", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"«")
, (Text
"guillemotleft", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"«")
, (Text
"guillemetright", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"»")
, (Text
"guillemotright", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"»")
, (Text
"guilsinglleft", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"‹")
, (Text
"guilsinglright", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"›")
, (Text
"quotedblbase", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"„")
, (Text
"quotesinglbase", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
",")
, (Text
"textquotedbl", Text -> LP m (Many Inline)
forall (m :: * -> *). Text -> LP m (Many Inline)
lit Text
"\"")
]
biblatexInlineCommands :: PandocMonad m
=> LP m Inlines -> M.Map Text (LP m Inlines)
biblatexInlineCommands :: forall (m :: * -> *).
PandocMonad m =>
LP m (Many Inline) -> Map Text (LP m (Many Inline))
biblatexInlineCommands LP m (Many Inline)
tok = [(Text, LP m (Many Inline))] -> Map Text (LP m (Many Inline))
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList
[ (Text
"RN", LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => LP m (Many Inline)
romanNumeralUpper)
, (Text
"Rn", LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => LP m (Many Inline)
romanNumeralLower)
, (Text
"mkbibquote", Attr -> Many Inline -> Many Inline
spanWith Attr
nullAttr (Many Inline -> Many Inline)
-> (Many Inline -> Many Inline) -> Many Inline -> Many Inline
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Many Inline -> Many Inline
doubleQuoted (Many Inline -> Many Inline)
-> LP m (Many Inline) -> LP m (Many Inline)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LP m (Many Inline)
tok)
, (Text
"mkbibemph", Attr -> Many Inline -> Many Inline
spanWith Attr
nullAttr (Many Inline -> Many Inline)
-> (Many Inline -> Many Inline) -> Many Inline -> Many Inline
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Many Inline -> Many Inline
emph (Many Inline -> Many Inline)
-> LP m (Many Inline) -> LP m (Many Inline)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LP m (Many Inline)
tok)
, (Text
"mkbibitalic", Attr -> Many Inline -> Many Inline
spanWith Attr
nullAttr (Many Inline -> Many Inline)
-> (Many Inline -> Many Inline) -> Many Inline -> Many Inline
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Many Inline -> Many Inline
emph (Many Inline -> Many Inline)
-> LP m (Many Inline) -> LP m (Many Inline)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LP m (Many Inline)
tok)
, (Text
"mkbibbold", Attr -> Many Inline -> Many Inline
spanWith Attr
nullAttr (Many Inline -> Many Inline)
-> (Many Inline -> Many Inline) -> Many Inline -> Many Inline
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Many Inline -> Many Inline
strong (Many Inline -> Many Inline)
-> LP m (Many Inline) -> LP m (Many Inline)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LP m (Many Inline)
tok)
, (Text
"mkbibparens",
Attr -> Many Inline -> Many Inline
spanWith Attr
nullAttr (Many Inline -> Many Inline)
-> (Many Inline -> Many Inline) -> Many Inline -> Many Inline
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (\Many Inline
x -> Text -> Many Inline
str Text
"(" Many Inline -> Many Inline -> Many Inline
forall a. Semigroup a => a -> a -> a
<> Many Inline
x Many Inline -> Many Inline -> Many Inline
forall a. Semigroup a => a -> a -> a
<> Text -> Many Inline
str Text
")") (Many Inline -> Many Inline)
-> LP m (Many Inline) -> LP m (Many Inline)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LP m (Many Inline)
tok)
, (Text
"mkbibbrackets",
Attr -> Many Inline -> Many Inline
spanWith Attr
nullAttr (Many Inline -> Many Inline)
-> (Many Inline -> Many Inline) -> Many Inline -> Many Inline
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (\Many Inline
x -> Text -> Many Inline
str Text
"[" Many Inline -> Many Inline -> Many Inline
forall a. Semigroup a => a -> a -> a
<> Many Inline
x Many Inline -> Many Inline -> Many Inline
forall a. Semigroup a => a -> a -> a
<> Text -> Many Inline
str Text
"]") (Many Inline -> Many Inline)
-> LP m (Many Inline) -> LP m (Many Inline)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LP m (Many Inline)
tok)
, (Text
"autocap", Attr -> Many Inline -> Many Inline
spanWith Attr
nullAttr (Many Inline -> Many Inline)
-> LP m (Many Inline) -> LP m (Many Inline)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LP m (Many Inline)
tok)
, (Text
"textnormal", Attr -> Many Inline -> Many Inline
spanWith (Text
"",[Text
"nodecor"],[]) (Many Inline -> Many Inline)
-> LP m (Many Inline) -> LP m (Many Inline)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LP m (Many Inline)
tok)
, (Text
"bibstring",
(\Text
x -> Attr -> Many Inline -> Many Inline
spanWith (Text
"",[],[(Text
"bibstring",Text
x)]) (Text -> Many Inline
str Text
x)) (Text -> Many Inline) -> ([Tok] -> Text) -> [Tok] -> Many Inline
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Tok] -> Text
untokenize
([Tok] -> Many Inline)
-> ParsecT TokStream LaTeXState m [Tok] -> LP m (Many Inline)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ParsecT TokStream LaTeXState m [Tok]
forall (m :: * -> *). PandocMonad m => LP m [Tok]
braced)
, (Text
"adddot", Many Inline -> LP m (Many Inline)
forall a. a -> ParsecT TokStream LaTeXState m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Text -> Many Inline
str Text
"."))
, (Text
"adddotspace", Many Inline -> LP m (Many Inline)
forall a. a -> ParsecT TokStream LaTeXState m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Attr -> Many Inline -> Many Inline
spanWith Attr
nullAttr (Text -> Many Inline
str Text
"." Many Inline -> Many Inline -> Many Inline
forall a. Semigroup a => a -> a -> a
<> Many Inline
space)))
, (Text
"addabbrvspace", Many Inline -> LP m (Many Inline)
forall a. a -> ParsecT TokStream LaTeXState m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Many Inline
space)
, (Text
"hyphen", Many Inline -> LP m (Many Inline)
forall a. a -> ParsecT TokStream LaTeXState m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Text -> Many Inline
str Text
"-"))
]
nameCommands :: PandocMonad m => M.Map Text (LP m Inlines)
nameCommands :: forall (m :: * -> *).
PandocMonad m =>
Map Text (LP m (Many Inline))
nameCommands = [(Text, LP m (Many Inline))] -> Map Text (LP m (Many Inline))
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList
[ (Text
"figurename", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.Figure)
, (Text
"prefacename", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.Preface)
, (Text
"refname", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.References)
, (Text
"bibname", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.Bibliography)
, (Text
"chaptername", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.Chapter)
, (Text
"partname", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.Part)
, (Text
"contentsname", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.Contents)
, (Text
"listfigurename", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.ListOfFigures)
, (Text
"listtablename", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.ListOfTables)
, (Text
"indexname", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.Index)
, (Text
"abstractname", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.Abstract)
, (Text
"tablename", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.Table)
, (Text
"enclname", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.Encl)
, (Text
"ccname", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.Cc)
, (Text
"headtoname", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.To)
, (Text
"pagename", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.Page)
, (Text
"seename", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.See)
, (Text
"seealsoname", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.SeeAlso)
, (Text
"proofname", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.Proof)
, (Text
"glossaryname", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.Glossary)
, (Text
"lstlistingname", Term -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Term -> LP m (Many Inline)
doTerm Term
Translations.Listing)
]
refCommands :: PandocMonad m => M.Map Text (LP m Inlines)
refCommands :: forall (m :: * -> *).
PandocMonad m =>
Map Text (LP m (Many Inline))
refCommands = [(Text, LP m (Many Inline))] -> Map Text (LP m (Many Inline))
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList
[ (Text
"label", Text -> LP m (Many Inline) -> LP m (Many Inline)
forall (m :: * -> *).
PandocMonad m =>
Text -> LP m (Many Inline) -> LP m (Many Inline)
rawInlineOr Text
"label" LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => LP m (Many Inline)
dolabel)
, (Text
"ref", Text -> LP m (Many Inline) -> LP m (Many Inline)
forall (m :: * -> *).
PandocMonad m =>
Text -> LP m (Many Inline) -> LP m (Many Inline)
rawInlineOr Text
"ref" (LP m (Many Inline) -> LP m (Many Inline))
-> LP m (Many Inline) -> LP m (Many Inline)
forall a b. (a -> b) -> a -> b
$ Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doref Text
"ref")
, (Text
"cref", Text -> LP m (Many Inline) -> LP m (Many Inline)
forall (m :: * -> *).
PandocMonad m =>
Text -> LP m (Many Inline) -> LP m (Many Inline)
rawInlineOr Text
"cref" (LP m (Many Inline) -> LP m (Many Inline))
-> LP m (Many Inline) -> LP m (Many Inline)
forall a b. (a -> b) -> a -> b
$ Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doref Text
"ref+label")
, (Text
"Cref", Text -> LP m (Many Inline) -> LP m (Many Inline)
forall (m :: * -> *).
PandocMonad m =>
Text -> LP m (Many Inline) -> LP m (Many Inline)
rawInlineOr Text
"Cref" (LP m (Many Inline) -> LP m (Many Inline))
-> LP m (Many Inline) -> LP m (Many Inline)
forall a b. (a -> b) -> a -> b
$ Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doref Text
"ref+Label")
, (Text
"vref", Text -> LP m (Many Inline) -> LP m (Many Inline)
forall (m :: * -> *).
PandocMonad m =>
Text -> LP m (Many Inline) -> LP m (Many Inline)
rawInlineOr Text
"vref" (LP m (Many Inline) -> LP m (Many Inline))
-> LP m (Many Inline) -> LP m (Many Inline)
forall a b. (a -> b) -> a -> b
$ Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doref Text
"ref")
, (Text
"eqref", Text -> LP m (Many Inline) -> LP m (Many Inline)
forall (m :: * -> *).
PandocMonad m =>
Text -> LP m (Many Inline) -> LP m (Many Inline)
rawInlineOr Text
"eqref" (LP m (Many Inline) -> LP m (Many Inline))
-> LP m (Many Inline) -> LP m (Many Inline)
forall a b. (a -> b) -> a -> b
$ Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doref Text
"eqref")
, (Text
"autoref", Text -> LP m (Many Inline) -> LP m (Many Inline)
forall (m :: * -> *).
PandocMonad m =>
Text -> LP m (Many Inline) -> LP m (Many Inline)
rawInlineOr Text
"autoref" (LP m (Many Inline) -> LP m (Many Inline))
-> LP m (Many Inline) -> LP m (Many Inline)
forall a b. (a -> b) -> a -> b
$ Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doref Text
"ref+label")
]
acronymCommands :: PandocMonad m => M.Map Text (LP m Inlines)
acronymCommands :: forall (m :: * -> *).
PandocMonad m =>
Map Text (LP m (Many Inline))
acronymCommands = [(Text, LP m (Many Inline))] -> Map Text (LP m (Many Inline))
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList
[ (Text
"gls", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"short")
, (Text
"Gls", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"short")
, (Text
"glsdesc", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"long")
, (Text
"Glsdesc", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"long")
, (Text
"GLSdesc", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"long")
, (Text
"acrlong", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"long")
, (Text
"Acrlong", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"long")
, (Text
"acrfull", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"full")
, (Text
"Acrfull", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"full")
, (Text
"acrshort", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"abbrv")
, (Text
"Acrshort", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"abbrv")
, (Text
"glspl", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronymPlural Text
"short")
, (Text
"Glspl", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronymPlural Text
"short")
, (Text
"glsdescplural", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronymPlural Text
"long")
, (Text
"Glsdescplural", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronymPlural Text
"long")
, (Text
"GLSdescplural", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronymPlural Text
"long")
, (Text
"ac", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"short")
, (Text
"acf", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"full")
, (Text
"acs", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"abbrv")
, (Text
"acl", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"long")
, (Text
"acp", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronymPlural Text
"short")
, (Text
"acfp", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronymPlural Text
"full")
, (Text
"acsp", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronymPlural Text
"abbrv")
, (Text
"aclp", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronymPlural Text
"long")
, (Text
"Ac", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"short")
, (Text
"Acf", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"full")
, (Text
"Acs", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"abbrv")
, (Text
"Acl", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
"long")
, (Text
"Acp", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronymPlural Text
"short")
, (Text
"Acfp", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronymPlural Text
"full")
, (Text
"Acsp", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronymPlural Text
"abbrv")
, (Text
"Aclp", Text -> LP m (Many Inline)
forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronymPlural Text
"long")
]
doAcronym :: PandocMonad m => Text -> LP m Inlines
doAcronym :: forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronym Text
form = do
acro <- LP m [Tok]
forall (m :: * -> *). PandocMonad m => LP m [Tok]
braced
return . mconcat $ [spanWith ("",[],[("acronym-label", untokenize acro),
("acronym-form", "singular+" <> form)])
$ str $ untokenize acro]
doAcronymPlural :: PandocMonad m => Text -> LP m Inlines
doAcronymPlural :: forall (m :: * -> *). PandocMonad m => Text -> LP m (Many Inline)
doAcronymPlural Text
form = do
acro <- LP m [Tok]
forall (m :: * -> *). PandocMonad m => LP m [Tok]
braced
let plural = Text -> Many Inline
str Text
"s"
return . mconcat $ [spanWith ("",[],[("acronym-label", untokenize acro),
("acronym-form", "plural+" <> form)]) $
mconcat [str $ untokenize acro, plural]]