mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-25 09:47:06 +00:00
More cleanup (#6209)
* Simplify by collapsing a do block into a single <$> * Remove an unnecessary variable: `all` takes any Foldable, so only blocksToInlines needs toList.
This commit is contained in:
@@ -334,15 +334,14 @@ extentToAttr _ = nullAttr
|
||||
|
||||
blocksToInlinesWarn :: PandocMonad m => T.Text -> Blocks -> DocxContext m Inlines
|
||||
blocksToInlinesWarn cmtId blks = do
|
||||
let blkList = toList blks
|
||||
paraOrPlain :: Block -> Bool
|
||||
let paraOrPlain :: Block -> Bool
|
||||
paraOrPlain (Para _) = True
|
||||
paraOrPlain (Plain _) = True
|
||||
paraOrPlain _ = False
|
||||
unless (all paraOrPlain blkList) $
|
||||
unless (all paraOrPlain blks) $
|
||||
lift $ P.report $ DocxParserWarning $
|
||||
"Docx comment " <> cmtId <> " will not retain formatting"
|
||||
return $ blocksToInlines' blkList
|
||||
return $ blocksToInlines' (toList blks)
|
||||
|
||||
-- The majority of work in this function is done in the primed
|
||||
-- subfunction `partPartToInlines'`. We make this wrapper so that we
|
||||
|
||||
@@ -90,9 +90,8 @@ testForWarningsWithOpts opts name docxFile expected =
|
||||
-- testForWarnings = testForWarningsWithOpts defopts
|
||||
|
||||
getMedia :: FilePath -> FilePath -> IO (Maybe B.ByteString)
|
||||
getMedia archivePath mediaPath = do
|
||||
zf <- toArchive <$> B.readFile archivePath
|
||||
return $ fromEntry <$> findEntryByPath ("word/" ++ mediaPath) zf
|
||||
getMedia archivePath mediaPath = fmap fromEntry . findEntryByPath
|
||||
("word/" ++ mediaPath) . toArchive <$> B.readFile archivePath
|
||||
|
||||
compareMediaPathIO :: FilePath -> MediaBag -> FilePath -> IO Bool
|
||||
compareMediaPathIO mediaPath mediaBag docxPath = do
|
||||
|
||||
Reference in New Issue
Block a user