Include trailing {}s in raw latex commands.
Change is in rawLaTeXInline in LaTeX reader, but it affects the markdown reader and other readers that allow raw LaTeX. Previously, trailing `{}` would be included for unknown commands, but not for known commands. However, they are sometimes used to avoid a trailing space after the command. The chances that a `{}` after a LaTeX command is not part of the command are very small. Closes #5439.
This commit is contained in:
parent
ad9770fe86
commit
10615420de
2 changed files with 13 additions and 2 deletions
|
@ -155,10 +155,15 @@ rawLaTeXInline :: (PandocMonad m, HasMacros s, HasReaderOptions s)
|
|||
=> ParserT String s m String
|
||||
rawLaTeXInline = do
|
||||
lookAhead (try (char '\\' >> letter))
|
||||
snd <$> ( rawLaTeXParser True
|
||||
raw <- snd <$>
|
||||
( rawLaTeXParser True
|
||||
(mempty <$ (controlSeq "input" >> skipMany opt >> braced))
|
||||
inlines
|
||||
<|> rawLaTeXParser True (inlineEnvironment <|> inlineCommand') inlines)
|
||||
<|> rawLaTeXParser True (inlineEnvironment <|> inlineCommand')
|
||||
inlines
|
||||
)
|
||||
finalbraces <- mconcat <$> many (try (string "{}")) -- see #5439
|
||||
return $ raw <> finalbraces
|
||||
|
||||
inlineCommand :: PandocMonad m => ParserT String ParserState m Inlines
|
||||
inlineCommand = do
|
||||
|
|
6
test/command/5439.md
Normal file
6
test/command/5439.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
```
|
||||
% pandoc -t latex
|
||||
namespace\fshyp{}container
|
||||
^D
|
||||
namespace\fshyp{}container
|
||||
```
|
Loading…
Add table
Reference in a new issue