Added support for multiple classes in delimited code block.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1204 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
parent
b06ddad4bc
commit
046c6b0d0d
1 changed files with 8 additions and 7 deletions
|
@ -303,23 +303,24 @@ codeBlockDelimiter len = try $ do
|
||||||
Nothing -> count 3 (char '~') >> many (char '~') >>=
|
Nothing -> count 3 (char '~') >> many (char '~') >>=
|
||||||
return . (+ 3) . length
|
return . (+ 3) . length
|
||||||
many spaceChar
|
many spaceChar
|
||||||
lang <- option "" classAttribute
|
lang <- option "" classAttributes
|
||||||
blankline
|
blankline
|
||||||
return (size, lang)
|
return (size, lang)
|
||||||
|
|
||||||
classAttribute = try $ do
|
classAttributes = try $ do
|
||||||
char '{'
|
char '{'
|
||||||
many spaceChar
|
many spaceChar
|
||||||
char '.'
|
attrs <- many $ do char '.'
|
||||||
attr <- many1 alphaNum
|
attr <- many1 alphaNum
|
||||||
many spaceChar
|
many spaceChar
|
||||||
|
return attr
|
||||||
char '}'
|
char '}'
|
||||||
return attr
|
return $ unwords attrs
|
||||||
|
|
||||||
codeBlockDelimited = try $ do
|
codeBlockDelimited = try $ do
|
||||||
(size, lang) <- codeBlockDelimiter Nothing
|
(size, lang) <- codeBlockDelimiter Nothing
|
||||||
contents <- manyTill anyLine (codeBlockDelimiter (Just size))
|
contents <- manyTill anyLine (codeBlockDelimiter (Just size))
|
||||||
return $ CodeBlock lang $ concat contents
|
return $ CodeBlock lang $ joinWithSep "\n" contents
|
||||||
|
|
||||||
codeBlockIndented = do
|
codeBlockIndented = do
|
||||||
contents <- many1 (indentedLine <|>
|
contents <- many1 (indentedLine <|>
|
||||||
|
|
Loading…
Reference in a new issue