Fixed two bugs in HTML reader:

+ <code>...</code> not surrounded by <pre> should count as
  inline HTML, not code block.
+ parser for minimized attributes should not swallow trailing spaces


git-svn-id: https://pandoc.googlecode.com/svn/trunk@1015 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
fiddlosopher 2007-09-14 22:40:28 +00:00
parent 85f655c8cb
commit 28c2ee396c

View file

@ -151,8 +151,7 @@ htmlAttribute = htmlRegularAttribute <|> htmlMinimizedAttribute
htmlMinimizedAttribute = try $ do htmlMinimizedAttribute = try $ do
many1 space many1 space
name <- many1 (choice [letter, oneOf ".-_:"]) name <- many1 (choice [letter, oneOf ".-_:"])
spaces notFollowedBy (spaces >> char '=')
notFollowedBy (char '=')
let content = name let content = name
return (name, content, (" " ++ name)) return (name, content, (" " ++ name))
@ -319,19 +318,13 @@ hrule = try $ do
-- code blocks -- code blocks
-- --
codeBlock = preCodeBlock <|> bareCodeBlock <?> "code block" codeBlock = try $ do
preCodeBlock = try $ do
htmlTag "pre" htmlTag "pre"
spaces spaces
result <- bareCodeBlock
spaces
htmlEndTag "pre"
return result
bareCodeBlock = try $ do
htmlTag "code" htmlTag "code"
result <- manyTill anyChar (htmlEndTag "code") result <- manyTill anyChar (htmlEndTag "code")
spaces
htmlEndTag "pre"
return $ CodeBlock $ stripTrailingNewlines $ return $ CodeBlock $ stripTrailingNewlines $
decodeCharacterReferences result decodeCharacterReferences result