diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-01-25 10:36:17 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-01-25 10:36:17 +0100 |
commit | 98d311ebc87d8818160bd9c115b8cac4b958c4e1 (patch) | |
tree | 49ca87696ffc16a89a03d7d9985cabcdc30d1758 /src/Hakyll/Web | |
parent | d31e92c09dc824a9347ec935f1dbebfa1512226a (diff) | |
download | hakyll-98d311ebc87d8818160bd9c115b8cac4b958c4e1.tar.gz |
Fix TagSoup options and bump its dependency
Diffstat (limited to 'src/Hakyll/Web')
-rw-r--r-- | src/Hakyll/Web/Pandoc/FileType.hs | 12 | ||||
-rw-r--r-- | src/Hakyll/Web/Urls.hs | 3 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/Hakyll/Web/Pandoc/FileType.hs b/src/Hakyll/Web/Pandoc/FileType.hs index 670f1eb..a10de1c 100644 --- a/src/Hakyll/Web/Pandoc/FileType.hs +++ b/src/Hakyll/Web/Pandoc/FileType.hs @@ -16,14 +16,15 @@ import Hakyll.Core.Compiler -- default -- data FileType - = Html + = Binary + | Css + | Html | LaTeX | LiterateHaskell FileType | Markdown - | Rst + | OrgMode | PlainText - | Css - | Binary + | Rst deriving (Eq, Ord, Show, Read) -- | Get the file type for a certain file. The type is determined by extension. @@ -31,6 +32,7 @@ data FileType fileType :: FilePath -> FileType fileType = fileType' . takeExtension where + fileType' ".css" = Css fileType' ".htm" = Html fileType' ".html" = Html fileType' ".lhs" = LiterateHaskell Markdown @@ -41,12 +43,12 @@ fileType = fileType' . takeExtension fileType' ".mdwn" = Markdown fileType' ".mkd" = Markdown fileType' ".mkdwn" = Markdown + fileType' ".org" = OrgMode fileType' ".page" = Markdown fileType' ".rst" = Rst fileType' ".tex" = LaTeX fileType' ".text" = PlainText fileType' ".txt" = PlainText - fileType' ".css" = Css fileType' _ = Binary -- Treat unknown files as binary -- | Get the file type for the current file diff --git a/src/Hakyll/Web/Urls.hs b/src/Hakyll/Web/Urls.hs index f41d323..7f33ab0 100644 --- a/src/Hakyll/Web/Urls.hs +++ b/src/Hakyll/Web/Urls.hs @@ -16,13 +16,12 @@ import qualified Text.HTML.TagSoup as TS -- | Apply a function to each URL on a webpage -- withUrls :: (String -> String) -> String -> String -withUrls f = TS.renderTagsOptions opts . map tag . TS.parseTags +withUrls f = TS.renderTags . map tag . TS.parseTags where tag (TS.TagOpen s a) = TS.TagOpen s $ map attr a tag x = x attr (k, v) = (k, if k `S.member` refs then f v else v) refs = S.fromList ["src", "href"] - opts = TS.renderOptions {TS.optEscape = id} -- | Convert a filepath to an URL starting from the site root -- |