git.iko.soy/typeable/pandoc
on master help sign in
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.

commit7b34dd8dd1cf991807c84fc2900e19869885995d authorJohn MacFarlane <jgm@berkeley.edu> dateSun 19 Aug 2012, 11:12 (14 years ago) parent5d3b295
3 files changed+25−4
README+9 src/Text/Pandoc/Options.hs+1 src/Text/Pandoc/Readers/Markdown.hs+15−4
README+9
@@ -2243,6 +2243,15 @@ pandoc. If `pandoc_title_block` is enabled, it will take precedence over
22432243
22442244 [MultiMarkdown]: http://fletcherpenney.net/multimarkdown/
22452245
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+
22462255Producing slide shows with Pandoc
22472256=================================
22482257
src/Text/Pandoc/Options.hs+1
@@ -85,6 +85,7 @@ data Extension =
8585 | Ext_subscript -- ^ Subscript using ~this~ syntax
8686 | Ext_hard_line_breaks -- ^ All newlines become hard line breaks
8787 | Ext_literate_haskell -- ^ Enable literate Haskell conventions
88+ | Ext_abbreviations -- ^ PHP markdown extra abbreviation definitions
8889 deriving (Show, Read, Enum, Eq, Ord, Bounded)
8990
9091pandocExtensions :: Set Extension
src/Text/Pandoc/Readers/Markdown.hs+15−4
@@ -219,10 +219,6 @@ parseMarkdown = do
219219 $ B.setDate (runF date st)
220220 $ B.doc $ runF blocks st
221221
222−--
223−-- initial pass for references and notes
224−--
225−
226222referenceKey :: Parser [Char] ParserState (F Blocks)
227223referenceKey = try $ do
228224 skipNonindentSpaces
@@ -256,6 +252,20 @@ referenceTitle = try $ do
256252 notFollowedBy (noneOf ")\n")))
257253 return $ fromEntities tit
258254
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+
259269noteMarker :: Parser [Char] ParserState String
260270noteMarker = string "[^" >> many1Till (satisfy $ not . isBlank) (char ']')
261271
@@ -311,6 +321,7 @@ block = choice [ codeBlockDelimited
311321 , definitionList
312322 , noteBlock
313323 , referenceKey
324+ , abbrevKey
314325 , para
315326 , plain
316327 ] <?> "block"