packages feed

hakyll 3.2.4.0 → 3.2.4.1

raw patch · 6 files changed

+36/−30 lines, 6 files

Files

hakyll.cabal view
@@ -1,5 +1,5 @@ Name:    hakyll-Version: 3.2.4.0+Version: 3.2.4.1  Synopsis: A static website compiler library Description:
src/Hakyll/Core/Rules.hs view
@@ -26,6 +26,7 @@     , resources     , metaCompile     , metaCompileWith+    , freshIdentifier     ) where  import Control.Applicative ((<$>))@@ -208,17 +209,9 @@             -- ^ Compiler generating the other compilers             -> Rules             -- ^ Resulting rules-metaCompile compiler = RulesM $ do-    -- Create an identifier from the state-    state <- get-    let index = rulesMetaCompilerIndex state-        id' = fromCapture "Hakyll.Core.Rules.metaCompile/*" (show index)--    -- Update the state with a new identifier-    put $ state {rulesMetaCompilerIndex = index + 1}--    -- Fallback to 'metaCompileWith' with now known identifier-    unRulesM $ metaCompileWith id' compiler+metaCompile compiler = do+    id' <- freshIdentifier "Hakyll.Core.Rules.metaCompile"+    metaCompileWith id' compiler  -- | Version of 'metaCompile' that allows you to specify a custom identifier for -- the metacompiler.@@ -243,3 +236,13 @@         compilers = [(id', compiler >>> arr makeRule )]      tell $ RuleSet mempty compilers mempty++-- | Generate a fresh Identifier with a given prefix+freshIdentifier :: String                 -- ^ Prefix+                -> RulesM (Identifier a)  -- ^ Fresh identifier+freshIdentifier prefix = RulesM $ do+    state <- get+    let index = rulesNextIdentifier state+        id'   = parseIdentifier $ prefix ++ "/" ++ show index+    put $ state {rulesNextIdentifier = index + 1}+    return id'
src/Hakyll/Core/Rules/Internal.hs view
@@ -56,7 +56,7 @@ -- | Rule state -- data RuleState = RuleState-    { rulesMetaCompilerIndex :: Int+    { rulesNextIdentifier :: Int     } deriving (Show)  -- | Rule environment@@ -84,7 +84,7 @@ runRules rules provider = nubCompilers $     evalState (execWriterT $ runReaderT (unRulesM rules) env) state   where-    state = RuleState {rulesMetaCompilerIndex = 0}+    state = RuleState {rulesNextIdentifier = 0}     env = RuleEnvironment { rulesResourceProvider = provider                           , rulesPattern          = mempty                           , rulesGroup            = Nothing
src/Hakyll/Web/Pandoc/FileType.hs view
@@ -16,14 +16,15 @@ -- 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 @@ 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' ".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
src/Hakyll/Web/Urls.hs view
@@ -11,17 +11,18 @@ import System.FilePath (splitPath, takeDirectory, joinPath) import qualified Data.Set as S -import Text.HTML.TagSoup (Tag (..), renderTags, parseTags)+import qualified Text.HTML.TagSoup as TS  -- | Apply a function to each URL on a webpage -- withUrls :: (String -> String) -> String -> String-withUrls f = renderTags . map tag . parseTags+withUrls f = TS.renderTagsOptions opts . map tag . TS.parseTags   where-    tag (TagOpen s a) = 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"]+    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 --@@ -43,12 +44,12 @@ toSiteRoot = emptyException . joinPath . map parent            . filter relevant . splitPath . takeDirectory   where-    parent = const ".."+    parent            = const ".."     emptyException [] = "."     emptyException x  = x-    relevant "." = False-    relevant "/" = False-    relevant _   = True+    relevant "."      = False+    relevant "/"      = False+    relevant _        = True  -- | Check if an URL links to an external HTTP(S) source --
src/Hakyll/Web/Urls/Relativize.hs view
@@ -34,7 +34,7 @@ relativizeUrlsCompiler :: Compiler (Page String) (Page String) relativizeUrlsCompiler = getRoute &&& id >>^ uncurry relativize   where-    relativize Nothing = id+    relativize Nothing  = id     relativize (Just r) = fmap (relativizeUrls $ toSiteRoot r)  -- | Relativize URL's in HTML