diff options
| author | Mirek Kratochvil <miroslav.kratochvil@uni.lu> | 2023-06-08 13:51:30 +0200 |
|---|---|---|
| committer | Mirek Kratochvil <miroslav.kratochvil@uni.lu> | 2023-06-08 13:51:30 +0200 |
| commit | 4c1f0f9a4e4ee68aab098a61d3749960f568ec7f (patch) | |
| tree | 5ebcf8c0e7b5e60cfd7bac12e78fc01d175d95ef /Utils.hs | |
| parent | b385e1b3f7982cfc2fce28e4e60c740d39cc97f8 (diff) | |
| download | reploy-4c1f0f9a4e4ee68aab098a61d3749960f568ec7f.tar.gz reploy-4c1f0f9a4e4ee68aab098a61d3749960f568ec7f.tar.bz2 | |
install files properly
Diffstat (limited to 'Utils.hs')
| -rw-r--r-- | Utils.hs | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -3,9 +3,9 @@ module Utils where import Control.Monad.IO.Class import Data.List.Extra (stripSuffix) import Data.Maybe (isJust) +import qualified Data.Text as T import Text.Pandoc.Definition import qualified Text.Pandoc.Walk -import qualified Data.Text as T import Types @@ -27,13 +27,16 @@ second :: (a -> b) -> (c, a) -> (c, b) second f (a, b) = (a, f b) -- | A pandoc walker for modifying the URLs. -walkURLs :: (FilePath -> Site FilePath) -> Text.Pandoc.Definition.Pandoc -> Site Text.Pandoc.Definition.Pandoc +walkURLs :: + (FilePath -> Site FilePath) + -> Text.Pandoc.Definition.Pandoc + -> Site Text.Pandoc.Definition.Pandoc walkURLs f = Text.Pandoc.Walk.walkM go where - go (Link a i (u,t)) = do + go (Link a i (u, t)) = do u' <- T.pack <$> f (T.unpack u) - pure $ Link a i (u',t) - go (Image a i (u,t)) = do + pure $ Link a i (u', t) + go (Image a i (u, t)) = do u' <- T.pack <$> f (T.unpack u) - pure $ Image a i (u',t) + pure $ Image a i (u', t) go x = pure x |
