aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJoseph C. Sible <josephcsible@users.noreply.github.com>2020-03-30 00:11:05 -0400
committerGitHub <noreply@github.com>2020-03-29 21:11:05 -0700
commit377efd0ce7736685c2a43842743a11ae01ed0a0b (patch)
treefdb71f111bce17b9e8a5556c0f89739ac35eec16 /src/Text/Pandoc/Readers
parent40fd20d43fc2431e411554c138cb6e7d15654917 (diff)
downloadpandoc-377efd0ce7736685c2a43842743a11ae01ed0a0b.tar.gz
Clean up some fmaps (#6226)
* Avoid fmapping when we're just binding right after anyway * Clean up unnecessary fmaps in the LaTeX reader
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/DocBook.hs4
-rw-r--r--src/Text/Pandoc/Readers/JATS.hs6
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs18
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs4
4 files changed, 16 insertions, 16 deletions
diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs
index 4bc5312d6..7f71cb3c1 100644
--- a/src/Text/Pandoc/Readers/DocBook.hs
+++ b/src/Text/Pandoc/Readers/DocBook.hs
@@ -758,8 +758,8 @@ parseBlock (Elem e) =
"upperroman" -> UpperRoman
_ -> Decimal
let start = fromMaybe 1 $
- (attrValue "override" <$> filterElement (named "listitem") e)
- >>= safeRead
+ filterElement (named "listitem") e
+ >>= safeRead . attrValue "override"
orderedListWith (start,listStyle,DefaultDelim)
<$> listitems
"variablelist" -> definitionList <$> deflistitems
diff --git a/src/Text/Pandoc/Readers/JATS.hs b/src/Text/Pandoc/Readers/JATS.hs
index 50e1e519a..597e798ab 100644
--- a/src/Text/Pandoc/Readers/JATS.hs
+++ b/src/Text/Pandoc/Readers/JATS.hs
@@ -164,9 +164,9 @@ parseBlock (Elem e) =
"bullet" -> bulletList <$> listitems
listType -> do
let start = fromMaybe 1 $
- (textContent <$> (filterElement (named "list-item") e
- >>= filterElement (named "label")))
- >>= safeRead
+ (filterElement (named "list-item") e
+ >>= filterElement (named "label"))
+ >>= safeRead . textContent
orderedListWith (start, parseListStyleType listType, DefaultDelim)
<$> listitems
"def-list" -> definitionList <$> deflistitems
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index d16c67770..59339c606 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -1018,16 +1018,16 @@ inlineCommands = M.union inlineLanguageCommands $ M.fromList
, ("lstinline", dolstinline)
, ("mintinline", domintinline)
, ("Verb", doverb)
- , ("url", ((unescapeURL . untokenize) <$> bracedUrl) >>= \url ->
- pure (link url "" (str url)))
- , ("nolinkurl", ((unescapeURL . untokenize) <$> bracedUrl) >>= \url ->
- pure (code url))
- , ("href", (unescapeURL . untokenize <$>
- bracedUrl <* sp) >>= \url ->
- tok >>= \lab -> pure (link url "" lab))
+ , ("url", (\url -> link url "" (str url)) . unescapeURL . untokenize <$>
+ bracedUrl)
+ , ("nolinkurl", code . unescapeURL . untokenize <$> bracedUrl)
+ , ("href", do url <- bracedUrl
+ sp
+ link (unescapeURL $ untokenize url) "" <$> tok)
, ("includegraphics", do options <- option [] keyvals
- src <- unescapeURL . removeDoubleQuotes . untokenize <$> braced
- mkImage options src)
+ src <- braced
+ mkImage options . unescapeURL . removeDoubleQuotes $
+ untokenize src)
, ("enquote*", enquote True Nothing)
, ("enquote", enquote False Nothing)
-- foreignquote is supposed to use native quote marks
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 9fce8252c..c9643f1b0 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1339,8 +1339,8 @@ pipeTableRow = try $ do
-- split into cells
let chunk = void (code <|> math <|> rawHtmlInline <|> escapedChar <|> rawLaTeXInline')
<|> void (noneOf "|\n\r")
- let cellContents = ((trim . snd) <$> withRaw (many chunk)) >>=
- parseFromString' pipeTableCell
+ let cellContents = withRaw (many chunk) >>=
+ parseFromString' pipeTableCell . trim . snd
cells <- cellContents `sepEndBy1` char '|'
-- surrounding pipes needed for a one-column table:
guard $ not (length cells == 1 && not openPipe)