aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2012-08-19 11:12:18 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2012-08-19 11:15:32 -0700
commit7b34dd8dd1cf991807c84fc2900e19869885995d (patch)
treeb205f0ac9fae0d0bd5b39a08f052c23114b1c459 /src/Text/Pandoc
parent5d3b2955681d84458537e3bea7b004262960d374 (diff)
downloadpandoc-7b34dd8dd1cf991807c84fc2900e19869885995d.tar.gz
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.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Options.hs1
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs19
2 files changed, 16 insertions, 4 deletions
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"