From 8afbb62ed5e969d78d8664df205646504f52f278 Mon Sep 17 00:00:00 2001 From: "Laurent P. René de Cotret" Date: Sat, 30 May 2020 08:14:21 -0400 Subject: Miscellaneous Windows-specific fixes and CI --- lib/Hakyll/Web/Html.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/Hakyll/Web') 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) @@ -34,6 +34,10 @@ import qualified Text.HTML.TagSoup as TS 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 @@ -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 [] = "." -- cgit v1.2.3