aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2017-04-26 13:04:28 +0300
committerJohn MacFarlane <jgm@berkeley.edu>2017-04-26 12:04:28 +0200
commit256e3a6a5d3f91262e8b3304fc2fa8cd1a854038 (patch)
tree8386883d90a4ea98317bc829086facd78e058845 /src/Text/Pandoc
parent81548960d52d6c3ca34aa5fa041e5aa8bae9481b (diff)
downloadpandoc-256e3a6a5d3f91262e8b3304fc2fa8cd1a854038.tar.gz
Simplify linkText in Text.Pandoc.Readers.TWiki (#3605)
Avoid constructing list of one element ([B.str url]) just to flatten it back with mconcat.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/TWiki.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/TWiki.hs b/src/Text/Pandoc/Readers/TWiki.hs
index 0d8ff383e..ecb609ae9 100644
--- a/src/Text/Pandoc/Readers/TWiki.hs
+++ b/src/Text/Pandoc/Readers/TWiki.hs
@@ -520,9 +520,9 @@ linkText :: PandocMonad m => TWParser m (String, String, B.Inlines)
linkText = do
string "[["
url <- many1Till anyChar (char ']')
- content <- option [B.str url] linkContent
+ content <- option (B.str url) (mconcat <$> linkContent)
char ']'
- return (url, "", mconcat content)
+ return (url, "", content)
where
linkContent = (char '[') >> many1Till anyChar (char ']') >>= parseLinkContent
parseLinkContent = parseFromString $ many1 inline