From 64f8c5d99cb7040479d6baf8950ef991fa23acae Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Fri, 2 Mar 2018 12:50:36 +0300 Subject: Muse reader: remove space prefix from tag contents --- src/Text/Pandoc/Readers/Muse.hs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/Text/Pandoc/Readers') diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs index 6183f91cd..aaa54e65b 100644 --- a/src/Text/Pandoc/Readers/Muse.hs +++ b/src/Text/Pandoc/Readers/Muse.hs @@ -379,16 +379,13 @@ example = try $ do contents <- manyTill anyChar $ try (optional blankline >> string "}}}") return $ return $ B.codeBlock contents --- Trim up to one newline from the beginning and the end, --- in case opening and/or closing tags are on separate lines. -chop :: String -> String -chop = lchop . rchop - +-- Trim up to one newline from the beginning of the string. lchop :: String -> String lchop s = case s of '\n':ss -> ss _ -> s +-- Trim up to one newline from the end of the string. rchop :: String -> String rchop = reverse . lchop . reverse @@ -410,7 +407,7 @@ literalTag = do where -- FIXME: Emacs Muse inserts without style into all output formats, but we assume HTML format (_, _, kvs) = fromMaybe "html" $ lookup "style" kvs - rawBlock (attrs, content) = B.rawBlock (format attrs) $ chop content + rawBlock (attrs, content) = B.rawBlock (format attrs) $ rchop $ intercalate "\n" $ dropSpacePrefix $ splitOn "\n" $ lchop content --
tag is ignored centerTag :: PandocMonad m => MuseParser m (F Blocks) -- cgit v1.2.3