diff --git a/README b/README index f0b65f934..e11e3cb45 100644 --- a/README +++ b/README @@ -2243,6 +2243,15 @@ pandoc. If `pandoc_title_block` is enabled, it will take precedence over [MultiMarkdown]: http://fletcherpenney.net/multimarkdown/ +**Extension: `abbrevations`**\ +Parses PHP Markdown Extra abbreviation keys, like + + *[HTML]: Hyper Text Markup Language + +Note that the pandoc document model does not support +abbreviations, so if this extension is enabled, abbreviation keys are +simply skipped (as opposed to being parsed as paragraphs). + Producing slide shows with Pandoc ================================= diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs index f982dac46..77b134aaa 100644 --- a/src/Text/Pandoc/Options.hs +++ b/src/Text/Pandoc/Options.hs @@ -85,6 +85,7 @@ data Extension = | Ext_subscript -- ^ Subscript using ~this~ syntax | Ext_hard_line_breaks -- ^ All newlines become hard line breaks | Ext_literate_haskell -- ^ Enable literate Haskell conventions + | Ext_abbreviations -- ^ PHP markdown extra abbreviation definitions deriving (Show, Read, Enum, Eq, Ord, Bounded) pandocExtensions :: Set Extension 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"