aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Textile.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-10-29 22:45:52 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-01-09 09:30:05 -0800
commitd599c4cdabd0d71fd9d27161c949b5e1e692436d (patch)
tree96b6130be929282f85d0261bbb0e0ef37e4e43ff /src/Text/Pandoc/Readers/Textile.hs
parent7a40fa8c08996cb94e7ff3cfafd8ede84972ce70 (diff)
downloadpandoc-d599c4cdabd0d71fd9d27161c949b5e1e692436d.tar.gz
Added Attr field to Header.
Previously header ids were autogenerated by the writers. Now they are generated (unless supplied explicitly) in the markdown parser, if the `header_identifiers` extension is selected. In addition, the textile reader now supports id attributes on headers.
Diffstat (limited to 'src/Text/Pandoc/Readers/Textile.hs')
-rw-r--r--src/Text/Pandoc/Readers/Textile.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Textile.hs b/src/Text/Pandoc/Readers/Textile.hs
index f2a70612d..3ac7f4efb 100644
--- a/src/Text/Pandoc/Readers/Textile.hs
+++ b/src/Text/Pandoc/Readers/Textile.hs
@@ -171,9 +171,14 @@ header :: Parser [Char] ParserState Block
header = try $ do
char 'h'
level <- digitToInt <$> oneOf "123456"
- optional attributes >> char '.' >> whitespace
+ attr <- option "" attributes
+ let ident = case attr of
+ '#':xs -> xs
+ _ -> ""
+ char '.'
+ whitespace
name <- normalizeSpaces <$> manyTill inline blockBreak
- return $ Header level name
+ return $ Header level (ident,[],[]) name
-- | Blockquote of the form "bq. content"
blockQuote :: Parser [Char] ParserState Block