aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-02-08 17:18:08 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-02-08 17:18:08 -0800
commit24f7076622c967f79811f37ee10296f8a4ed8a41 (patch)
tree30c253cdb9bfd7b0fd975b3c1b0dbc7b25126ed6 /src/Text/Pandoc/Readers
parentef5dcae211476f55415bb7b7c96f6c3ff8da2249 (diff)
downloadpandoc-24f7076622c967f79811f37ee10296f8a4ed8a41.tar.gz
Improvements to markdown attributes syntax (on code blocks).
(1) Attributes can contain line breaks. (2) Values in key-value attributes can be surrounded by either double or single quotes, or left unquoted if they contain no spaces.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 31db51028..666265935 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -390,8 +390,8 @@ blockDelimiter f len = try $ do
attributes :: GenParser Char st ([Char], [[Char]], [([Char], [Char])])
attributes = try $ do
char '{'
- many spaceChar
- attrs <- many (attribute >>~ many spaceChar)
+ spnl
+ attrs <- many (attribute >>~ spnl)
char '}'
let (ids, classes, keyvals) = unzip3 attrs
let firstNonNull [] = ""
@@ -424,8 +424,9 @@ keyValAttr :: GenParser Char st ([Char], [a], [([Char], [Char])])
keyValAttr = try $ do
key <- identifier
char '='
- char '"'
- val <- manyTill (satisfy (/='\n')) (char '"')
+ val <- enclosed (char '"') (char '"') anyChar
+ <|> enclosed (char '\'') (char '\'') anyChar
+ <|> many nonspaceChar
return ("",[],[(key,val)])
codeBlockDelimited :: GenParser Char st Block