From 7b34dd8dd1cf991807c84fc2900e19869885995d Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 19 Aug 2012 11:12:18 -0700 Subject: Added Ext_abbrevations for PHP markdown style abbreviation keys. Note: pandoc does not have an abbreviation element (yet) and so currently when this extension is enabled, it just causes pandoc to skip the abbrevation keys. --- src/Text/Pandoc/Readers/Markdown.hs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/Text/Pandoc/Readers') diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index b0925ac68..792c0269a 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -219,10 +219,6 @@ parseMarkdown = do $ B.setDate (runF date st) $ B.doc $ runF blocks st --- --- initial pass for references and notes --- - referenceKey :: Parser [Char] ParserState (F Blocks) referenceKey = try $ do skipNonindentSpaces @@ -256,6 +252,20 @@ referenceTitle = try $ do notFollowedBy (noneOf ")\n"))) return $ fromEntities tit +-- | PHP Markdown Extra style abbreviation key. Currently +-- we just skip them, since Pandoc doesn't have an element for +-- an abbreviation. +abbrevKey :: Parser [Char] ParserState (F Blocks) +abbrevKey = do + guardEnabled Ext_abbreviations + try $ do + char '*' + reference + char ':' + skipMany (satisfy (/= '\n')) + blanklines + return $ return mempty + noteMarker :: Parser [Char] ParserState String noteMarker = string "[^" >> many1Till (satisfy $ not . isBlank) (char ']') @@ -311,6 +321,7 @@ block = choice [ codeBlockDelimited , definitionList , noteBlock , referenceKey + , abbrevKey , para , plain ] "block" -- cgit v1.2.3