diff options
author | Laurent P. René de Cotret <LaurentRDC@users.noreply.github.com> | 2020-05-30 08:14:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-30 14:14:21 +0200 |
commit | 8afbb62ed5e969d78d8664df205646504f52f278 (patch) | |
tree | 3a2d9046a39eb239183832f43bd7121b5b7fd16e /lib/Hakyll/Web | |
parent | 9656e78869dd8248a8558671a48d2e52dbe7edb5 (diff) | |
download | hakyll-8afbb62ed5e969d78d8664df205646504f52f278.tar.gz |
Miscellaneous Windows-specific fixes and CI
Diffstat (limited to 'lib/Hakyll/Web')
-rw-r--r-- | lib/Hakyll/Web/Html.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Hakyll/Web/Html.hs b/lib/Hakyll/Web/Html.hs index 23ad78b..8cbfaa3 100644 --- a/lib/Hakyll/Web/Html.hs +++ b/lib/Hakyll/Web/Html.hs @@ -26,7 +26,7 @@ import Data.Char (digitToInt, intToDigit, isDigit, toLower) import Data.List (isPrefixOf) import qualified Data.Set as S -import System.FilePath.Posix (joinPath, splitPath, +import System.FilePath (joinPath, splitPath, takeDirectory) import Text.Blaze.Html (toHtml) import Text.Blaze.Html.Renderer.String (renderHtml) @@ -35,6 +35,10 @@ import Network.URI (isUnreserved, escapeURIString) -------------------------------------------------------------------------------- +import Hakyll.Core.Util.String (removeWinPathSeparator) + + +-------------------------------------------------------------------------------- -- | Map over all tags in the document withTags :: (TS.Tag String -> TS.Tag String) -> String -> String withTags = withTagList . map @@ -116,7 +120,7 @@ parseTags' = TS.parseTagsOptions (TS.parseOptions :: TS.ParseOptions String) -- -- This also sanitizes the URL, e.g. converting spaces into '%20' toUrl :: FilePath -> String -toUrl url = case url of +toUrl url = case (removeWinPathSeparator url) of ('/' : xs) -> '/' : sanitize xs xs -> '/' : sanitize xs where @@ -130,8 +134,8 @@ toUrl url = case url of -------------------------------------------------------------------------------- -- | Get the relative url to the site root, for a given (absolute) url toSiteRoot :: String -> String -toSiteRoot = emptyException . joinPath . map parent - . filter relevant . splitPath . takeDirectory +toSiteRoot = removeWinPathSeparator . emptyException . joinPath + . map parent . filter relevant . splitPath . takeDirectory where parent = const ".." emptyException [] = "." |