Compare commits

..

1 commit

5 changed files with 9 additions and 86 deletions

View file

@ -1,10 +1,5 @@
# Revision history for hablo # Revision history for hablo
## 1.1.0.1 -- 2021-01-20
* Ensure compilation on Nix as far as 18.09
* Fix missing metadata when landing on articles
## 1.1.0.0 -- 2020-12-13 ## 1.1.0.0 -- 2020-12-13
* Implement static pages * Implement static pages

View file

@ -1,27 +0,0 @@
(use-modules (gnu packages haskell-xyz)
(gnu packages haskell-web)
(guix build-system haskell)
(guix download)
(guix gexp)
(guix git-download)
(guix licenses)
(guix packages))
(package
(name "ghc-template")
(version "0.2.0.10")
(source (origin
(method url-fetch)
(uri (hackage-uri "template" version))
(sha256
(base32
"10mcnhi2rdflmv79z0359nn5sylifvk9ih38xnjqqby6n4hs7mcg"))))
(build-system haskell-build-system)
(properties '((upstream-name . "template")))
(home-page "http://hackage.haskell.org/package/template")
(synopsis "Simple string substitution")
(description
"Simple string substitution library that supports \\\"$\\\"-based substitution.
Meant to be used when Text.Printf or string concatenation would lead to code
that is hard to read but when a full blown templating system is overkill.")
(license bsd-3))

View file

@ -1,44 +0,0 @@
(use-modules (gnu packages haskell-xyz)
(gnu packages haskell-web)
(guix build-system haskell)
(guix download)
(guix gexp)
(guix git-download)
(guix licenses)
(guix packages)
(loom packages sjw))
(let
((%source-dir (dirname (current-filename)))
(ghc-template (load "ghc-template.scm")))
(package
(name "hablo")
(version "devel")
(source
(local-file %source-dir
#:recursive? #t
#:select? (git-predicate %source-dir)))
(build-system haskell-build-system)
(inputs
(list ghc-aeson
ghc-attoparsec
ghc-lucid
ghc-optparse-applicative
ghc-parsec
ghc-random
ghc-sjw
ghc-template
ghc-xdg-basedir))
(native-search-paths
(list
(search-path-specification (variable "SJW_PATH")
(files '("lib/SJW")))))
(home-page "https://git.marvid.fr/Tissevert/SJW")
(synopsis "The Simple Javascript Wrench")
(description
"SJW is a very simple tool to pack several JS modules into a single
script. It doesn't really do proper compilation work (yet) except
resolving the modules dependencies and detecting import loops but it
provides each module with an independent execution context in the
resulting script.")
(license gpl3+)))

View file

@ -3,7 +3,7 @@ cabal-version: >= 1.10
-- For further documentation, see http://haskell.org/cabal/users-guide/ -- For further documentation, see http://haskell.org/cabal/users-guide/
name: hablo name: hablo
version: 1.1.0.1 version: 1.1.0.0
synopsis: A minimalist static blog generator synopsis: A minimalist static blog generator
description: description:
Hablo is a fediverse-oriented static blog generator for articles written Hablo is a fediverse-oriented static blog generator for articles written
@ -50,15 +50,15 @@ library
, Pretty , Pretty
, RSS , RSS
-- other-extensions: -- other-extensions:
build-depends: aeson >= 1.2.0 && < 2.1 build-depends: aeson >= 1.4.0 && < 1.6
, base >= 4.9.1 && < 4.17 , base >= 4.9.1 && < 4.15
, bytestring >= 0.10.8 && < 0.12 , bytestring >= 0.10.8 && < 0.12
, containers >= 0.5.11 && < 0.7 , containers >= 0.5.11 && < 0.7
, directory >= 1.3.1 && < 1.4 , directory >= 1.3.1 && < 1.4
, filepath >= 1.4.2 && < 1.5 , filepath >= 1.4.2 && < 1.5
, lucid >= 2.8.0 && < 2.12 , lucid >= 2.9.11 && < 2.10
, mtl >= 2.2.2 && < 2.3 , mtl >= 2.2.2 && < 2.3
, optparse-applicative >= 0.14.0 && < 0.18 , optparse-applicative >= 0.14.3 && < 0.17
, parsec >= 3.1.13 && < 3.2 , parsec >= 3.1.13 && < 3.2
, template >= 0.2.0 && < 0.3 , template >= 0.2.0 && < 0.3
, text >= 1.2.3 && < 1.3 , text >= 1.2.3 && < 1.3
@ -73,7 +73,7 @@ executable hablo
main-is: src/Main.hs main-is: src/Main.hs
other-modules: Paths_hablo other-modules: Paths_hablo
-- other-extensions: -- other-extensions:
build-depends: base build-depends: base >= 4.9.1 && < 4.15
, hablo , hablo
, mtl >= 2.2.2 && < 2.3 , mtl >= 2.2.2 && < 2.3
ghc-options: -Wall ghc-options: -Wall

View file

@ -16,7 +16,7 @@ import Data.Text.Encoding (encodeUtf8)
import JSON (exportBlog) import JSON (exportBlog)
import Paths_hablo (getDataDir) import Paths_hablo (getDataDir)
import Pretty ((.$)) import Pretty ((.$))
import SJW (compile, source) import SJW (compile, source, sourceCode)
import System.Directory (createDirectoryIfMissing) import System.Directory (createDirectoryIfMissing)
import System.Exit (die) import System.Exit (die)
import System.FilePath ((</>)) import System.FilePath ((</>))
@ -45,11 +45,10 @@ generateConfig destinationDir = do
generateMain :: FilePath -> IO () generateMain :: FilePath -> IO ()
generateMain destinationDir = do generateMain destinationDir = do
habloSources <- (</> "js") <$> getDataDir habloSources <- (</> "js") <$> getDataDir
compile (source [destinationDir, "unitJS", habloSources]) result <- compile $ source [destinationDir, "unitJS", habloSources]
>>= either abort (output . fst) maybe (die "JS compilation failed\n") output =<< sourceCode result
where where
output = writeFile (destinationDir </> "hablo.js") . fromStrict . encodeUtf8 output = writeFile (destinationDir </> "hablo.js") . fromStrict . encodeUtf8
abort = die . (<> "JS compilation failed\n")
generate :: ReaderT Blog IO () generate :: ReaderT Blog IO ()
generate = do generate = do