git.iko.soy/typeable/pandoc
on master help sign in
Org reader: fix parsers relying on parseFromString
4e899ebAlbert Krewinkel
src/Text/Pandoc/Readers/Org/Parsing.hs+3−4
@@ -137,14 +137,13 @@ anyLine =
137 <* updateLastPreCharPos
137 <* updateLastPreCharPos
138 <* updateLastForbiddenCharPos
138 <* updateLastForbiddenCharPos
139
139
140−-- The version Text.Pandoc.Parsing cannot be used, as we need additional parts
140+-- | Like @'Text.Pandoc.Parsing'@, but resets the position of the last character
141−-- of the state saved and restored.
141+-- allowed before emphasised text.
142parseFromString :: Monad m => OrgParser m a -> String -> OrgParser m a
142parseFromString :: Monad m => OrgParser m a -> String -> OrgParser m a
143parseFromString parser str' = do
143parseFromString parser str' = do
144− oldLastPreCharPos <- orgStateLastPreCharPos <$> getState
145 updateState $ \s -> s{ orgStateLastPreCharPos = Nothing }
144 updateState $ \s -> s{ orgStateLastPreCharPos = Nothing }
146 result <- P.parseFromString parser str'
145 result <- P.parseFromString parser str'
147− updateState $ \s -> s{ orgStateLastPreCharPos = oldLastPreCharPos }
146+ updateState $ \s -> s { orgStateLastPreCharPos = Nothing }
148 return result
147 return result
149
148
150-- | Skip one or more tab or space characters.
149-- | Skip one or more tab or space characters.
test/Tests/Readers/Org/Block/List.hs+11
@@ -243,4 +243,15 @@ tests =
243 mconcat [ para "CLOSED: [2015-10-19 Mon 15:03]"
243 mconcat [ para "CLOSED: [2015-10-19 Mon 15:03]"
244 , bulletList [ plain "Note taken on [2015-10-19 Mon 13:24]" ]
244 , bulletList [ plain "Note taken on [2015-10-19 Mon 13:24]" ]
245 ]
245 ]
246+
247+ , "Markup after header and list" =:
248+ T.unlines [ "* headline"
249+ , "- list"
250+ , ""
251+ , "~variable name~"
252+ ] =?>
253+ mconcat [ headerWith ("headline", [], []) 1 "headline"
254+ , bulletList [ plain "list" ]
255+ , para (code "variable name")
256+ ]
246 ]
257 ]