diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2012-02-04 12:51:27 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2012-02-04 12:51:27 -0800 |
commit | 1e772aa59c85fb94fe59a287c11d7c4a85b1c579 (patch) | |
tree | 4910761cdb59981cb4d14e222374f2b7423d0e94 /src/Text/Pandoc | |
parent | e58d5bf08769106557b52c4d224f6b70139322ce (diff) | |
download | pandoc-1e772aa59c85fb94fe59a287c11d7c4a85b1c579.tar.gz |
LaTeX reader: small bug fixes.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 79819e249..d74bfe983 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -139,8 +139,10 @@ double_quote = (doubleQuoted . mconcat) <$> (try $ string "``" *> manyTill inline (try $ string "''")) single_quote :: LP Inlines -single_quote = (singleQuoted . mconcat) <$> - (try $ char '`' *> manyTill inline (try $ char '\'' >> notFollowedBy letter)) +single_quote = char '`' *> + ( try ((singleQuoted . mconcat) <$> + manyTill inline (try $ char '\'' >> notFollowedBy letter)) + <|> lit "`") inline :: LP Inlines inline = (mempty <$ comment) @@ -161,7 +163,8 @@ inline = (mempty <$ comment) <|> (failUnlessLHS *> char '|' *> doLHSverb) <|> (str <$> count 1 tildeEscape) <|> (str <$> string "]") - <|> (str <$> count 1 (satisfy (\c -> c /= '\\' && c /='\n' && c /='}' && c /='{'))) -- eat random leftover characters + <|> (str <$> string "#") -- TODO print warning? + -- <|> (str <$> count 1 (satisfy (\c -> c /= '\\' && c /='\n' && c /='}' && c /='{'))) -- eat random leftover characters inlines :: LP Inlines inlines = mconcat <$> many (notFollowedBy (char '}') *> inline) @@ -174,6 +177,7 @@ block = (mempty <$ comment) <|> blockCommand <|> grouped block <|> paragraph + <|> (mempty <$ char '&') -- loose & in table environment blocks :: LP Blocks @@ -790,23 +794,21 @@ parseTableRow cols = try $ do guard $ length cells' == cols spaces optional $ controlSeq "\\" + spaces return cells' -parseTableHeader :: Int -- ^ number of columns - -> LP [Blocks] -parseTableHeader cols = try $ parseTableRow cols <* hline - simpTable :: LP Blocks simpTable = try $ do spaces aligns <- parseAligns let cols = length aligns optional hline - header' <- option [] $ parseTableHeader cols + header' <- option [] $ try (parseTableRow cols <* hline) rows <- many (parseTableRow cols <* optional hline) spaces let header'' = if null header' then replicate cols mempty else header' + lookAhead $ controlSeq "end" -- make sure we're at end return $ table mempty (zip aligns (repeat 0)) header'' rows |