git.iko.soy/typeable/pandoc
on master help sign in
Clean up some fmaps (#6226)
377efd0Joseph C. Sible
src/Text/Pandoc/Lua/Module/MediaBag.hs+1−1
@@ -85,7 +85,7 @@ insertMediaFn fp optionalMime contents = do
85
85
86-- | Returns iterator values to be used with a Lua @for@ loop.
86-- | Returns iterator values to be used with a Lua @for@ loop.
87items :: Lua NumResults
87items :: Lua NumResults
88−items = stMediaBag <$> getCommonState >>= pushIterator
88+items = getCommonState >>= pushIterator . stMediaBag
89
89
90lookupMediaFn :: FilePath
90lookupMediaFn :: FilePath
91 -> Lua NumResults
91 -> Lua NumResults
src/Text/Pandoc/Readers/DocBook.hs+2−2
@@ -758,8 +758,8 @@ parseBlock (Elem e) =
758 "upperroman" -> UpperRoman
758 "upperroman" -> UpperRoman
759 _ -> Decimal
759 _ -> Decimal
760 let start = fromMaybe 1 $
760 let start = fromMaybe 1 $
761− (attrValue "override" <$> filterElement (named "listitem") e)
761+ filterElement (named "listitem") e
762− >>= safeRead
762+ >>= safeRead . attrValue "override"
763 orderedListWith (start,listStyle,DefaultDelim)
763 orderedListWith (start,listStyle,DefaultDelim)
764 <$> listitems
764 <$> listitems
765 "variablelist" -> definitionList <$> deflistitems
765 "variablelist" -> definitionList <$> deflistitems
src/Text/Pandoc/Readers/JATS.hs+3−3
@@ -164,9 +164,9 @@ parseBlock (Elem e) =
164 "bullet" -> bulletList <$> listitems
164 "bullet" -> bulletList <$> listitems
165 listType -> do
165 listType -> do
166 let start = fromMaybe 1 $
166 let start = fromMaybe 1 $
167− (textContent <$> (filterElement (named "list-item") e
167+ (filterElement (named "list-item") e
168− >>= filterElement (named "label")))
168+ >>= filterElement (named "label"))
169− >>= safeRead
169+ >>= safeRead . textContent
170 orderedListWith (start, parseListStyleType listType, DefaultDelim)
170 orderedListWith (start, parseListStyleType listType, DefaultDelim)
171 <$> listitems
171 <$> listitems
172 "def-list" -> definitionList <$> deflistitems
172 "def-list" -> definitionList <$> deflistitems
src/Text/Pandoc/Readers/LaTeX.hs+9−9
@@ -1018,16 +1018,16 @@ inlineCommands = M.union inlineLanguageCommands $ M.fromList
1018 , ("lstinline", dolstinline)
1018 , ("lstinline", dolstinline)
1019 , ("mintinline", domintinline)
1019 , ("mintinline", domintinline)
1020 , ("Verb", doverb)
1020 , ("Verb", doverb)
1021− , ("url", ((unescapeURL . untokenize) <$> bracedUrl) >>= \url ->
1022− pure (link url "" (str url)))
1021+ , ("url", (\url -> link url "" (str url)) . unescapeURL . untokenize <$>
1023− , ("nolinkurl", ((unescapeURL . untokenize) <$> bracedUrl) >>= \url ->
1022+ bracedUrl)
1024− pure (code url))
1023+ , ("nolinkurl", code . unescapeURL . untokenize <$> bracedUrl)
1025− , ("href", (unescapeURL . untokenize <$>
1024+ , ("href", do url <- bracedUrl
1026− bracedUrl <* sp) >>= \url ->
1025+ sp
1027− tok >>= \lab -> pure (link url "" lab))
1026+ link (unescapeURL $ untokenize url) "" <$> tok)
1028 , ("includegraphics", do options <- option [] keyvals
1027 , ("includegraphics", do options <- option [] keyvals
1028+ src <- braced
1029− src <- unescapeURL . removeDoubleQuotes . untokenize <$> braced
1029+ mkImage options . unescapeURL . removeDoubleQuotes $
1030− mkImage options src)
1030+ untokenize src)
1031 , ("enquote*", enquote True Nothing)
1031 , ("enquote*", enquote True Nothing)
1032 , ("enquote", enquote False Nothing)
1032 , ("enquote", enquote False Nothing)
1033 -- foreignquote is supposed to use native quote marks
1033 -- foreignquote is supposed to use native quote marks
src/Text/Pandoc/Readers/Markdown.hs+2−2
@@ -1339,8 +1339,8 @@ pipeTableRow = try $ do
1339 -- split into cells
1339 -- split into cells
1340 let chunk = void (code <|> math <|> rawHtmlInline <|> escapedChar <|> rawLaTeXInline')
1340 let chunk = void (code <|> math <|> rawHtmlInline <|> escapedChar <|> rawLaTeXInline')
1341 <|> void (noneOf "|\n\r")
1341 <|> void (noneOf "|\n\r")
1342− let cellContents = ((trim . snd) <$> withRaw (many chunk)) >>=
1342+ let cellContents = withRaw (many chunk) >>=
1343− parseFromString' pipeTableCell
1343+ parseFromString' pipeTableCell . trim . snd
1344 cells <- cellContents `sepEndBy1` char '|'
1344 cells <- cellContents `sepEndBy1` char '|'
1345 -- surrounding pipes needed for a one-column table:
1345 -- surrounding pipes needed for a one-column table:
1346 guard $ not (length cells == 1 && not openPipe)
1346 guard $ not (length cells == 1 && not openPipe)
src/Text/Pandoc/Writers/Docx.hs+3−3
@@ -236,11 +236,11 @@ writeDocx opts doc@(Pandoc meta _) = do
236
236
237 -- Gets the template size
237 -- Gets the template size
238 let mbpgsz = mbsectpr >>= filterElementName (wname (=="pgSz"))
238 let mbpgsz = mbsectpr >>= filterElementName (wname (=="pgSz"))
239− let mbAttrSzWidth = (elAttribs <$> mbpgsz) >>= lookupAttrTextBy ((=="w") . qName)
239+ let mbAttrSzWidth = mbpgsz >>= lookupAttrTextBy ((=="w") . qName) . elAttribs
240
240
241 let mbpgmar = mbsectpr >>= filterElementName (wname (=="pgMar"))
241 let mbpgmar = mbsectpr >>= filterElementName (wname (=="pgMar"))
242− let mbAttrMarLeft = (elAttribs <$> mbpgmar) >>= lookupAttrTextBy ((=="left") . qName)
242+ let mbAttrMarLeft = mbpgmar >>= lookupAttrTextBy ((=="left") . qName) . elAttribs
243− let mbAttrMarRight = (elAttribs <$> mbpgmar) >>= lookupAttrTextBy ((=="right") . qName)
243+ let mbAttrMarRight = mbpgmar >>= lookupAttrTextBy ((=="right") . qName) . elAttribs
244
244
245 -- Get the available area (converting the size and the margins to int and
245 -- Get the available area (converting the size and the margins to int and
246 -- doing the difference
246 -- doing the difference
src/Text/Pandoc/Writers/Markdown.hs+2−2
@@ -360,9 +360,9 @@ beginsWithOrderedListMarker str =
360
360
361notesAndRefs :: PandocMonad m => WriterOptions -> MD m (Doc Text)
361notesAndRefs :: PandocMonad m => WriterOptions -> MD m (Doc Text)
362notesAndRefs opts = do
362notesAndRefs opts = do
363− notes' <- reverse <$> gets stNotes >>= notesToMarkdown opts
363+ notes' <- gets stNotes >>= notesToMarkdown opts . reverse
364 modify $ \s -> s { stNotes = [] }
364 modify $ \s -> s { stNotes = [] }
365− refs' <- reverse <$> gets stRefs >>= refsToMarkdown opts
365+ refs' <- gets stRefs >>= refsToMarkdown opts . reverse
366 modify $ \s -> s { stPrevRefs = stPrevRefs s ++ stRefs s
366 modify $ \s -> s { stPrevRefs = stPrevRefs s ++ stRefs s
367 , stRefs = []}
367 , stRefs = []}
368
368