Don't add a newline if there's already one.
This commit is contained in:
parent
92debe4b9e
commit
fdb7a5b79f
1 changed files with 5 additions and 4 deletions
|
@ -299,10 +299,11 @@ convertWithOpts opts = do
|
|||
TL.unpack (TE.decodeUtf8With TE.lenientDecode err')
|
||||
|
||||
Nothing -> do
|
||||
let addNl = if standalone
|
||||
then id
|
||||
else (<> T.singleton '\n')
|
||||
output <- addNl <$> f writerOptions doc
|
||||
let ensureNl t
|
||||
| standalone = t
|
||||
| T.null t || T.last t /= '\n' = t <> T.singleton '\n'
|
||||
| otherwise = t
|
||||
output <- ensureNl <$> f writerOptions doc
|
||||
writerFn eol outputFile =<<
|
||||
if optSelfContained opts && htmlFormat format
|
||||
-- TODO not maximally efficient; change type
|
||||
|
|
Loading…
Reference in a new issue