LaTeX reader: support etoolbox's ifstrequal.
This commit is contained in:
parent
e7876d4320
commit
329b61ff5c
2 changed files with 23 additions and 0 deletions
|
@ -1316,8 +1316,21 @@ inlineCommands = M.fromList $
|
|||
, ("faClose", lit "\10007")
|
||||
-- xspace
|
||||
, ("xspace", doxspace)
|
||||
-- etoolbox
|
||||
, ("ifstrequal", ifstrequal)
|
||||
]
|
||||
|
||||
ifstrequal :: PandocMonad m => LP m Inlines
|
||||
ifstrequal = do
|
||||
str1 <- tok
|
||||
str2 <- tok
|
||||
ifequal <- braced
|
||||
ifnotequal <- braced
|
||||
if str1 == str2
|
||||
then getInput >>= setInput . (ifequal ++)
|
||||
else getInput >>= setInput . (ifnotequal ++)
|
||||
return mempty
|
||||
|
||||
ttfamily :: PandocMonad m => LP m Inlines
|
||||
ttfamily = (code . stringify . toList) <$> tok
|
||||
|
||||
|
|
10
test/command/ifstrequal.md
Normal file
10
test/command/ifstrequal.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
```
|
||||
% pandoc -f latex -t native
|
||||
\ifstrequal{a}{b}{yes}{\emph{no}}
|
||||
\newcommand{\h}[1]{\ifstrequal{#1}{a}{\'a}{#1}}
|
||||
\h{a}
|
||||
\h{b}
|
||||
^D
|
||||
[Para [Emph [Str "no"]]
|
||||
,Para [Str "\225",SoftBreak,Str "b"]]
|
||||
```
|
Loading…
Add table
Reference in a new issue