Skip to content
Snippets Groups Projects
Verified Commit 71fd59a9 authored by Nicolas Lenz's avatar Nicolas Lenz :snowflake:
Browse files

feat: use pandoc-lua-engine

parent 2c29c0b8
No related branches found
No related tags found
No related merge requests found
Pipeline #3572 passed
......@@ -17,6 +17,20 @@
haskellProjects.default = {
packages = {
tztime.source = "0.1.1.0"; # version in nixpkgs is marked broken
#pandoc-lua-engine.source = "0.2.1.5";
};
settings.nebelhorn = {
/*
I'm not sure why, but since adding `pandoc-lua-engine` I need to manually remove these
packages or otherwise `justStaticExecutables` will lead to an error that the output
"is not allowed to refer to the following paths" from ghc.
*/
removeReferencesTo = [
pkgs.haskellPackages.pandoc-types
pkgs.haskellPackages.pandoc
pkgs.haskellPackages.tzdata
];
justStaticExecutables = true;
};
devShell = {
mkShellArgs = {
......@@ -25,7 +39,7 @@
};
};
packages.default = pkgs.haskell.lib.justStaticExecutables self'.packages.nebelhorn;
packages.default = self'.packages.nebelhorn;
apps.default = self'.apps.nebelhorn;
packages.image = pkgs.dockerTools.buildImage {
......
......@@ -44,7 +44,7 @@ executable nebelhorn
, optparse-applicative
, pandoc
, pandoc-types
-- pandoc-lua-engine will be needed for pandoc 3
, pandoc-lua-engine
, path
, path-io
, process
......
......@@ -5,7 +5,7 @@ import Text.Pandoc.Definition
import Text.Pandoc.Class
import Text.Pandoc.Options (def)
import qualified Text.Pandoc.Filter as Filter
import Text.Pandoc.Scripting (noEngine)
import Text.Pandoc.Lua (getEngine)
import Nebelhorn
import Util
import Config
......@@ -13,7 +13,7 @@ import Save
import Path
import Data.List (union)
import qualified Data.Map as Map (singleton, empty)
import Control.Concurrent.Async (mapConcurrently)
import Control.Concurrent.Async (forConcurrently)
import qualified Data.Text as T
import Data.Char (isAlphaNum)
......@@ -187,14 +187,11 @@ putIndex nebelhorn = mapPages putIndex' nebelhorn where
applyFilters :: Nebelhorn -> IO Nebelhorn
applyFilters nebelhorn@Nebelhorn{..} = do
pages' <- (runIOorExplode <$> apply) `mapConcurrently` nebelhornPages
engine <- getEngine
pages' <- forConcurrently nebelhornPages $ runIOorExplode <$> \page@Page{..} -> do
doc' <- Filter.applyFilters engine def nebelhornFilters ["html"] pageDoc
return page { pageDoc = doc' }
return nebelhorn { nebelhornPages = pages' }
where
apply :: (PandocMonad m, MonadIO m) => Page -> m Page
apply page@Page{..} = do
doc' <- Filter.applyFilters noEngine def nebelhornFilters ["html"] pageDoc
return page { pageDoc = doc' }
putFeeds :: Nebelhorn -> Nebelhorn
putFeeds nebelhorn@Nebelhorn{..} = nebelhorn { nebelhornFeeds = putFeed <$> nebelhornFeeds } where
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment