git.iko.soy/typeable/pandoc
on master help sign in
MediaWiki reader: Added smart doublequotes with -S option.
3e8630cJohn MacFarlane
src/Text/Pandoc/Readers/MediaWiki.hs+10−2
@@ -89,7 +89,7 @@ nested p = do
89 return res
89 return res
90
90
91specialChars :: [Char]
91specialChars :: [Char]
92−specialChars = "'[]<=&*{}|"
92+specialChars = "'[]<=&*{}|\""
93
93
94spaceChars :: [Char]
94spaceChars :: [Char]
95spaceChars = " \n\t"
95spaceChars = " \n\t"
@@ -445,6 +445,7 @@ inline :: MWParser Inlines
445inline = whitespace
445inline = whitespace
446 <|> url
446 <|> url
447 <|> str
447 <|> str
448+ <|> doubleQuotes
448 <|> strong
449 <|> strong
449 <|> emph
450 <|> emph
450 <|> image
451 <|> image
@@ -540,7 +541,7 @@ internalLink = try $ do
540 -- [[Help:Contents|] -> "Contents"
541 -- [[Help:Contents|] -> "Contents"
541 <|> (return $ B.text $ drop 1 $ dropWhile (/=':') pagename) )
542 <|> (return $ B.text $ drop 1 $ dropWhile (/=':') pagename) )
542 sym "]]"
543 sym "]]"
543− linktrail <- B.text <$> many (char '\'' <|> letter)
544+ linktrail <- B.text <$> many letter
544 let link = B.link (addUnderscores pagename) "wikilink" (label <> linktrail)
545 let link = B.link (addUnderscores pagename) "wikilink" (label <> linktrail)
545 if "Category:" `isPrefixOf` pagename
546 if "Category:" `isPrefixOf` pagename
546 then do
547 then do
@@ -582,3 +583,10 @@ strong = B.strong <$> nested (inlinesBetween start end)
582 where start = sym "'''" >> lookAhead nonspaceChar
583 where start = sym "'''" >> lookAhead nonspaceChar
583 end = try $ sym "'''"
584 end = try $ sym "'''"
584
585
586+doubleQuotes :: MWParser Inlines
587+doubleQuotes = B.doubleQuoted . trimInlines . mconcat <$> try
588+ ((getState >>= guard . readerSmart . mwOptions) *>
589+ openDoubleQuote *> manyTill inline closeDoubleQuote )
590+ where openDoubleQuote = char '"' <* lookAhead alphaNum
591+ closeDoubleQuote = char '"' <* notFollowedBy alphaNum
592+