diff options
| author | John MacFarlane <fiddlosopher@gmail.com> | 2011-12-27 15:45:34 -0800 |
|---|---|---|
| committer | John MacFarlane <fiddlosopher@gmail.com> | 2011-12-27 15:45:34 -0800 |
| commit | a579e2c89289b97fa4083c2c0e2299da9d44e9e0 (patch) | |
| tree | 11976af7a06a442133f58baf70cff7c1445ec9f8 /src/Text/Pandoc/Readers | |
| parent | 8838f473a825747fc00f61cbddfe3732fe3a9b6f (diff) | |
| download | pandoc-a579e2c89289b97fa4083c2c0e2299da9d44e9e0.tar.gz | |
Replaced Apostrophe, Ellipses, EmDash, EnDash w/ unicode strings.
Diffstat (limited to 'src/Text/Pandoc/Readers')
| -rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 6 | ||||
| -rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 14 |
2 files changed, 9 insertions, 11 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index c418fef2a..708aa58c1 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -802,13 +802,13 @@ ellipses = try $ do optional $ char 'l' string "dots" optional $ try $ string "{}" - return Ellipses + return (Str "…") enDash :: GenParser Char st Inline -enDash = try (string "--") >> return EnDash +enDash = try (string "--") >> return (Str "-") emDash :: GenParser Char st Inline -emDash = try (string "---") >> return EmDash +emDash = try (string "---") >> return (Str "—") hyphen :: GenParser Char st Inline hyphen = char '-' >> return (Str "-") diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 96b2d4315..db68df629 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1087,20 +1087,18 @@ nonEndline = satisfy (/='\n') str :: GenParser Char ParserState Inline str = do - st <- getState + smart <- stateSmart `fmap` getState a <- alphaNum as <- many $ alphaNum <|> (try $ char '_' >>~ lookAhead alphaNum) - <|> if stateStrict st - then mzero - else (try $ satisfy (\c -> c == '\'' || c == '\x2019') >> + <|> if smart + then (try $ satisfy (\c -> c == '\'' || c == '\x2019') >> lookAhead alphaNum >> return '\x2019') - -- for things like l'aide - would be better to return - -- an Apostrophe, but we can't in this context + -- for things like l'aide + else mzero let result = a:as - state <- getState let spacesToNbr = map (\c -> if c == ' ' then '\160' else c) - if stateSmart state + if smart then case likelyAbbrev result of [] -> return $ Str result xs -> choice (map (\x -> |
