diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-09-10 06:41:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-10 06:41:41 -0700 |
commit | 41a16a1e9dbfd62d430fb7c5a75b8c3e207d383f (patch) | |
tree | 79b2a7467b4648b2dfc64caa02d1c093290b12be /src/Text/Pandoc | |
parent | cbdeed9cfd027d2deede890a5a9177423178cea4 (diff) | |
parent | afedb41b170cd9198ab589567f39e99717667a31 (diff) | |
download | pandoc-41a16a1e9dbfd62d430fb7c5a75b8c3e207d383f.tar.gz |
Merge pull request #3908 from labdsf/muse-reader-example
Muse reader: trim newlines from <example>s
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/Muse.hs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs index 3b089772f..f70085c54 100644 --- a/src/Text/Pandoc/Readers/Muse.hs +++ b/src/Text/Pandoc/Readers/Muse.hs @@ -223,7 +223,16 @@ header = try $ do return $ B.headerWith attr level <$> content exampleTag :: PandocMonad m => MuseParser m (F Blocks) -exampleTag = liftM (return . uncurry B.codeBlockWith) $ htmlElement "example" +exampleTag = do + (attr, contents) <- htmlElement "example" + return $ return $ B.codeBlockWith attr $ chop contents + where lchop s = case s of + '\n':ss -> ss + _ -> s + rchop = reverse . lchop . reverse + -- Trim up to one newline from the beginning and the end, + -- in case opening and/or closing tags are on separate lines. + chop = lchop . rchop literal :: PandocMonad m => MuseParser m (F Blocks) literal = liftM (return . rawBlock) $ htmlElement "literal" |