aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs13
-rw-r--r--src/Text/Pandoc/Readers/RST.hs2
2 files changed, 13 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 13edd0586..0d3b30d10 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -35,6 +35,7 @@ import Data.List ( transpose, isSuffixOf, sortBy, findIndex, intercalate )
import Data.Ord ( comparing )
import Data.Char ( isAlphaNum )
import Data.Maybe
+import qualified Data.Map as M
import Text.Pandoc.Definition
import Text.Pandoc.Shared
import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXEnvironment' )
@@ -67,7 +68,7 @@ setextHChars = "=-"
-- treat these as potentially non-text when parsing inline:
specialChars :: [Char]
-specialChars = "\\[]*_~`<>$!^-.&'\"\8216\8217\8220\8221;"
+specialChars = "\\[]*_~`<>$!^-.&@'\"\8216\8217\8220\8221;"
--
-- auxiliary functions
@@ -915,6 +916,7 @@ inlineParsers = [ str
, rawHtmlInline'
, rawLaTeXInline'
, escapedChar
+ , exampleRef
, symbol
, ltSign ]
@@ -950,6 +952,15 @@ ltSign = do
specialCharsMinusLt :: [Char]
specialCharsMinusLt = filter (/= '<') specialChars
+exampleRef :: GenParser Char ParserState Inline
+exampleRef = try $ do
+ char '@'
+ lab <- many1 (alphaNum <|> oneOf "-_")
+ examples <- liftM stateExamples getState
+ case M.lookup lab examples of
+ Just num -> return (Str $ show num)
+ Nothing -> pzero
+
symbol :: GenParser Char ParserState Inline
symbol = do
result <- oneOf specialCharsMinusLt
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 5e7ea512e..c293c4fcd 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -425,7 +425,7 @@ bulletListStart = try $ do
-- parses ordered list start and returns its length (inc following whitespace)
orderedListStart :: ListNumberStyle
-> ListNumberDelim
- -> GenParser Char st Int
+ -> GenParser Char ParserState Int
orderedListStart style delim = try $ do
(_, markerLen) <- withHorizDisplacement (orderedListMarker style delim)
white <- many1 spaceChar