git.iko.soy/typeable/pandoc
on master help sign in
Added Ext_abbrevations for PHP markdown style abbreviation keys.
7b34dd8John MacFarlane
@@ -2243,6 +2243,15 @@ pandoc. If `pandoc_title_block` is enabled, it will take precedence over
2243
2243
2244 [MultiMarkdown]: http://fletcherpenney.net/multimarkdown/
2244 [MultiMarkdown]: http://fletcherpenney.net/multimarkdown/
2245
2245
2246+**Extension: `abbrevations`**\
2247+Parses PHP Markdown Extra abbreviation keys, like
2248+
2249+ *[HTML]: Hyper Text Markup Language
2250+
2251+Note that the pandoc document model does not support
2252+abbreviations, so if this extension is enabled, abbreviation keys are
2253+simply skipped (as opposed to being parsed as paragraphs).
2254+
2246Producing slide shows with Pandoc
2255Producing slide shows with Pandoc
2247=================================
2256=================================
2248
2257
src/Text/Pandoc/Options.hs+1
@@ -85,6 +85,7 @@ data Extension =
85 | Ext_subscript -- ^ Subscript using ~this~ syntax
85 | Ext_subscript -- ^ Subscript using ~this~ syntax
86 | Ext_hard_line_breaks -- ^ All newlines become hard line breaks
86 | Ext_hard_line_breaks -- ^ All newlines become hard line breaks
87 | Ext_literate_haskell -- ^ Enable literate Haskell conventions
87 | Ext_literate_haskell -- ^ Enable literate Haskell conventions
88+ | Ext_abbreviations -- ^ PHP markdown extra abbreviation definitions
88 deriving (Show, Read, Enum, Eq, Ord, Bounded)
89 deriving (Show, Read, Enum, Eq, Ord, Bounded)
89
90
90pandocExtensions :: Set Extension
91pandocExtensions :: Set Extension
src/Text/Pandoc/Readers/Markdown.hs+15−4
@@ -219,10 +219,6 @@ parseMarkdown = do
219 $ B.setDate (runF date st)
219 $ B.setDate (runF date st)
220 $ B.doc $ runF blocks st
220 $ B.doc $ runF blocks st
221
221
222−--
223−-- initial pass for references and notes
224−--
225−
226referenceKey :: Parser [Char] ParserState (F Blocks)
222referenceKey :: Parser [Char] ParserState (F Blocks)
227referenceKey = try $ do
223referenceKey = try $ do
228 skipNonindentSpaces
224 skipNonindentSpaces
@@ -256,6 +252,20 @@ referenceTitle = try $ do
256 notFollowedBy (noneOf ")\n")))
252 notFollowedBy (noneOf ")\n")))
257 return $ fromEntities tit
253 return $ fromEntities tit
258
254
255+-- | PHP Markdown Extra style abbreviation key. Currently
256+-- we just skip them, since Pandoc doesn't have an element for
257+-- an abbreviation.
258+abbrevKey :: Parser [Char] ParserState (F Blocks)
259+abbrevKey = do
260+ guardEnabled Ext_abbreviations
261+ try $ do
262+ char '*'
263+ reference
264+ char ':'
265+ skipMany (satisfy (/= '\n'))
266+ blanklines
267+ return $ return mempty
268+
259noteMarker :: Parser [Char] ParserState String
269noteMarker :: Parser [Char] ParserState String
260noteMarker = string "[^" >> many1Till (satisfy $ not . isBlank) (char ']')
270noteMarker = string "[^" >> many1Till (satisfy $ not . isBlank) (char ']')
261
271
@@ -311,6 +321,7 @@ block = choice [ codeBlockDelimited
311 , definitionList
321 , definitionList
312 , noteBlock
322 , noteBlock
313 , referenceKey
323 , referenceKey
324+ , abbrevKey
314 , para
325 , para
315 , plain
326 , plain
316 ] <?> "block"
327 ] <?> "block"