git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #1700 from tarleb/org-emphasis-fix
31713d5John MacFarlane
src/Text/Pandoc/Readers/Org.hs+5−5
@@ -952,7 +952,7 @@ parseInlines = trimInlinesF . mconcat <$> many1 inline
952
952
953-- treat these as potentially non-text when parsing inline:
953-- treat these as potentially non-text when parsing inline:
954specialChars :: [Char]
954specialChars :: [Char]
955−specialChars = "\"$'()*+-./:<=>[\\]^_{|}~"
955+specialChars = "\"$'()*+-,./:<=>[\\]^_{|}~"
956
956
957
957
958whitespace :: OrgParser (F Inlines)
958whitespace :: OrgParser (F Inlines)
@@ -1230,10 +1230,10 @@ displayMath = return . B.displayMath <$> choice [ rawMathBetween "\\[" "\\]"
1230 ]
1230 ]
1231symbol :: OrgParser (F Inlines)
1231symbol :: OrgParser (F Inlines)
1232symbol = return . B.str . (: "") <$> (oneOf specialChars >>= updatePositions)
1232symbol = return . B.str . (: "") <$> (oneOf specialChars >>= updatePositions)
1233− where updatePositions c
1233+ where updatePositions c = do
1234− | c `elem` emphasisPreChars = c <$ updateLastPreCharPos
1234+ when (c `elem` emphasisPreChars) updateLastPreCharPos
1235− | c `elem` emphasisForbiddenBorderChars = c <$ updateLastForbiddenCharPos
1235+ when (c `elem` emphasisForbiddenBorderChars) updateLastForbiddenCharPos
1236− | otherwise = return c
1236+ return c
1237
1237
1238emphasisBetween :: Char
1238emphasisBetween :: Char
1239 -> OrgParser (F Inlines)
1239 -> OrgParser (F Inlines)
tests/Tests/Readers/Org.hs+8
@@ -126,6 +126,14 @@ tests =
126 , (emph "b") <> "."
126 , (emph "b") <> "."
127 ])
127 ])
128
128
129+ , "Quotes are forbidden border chars" =:
130+ "/'nope/ *nope\"*" =?>
131+ para ("/'nope/" <> space <> "*nope\"*")
132+
133+ , "Commata are forbidden border chars" =:
134+ "/nada,/" =?>
135+ para "/nada,/"
136+
129 , "Markup should work properly after a blank line" =:
137 , "Markup should work properly after a blank line" =:
130 unlines ["foo", "", "/bar/"] =?>
138 unlines ["foo", "", "/bar/"] =?>
131 (para $ text "foo") <> (para $ emph $ text "bar")
139 (para $ text "foo") <> (para $ emph $ text "bar")