hakyll-contrib-i18n 0.1.0.0 → 0.1.1.0
raw patch · 2 files changed
+62/−46 lines, 2 filesdep ~basedep ~bytestringdep ~filepath
Dependency ranges changed: base, bytestring, filepath, hakyll, pandoc, pandoc-include-code, text, time-locale-compat, unordered-containers, yaml
Files
- haki18nll/Main.hs +18/−1
- hakyll-contrib-i18n.cabal +44/−45
haki18nll/Main.hs view
@@ -13,7 +13,9 @@ , translationContext ) +import Control.Monad (mplus) import Data.List (intersperse)+import Data.Maybe (fromMaybe) import System.FilePath ((</>), splitExtension, splitFileName, takeDirectory) import Text.Pandoc (Format (..), Pandoc) import Text.Pandoc.Filter.IncludeCode (includeCode)@@ -302,8 +304,23 @@ (p, "index.html") -> takeDirectory p _ -> url +customListField :: String -> String -> Context a+customListField key custom = listFieldWith key (field custom $ return . itemBody) customListField'+ where+ customListField' :: Item b -> Compiler [Item String]+ customListField' item = do+ metadata <- getMetadata $ itemIdentifier item+ let customs = fromMaybe [] $+ lookupStringList key metadata `mplus`+ (map trim . splitAll "," <$> lookupString key metadata)+ mapM makeItem customs+ generalContext :: Context String-generalContext = dropIndexHtml <> translationContext <> defaultContext+generalContext =+ dropIndexHtml <>+ translationContext <>+ customListField "scripts" "script" <>+ defaultContext postContext :: Tags -> Tags -> Context String postContext tags categories =
hakyll-contrib-i18n.cabal view
@@ -1,25 +1,27 @@ cabal-version: >=1.10 name: hakyll-contrib-i18n-version: 0.1.0.0-license: OtherLicense-license-file: LICENSE-copyright:- Copyright © 2020 Pablo COVES <pablo.coves@protonmail.com>- This work is free. You can redistribute it and/or modify it under the- terms of the Do What The Fuck You Want To Public License, Version 2,- as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.+version: 0.1.1.0 -maintainer: pablo.coves@protonmail.com author: Pablo COVES-bug-reports: https://gitlab.com/pcoves/hakyll-contrib-i18n/-/issues+maintainer: pablo.coves@protonmail.com+ synopsis: A Hakyll library for internationalization.-description:- A companion library for Hakyll that helps with internationalization.- This library defines a custom compiler for translations stored in Yaml files.- Once loaded, one can implicitly use them to translate strings in the template files.+description: This library defines a custom compiler for translations stored in Yaml files.+ Once loaded, one can implicitly use them to translate strings in the template files. +license: OtherLicense+license-file: LICENSE+copyright: Copyright © 2020 Pablo COVES <pablo.coves@protonmail.com>+ This work is free. You can redistribute it and/or modify it under the+ terms of the Do What The Fuck You Want To Public License, Version 2,+ as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.+ category: Web, Hakyll, I18n build-type: Simple+extra-source-files: CHANGELOG.md++bug-reports: https://gitlab.com/pcoves/hakyll-contrib-i18n/-/issues+ data-files: data/assets/images/haskell-logo.png data/css/default.css@@ -54,39 +56,36 @@ data/templates/tag.html data/templates/translation.yml -extra-source-files: CHANGELOG.md- source-repository head- type: git- location: https://gitlab.com/pcoves/hakyll-contrib-i18n+ type: git+ location: https://gitlab.com/pcoves/hakyll-contrib-i18n + library- exposed-modules: Hakyll.Contrib.I18n- hs-source-dirs: src- default-language: Haskell2010- build-depends:- base ==4.*,- binary-instances >=1.0.1 && <1.1,- bytestring >=0.10.10.1 && <0.11,- filepath >=1.4.2.1 && <1.5,- hakyll >=4.13.4.0 && <4.14,- text >=1.2.4.0 && <1.3,- time >=1.9.3 && <1.10,- time-locale-compat >=0.1.1.5 && <0.2,- unordered-containers >=0.2.10.0 && <0.3,- yaml >=0.11.5.0 && <0.12+ hs-source-dirs: src+ exposed-modules: Hakyll.Contrib.I18n+ build-depends: base >= 4.13.0 && < 4.14+ , binary-instances >= 1.0.1 && < 1.1+ , bytestring >= 0.10.10 && < 0.11+ , filepath >= 1.4.2 && < 1.5+ , hakyll >= 4.13.4 && < 4.14+ , text >= 1.2.4 && < 1.3+ , time >= 1.9.3 && < 1.10+ , time-locale-compat >= 0.1.1 && < 0.2+ , unordered-containers >= 0.2.13 && < 0.3+ , yaml >= 0.11.5 && < 0.12+ default-language: Haskell2010 executable haki18nll- main-is: Main.hs- hs-source-dirs: haki18nll- default-language: Haskell2010- ghc-options: -threaded- build-depends:- base ==4.*,- hakyll ==4.13.*,- hakyll-contrib-i18n -any,- filepath >=1.4.2.1 && <1.5,- pandoc >=2.9.2.1 && <2.10,- pandoc-types ==1.20.*,- pandoc-include-code >=1.5.0.0 && <1.6,- unordered-containers >=0.2.10.0 && <0.3+ hs-source-dirs: haki18nll+ main-is: Main.hs+ build-depends: base >= 4.13.0 && < 4.14+ , filepath >= 1.4.2 && < 1.5+ , hakyll >= 4.13.4 && < 4.14+ , hakyll-contrib-i18n+ , pandoc >= 2.9.2 && < 2.10+ , pandoc-include-code >= 1.5.0 && < 1.6+ , pandoc-types >= 1.20 && < 1.21+ , unordered-containers >= 0.2.13 && < 0.3+ ghc-options: -threaded+ default-language: Haskell2010