LaTeX reader: Parse {groups} as Span.

This is needed for accurate conversion of bibtex titles,
since we need to know what was protected from titlecase conversions.
This commit is contained in:
John MacFarlane
2013-09-28 11:53:34 -07:00
parent b97f1136cd
commit 9e7072cf1b
+10 -1
View File
@@ -176,7 +176,7 @@ inline = (mempty <$ comment)
<|> (space <$ sp)
<|> inlineText
<|> inlineCommand
<|> grouped inline
<|> inlineGroup
<|> (char '-' *> option (str "-")
((char '-') *> option (str "–") (str "—" <$ char '-')))
<|> double_quote
@@ -199,6 +199,15 @@ inline = (mempty <$ comment)
inlines :: LP Inlines
inlines = mconcat <$> many (notFollowedBy (char '}') *> inline)
inlineGroup :: LP Inlines
inlineGroup = do
ils <- grouped inline
if isNull ils
then return mempty
else return $ spanWith nullAttr ils
-- we need the span so we can detitlecase bibtex entries;
-- we need to know when something is {C}apitalized
block :: LP Blocks
block = (mempty <$ comment)
<|> (mempty <$ ((spaceChar <|> newline) *> spaces))