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.
This commit is contained in:
parent
5d3b295568
commit
7b34dd8dd1
3 changed files with 25 additions and 4 deletions
9
README
9
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
|
||||
=================================
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue