Muse reader: remove space prefix from <literal> tag contents
This commit is contained in:
parent
6824d0dc2c
commit
64f8c5d99c
1 changed files with 3 additions and 6 deletions
|
@ -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 <literal> 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
|
||||
|
||||
-- <center> tag is ignored
|
||||
centerTag :: PandocMonad m => MuseParser m (F Blocks)
|
||||
|
|
Loading…
Add table
Reference in a new issue