diff options
-rw-r--r-- | hakyll.cabal | 71 | ||||
-rw-r--r-- | lib/Hakyll.hs | 6 | ||||
-rw-r--r-- | lib/Hakyll/Core/Util/Parser.hs | 1 | ||||
-rw-r--r-- | stack.yaml | 1 | ||||
-rw-r--r-- | tests/Hakyll/Core/Rules/Tests.hs | 3 | ||||
-rw-r--r-- | tests/Hakyll/Core/Runtime/Tests.hs | 2 | ||||
-rw-r--r-- | tests/Hakyll/Web/Template/Tests.hs | 5 | ||||
-rw-r--r-- | tests/TestSuite.hs | 5 | ||||
-rw-r--r-- | tests/TestSuite/Util.hs | 12 |
9 files changed, 53 insertions, 53 deletions
diff --git a/hakyll.cabal b/hakyll.cabal index 63bea3b..1e7c202 100644 --- a/hakyll.cabal +++ b/hakyll.cabal @@ -99,6 +99,11 @@ Flag buildWebsite Default: False Manual: True +Flag usePandoc + Description: Include Pandoc support + Default: True + Manual: True + Library Ghc-Options: -Wall Hs-Source-Dirs: lib @@ -134,9 +139,6 @@ Library Hakyll.Web.Html Hakyll.Web.Html.RelativizeUrls Hakyll.Web.Paginate - Hakyll.Web.Pandoc - Hakyll.Web.Pandoc.Biblio - Hakyll.Web.Pandoc.FileType Hakyll.Web.Redirect Hakyll.Web.Tags Hakyll.Web.Template @@ -156,7 +158,6 @@ Library Hakyll.Core.Provider.Internal Hakyll.Core.Provider.MetadataCache Hakyll.Core.Util.Parser - Hakyll.Web.Pandoc.Binary Paths_hakyll Build-Depends: @@ -173,14 +174,10 @@ Library filepath >= 1.0 && < 1.5, lrucache >= 1.1.1 && < 1.3, mtl >= 1 && < 2.3, - network >= 2.6 && < 2.7, network-uri >= 2.6 && < 2.7, - pandoc >= 2.0.5 && < 2.2, - pandoc-citeproc >= 0.14 && < 0.15, parsec >= 3.0 && < 3.2, process >= 1.6 && < 1.7, random >= 1.0 && < 1.2, - regex-base >= 0.93 && < 0.94, regex-tdfa >= 1.1 && < 1.3, resourcet >= 1.1 && < 1.3, scientific >= 0.3.4 && < 0.4, @@ -222,6 +219,19 @@ Library Cpp-options: -DCHECK_EXTERNAL + If flag(usePandoc) + Exposed-Modules: + Hakyll.Web.Pandoc + Hakyll.Web.Pandoc.Biblio + Hakyll.Web.Pandoc.FileType + Other-Modules: + Hakyll.Web.Pandoc.Binary + Build-Depends: + pandoc >= 2.0.5 && < 2.2, + pandoc-citeproc >= 0.14 && < 0.15 + Cpp-options: + -DUSE_PANDOC + Test-suite hakyll-tests Type: exitcode-stdio-1.0 Hs-source-dirs: tests @@ -243,7 +253,6 @@ Test-suite hakyll-tests Hakyll.Web.CompressCss.Tests Hakyll.Web.Html.RelativizeUrls.Tests Hakyll.Web.Html.Tests - Hakyll.Web.Pandoc.FileType.Tests Hakyll.Web.Template.Context.Tests Hakyll.Web.Template.Tests TestSuite.Util @@ -256,61 +265,31 @@ Test-suite hakyll-tests tasty-quickcheck >= 0.8 && < 0.11, -- Copy pasted from hakyll dependencies: base >= 4.8 && < 5, - binary >= 0.5 && < 0.10, - blaze-html >= 0.5 && < 0.10, - blaze-markup >= 0.5.1 && < 0.9, bytestring >= 0.9 && < 0.11, containers >= 0.3 && < 0.6, - cryptohash >= 0.7 && < 0.12, - data-default >= 0.4 && < 0.8, - deepseq >= 1.3 && < 1.5, - directory >= 1.0 && < 1.4, filepath >= 1.0 && < 1.5, - lrucache >= 1.1.1 && < 1.3, - mtl >= 1 && < 2.3, - network >= 2.6 && < 2.7, - network-uri >= 2.6 && < 2.7, - pandoc >= 2.0.5 && < 2.2, - pandoc-citeproc >= 0.14 && < 0.15, - parsec >= 3.0 && < 3.2, - process >= 1.6 && < 1.7, - random >= 1.0 && < 1.2, - regex-base >= 0.93 && < 0.94, - regex-tdfa >= 1.1 && < 1.3, - resourcet >= 1.1 && < 1.3, - scientific >= 0.3.4 && < 0.4, - tagsoup >= 0.13.1 && < 0.15, text >= 0.11 && < 1.3, - time >= 1.8 && < 1.10, - time-locale-compat >= 0.1 && < 0.2, unordered-containers >= 0.2 && < 0.3, - vector >= 0.11 && < 0.13, - yaml >= 0.8.11 && < 0.9, - optparse-applicative >= 0.12 && < 0.15 + yaml >= 0.8.11 && < 0.9 If flag(previewServer) - Build-depends: - wai >= 3.2 && < 3.3, - warp >= 3.2 && < 3.3, - wai-app-static >= 3.1 && < 3.2, - http-types >= 0.9 && < 0.13, - fsnotify >= 0.2 && < 0.3 Cpp-options: -DPREVIEW_SERVER If flag(watchServer) - Build-depends: - fsnotify >= 0.2 && < 0.3 Cpp-options: -DWATCH_SERVER If flag(checkExternal) - Build-depends: - http-conduit >= 2.2 && < 2.4, - http-types >= 0.7 && < 0.13 Cpp-options: -DCHECK_EXTERNAL + If flag(usePandoc) + Other-modules: + Hakyll.Web.Pandoc.FileType.Tests + Cpp-options: + -DUSE_PANDOC + Executable hakyll-init Main-is: Init.hs Ghc-options: -Wall -threaded diff --git a/lib/Hakyll.hs b/lib/Hakyll.hs index 7b64bcb..b93736d 100644 --- a/lib/Hakyll.hs +++ b/lib/Hakyll.hs @@ -20,10 +20,12 @@ module Hakyll , module Hakyll.Web.Feed , module Hakyll.Web.Html , module Hakyll.Web.Html.RelativizeUrls - , module Hakyll.Web.Pandoc , module Hakyll.Web.Paginate +#ifdef USE_PANDOC + , module Hakyll.Web.Pandoc , module Hakyll.Web.Pandoc.Biblio , module Hakyll.Web.Pandoc.FileType +#endif , module Hakyll.Web.Redirect , module Hakyll.Web.Tags , module Hakyll.Web.Template @@ -52,9 +54,11 @@ import Hakyll.Web.Feed import Hakyll.Web.Html import Hakyll.Web.Html.RelativizeUrls import Hakyll.Web.Paginate +#ifdef USE_PANDOC import Hakyll.Web.Pandoc import Hakyll.Web.Pandoc.Biblio import Hakyll.Web.Pandoc.FileType +#endif import Hakyll.Web.Redirect import Hakyll.Web.Tags import Hakyll.Web.Template diff --git a/lib/Hakyll/Core/Util/Parser.hs b/lib/Hakyll/Core/Util/Parser.hs index c4b2f8d..abf5eae 100644 --- a/lib/Hakyll/Core/Util/Parser.hs +++ b/lib/Hakyll/Core/Util/Parser.hs @@ -2,7 +2,6 @@ -- | Parser utilities module Hakyll.Core.Util.Parser ( metadataKey - , reservedKeys ) where @@ -6,6 +6,7 @@ flags: previewServer: True watchServer: True checkExternal: True + usePandoc: True buildWebsite: True packages: diff --git a/tests/Hakyll/Core/Rules/Tests.hs b/tests/Hakyll/Core/Rules/Tests.hs index c4c0f28..24b5b8c 100644 --- a/tests/Hakyll/Core/Rules/Tests.hs +++ b/tests/Hakyll/Core/Rules/Tests.hs @@ -17,7 +17,6 @@ import Hakyll.Core.Metadata import Hakyll.Core.Routes import Hakyll.Core.Rules import Hakyll.Core.Rules.Internal -import Hakyll.Web.Pandoc import System.FilePath ((</>)) import Test.Tasty (TestTree, testGroup) import Test.Tasty.HUnit (Assertion, (@=?)) @@ -75,7 +74,7 @@ rules01 ioref = do -- Compile some posts match "*.md" $ do route $ setExtension "html" - compile pandocCompiler + compile copyFileCompiler -- Yeah. I don't know how else to test this stuff? preprocess $ writeIORef ioref True diff --git a/tests/Hakyll/Core/Runtime/Tests.hs b/tests/Hakyll/Core/Runtime/Tests.hs index 5f27854..9c23162 100644 --- a/tests/Hakyll/Core/Runtime/Tests.hs +++ b/tests/Hakyll/Core/Runtime/Tests.hs @@ -39,7 +39,7 @@ case01 = do compile $ do getResourceBody >>= saveSnapshot "raw" - >>= renderPandoc + >>= renderParagraphs match (fromList ["partial.html", "partial-helper.html"]) $ compile templateCompiler diff --git a/tests/Hakyll/Web/Template/Tests.hs b/tests/Hakyll/Web/Template/Tests.hs index 054a9bd..b63a0dd 100644 --- a/tests/Hakyll/Web/Template/Tests.hs +++ b/tests/Hakyll/Web/Template/Tests.hs @@ -16,7 +16,6 @@ import Hakyll.Core.Compiler import Hakyll.Core.Identifier import Hakyll.Core.Item import Hakyll.Core.Provider -import Hakyll.Web.Pandoc import Hakyll.Web.Template import Hakyll.Web.Template.Context import Hakyll.Web.Template.Internal @@ -89,7 +88,9 @@ test (outf, tplf, itemf) = do out <- resourceString provider outf tpl <- testCompilerDone store provider tplf templateBodyCompiler item <- testCompilerDone store provider itemf $ - pandocCompiler >>= applyTemplate (itemBody tpl) testContext + getResourceBody + >>= renderParagraphs + >>= applyTemplate (itemBody tpl) testContext out @=? itemBody item cleanTestEnv diff --git a/tests/TestSuite.hs b/tests/TestSuite.hs index 4260eab..14e02d6 100644 --- a/tests/TestSuite.hs +++ b/tests/TestSuite.hs @@ -1,4 +1,5 @@ -------------------------------------------------------------------------------- +{-# LANGUAGE CPP #-} module Main ( main ) where @@ -22,7 +23,9 @@ import qualified Hakyll.Core.Util.String.Tests import qualified Hakyll.Web.CompressCss.Tests import qualified Hakyll.Web.Html.RelativizeUrls.Tests import qualified Hakyll.Web.Html.Tests +#ifdef USE_PANDOC import qualified Hakyll.Web.Pandoc.FileType.Tests +#endif import qualified Hakyll.Web.Template.Context.Tests import qualified Hakyll.Web.Template.Tests @@ -43,7 +46,9 @@ main = defaultMain $ testGroup "Hakyll" , Hakyll.Web.CompressCss.Tests.tests , Hakyll.Web.Html.RelativizeUrls.Tests.tests , Hakyll.Web.Html.Tests.tests +#ifdef USE_PANDOC , Hakyll.Web.Pandoc.FileType.Tests.tests +#endif , Hakyll.Web.Template.Context.Tests.tests , Hakyll.Web.Template.Tests.tests ] diff --git a/tests/TestSuite/Util.hs b/tests/TestSuite/Util.hs index 33b26ef..fa411f8 100644 --- a/tests/TestSuite/Util.hs +++ b/tests/TestSuite/Util.hs @@ -8,6 +8,7 @@ module TestSuite.Util , testCompilerDone , testConfiguration , cleanTestEnv + , renderParagraphs ) where @@ -29,6 +30,7 @@ import Hakyll.Core.Provider import Hakyll.Core.Store (Store) import qualified Hakyll.Core.Store as Store import Hakyll.Core.Util.File +import Hakyll.Core.Item -------------------------------------------------------------------------------- @@ -102,3 +104,13 @@ cleanTestEnv = do removeDirectory $ destinationDirectory testConfiguration removeDirectory $ storeDirectory testConfiguration removeDirectory $ tmpDirectory testConfiguration + + +-------------------------------------------------------------------------------- +-- | like 'Hakyll.Web.Pandoc.renderPandoc' +-- | but allowing to test without the @usePandoc@ flag +renderParagraphs :: Item String -> Compiler (Item String) +renderParagraphs = withItemBody (return + . intercalate "\n" -- no trailing line + . map (("<p>"++) . (++"</p>")) + . lines) |