git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #2406 from tarleb/org-verse-fix

Make sure verse blocks can contain empty lines

commit9b033672e4302501f11af21dc297a39a9d5960fc authorJohn MacFarlane <jgm@berkeley.edu> dateSun 20 Sep 2015, 13:02 (11 years ago) parent54526668007dd9
2 files changed+10−1
src/Text/Pandoc/Readers/Org.hs+1−1 tests/Tests/Readers/Org.hs+9
src/Text/Pandoc/Readers/Org.hs+1−1
@@ -409,7 +409,7 @@ verseBlock blkProp = try $ do
409409 ignHeaders
410410 content <- rawBlockContent blkProp
411411 fmap B.para . mconcat . intersperse (pure B.linebreak)
412− <$> mapM (parseFromString parseInlines) (lines content)
412+ <$> mapM (parseFromString parseInlines) (map (++ "\n") . lines $ content)
413413
414414exportsCode :: [(String, String)] -> Bool
415415exportsCode attrs = not (("rundoc-exports", "none") `elem` attrs
tests/Tests/Readers/Org.hs+9
@@ -1143,6 +1143,15 @@ tests =
11431143 ]
11441144 ]
11451145
1146+ , "Verse block with newlines" =:
1147+ unlines [ "#+BEGIN_VERSE"
1148+ , "foo"
1149+ , ""
1150+ , "bar"
1151+ , "#+END_VERSE"
1152+ ] =?>
1153+ para ("foo" <> linebreak <> linebreak <> "bar")
1154+
11461155 , "LaTeX fragment" =:
11471156 unlines [ "\\begin{equation}"
11481157 , "X_i = \\begin{cases}"