{"id":15703982,"url":"https://github.com/pbrisbin/liquid","last_synced_at":"2025-05-12T16:32:48.174Z","repository":{"id":11157491,"uuid":"13528562","full_name":"pbrisbin/liquid","owner":"pbrisbin","description":"Haskell implementation of Liquid templating by Shopify","archived":false,"fork":false,"pushed_at":"2017-05-30T18:35:33.000Z","size":42,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-01T00:35:19.373Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pbrisbin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-12T20:31:03.000Z","updated_at":"2022-11-20T04:26:44.000Z","dependencies_parsed_at":"2022-08-28T20:00:51.092Z","dependency_job_id":null,"html_url":"https://github.com/pbrisbin/liquid","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbrisbin%2Fliquid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbrisbin%2Fliquid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbrisbin%2Fliquid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pbrisbin%2Fliquid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pbrisbin","download_url":"https://codeload.github.com/pbrisbin/liquid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253776956,"owners_count":21962601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T20:09:40.328Z","updated_at":"2025-05-12T16:32:48.152Z","avatar_url":"https://github.com/pbrisbin.png","language":"Haskell","readme":"# Liquid Haskell\n\nHaskell implementation of Liquid templating by Shopify.\n\n**NOTE**: This project is dead. Please try https://github.com/projectorhq/haskell-liquid\n\n# Installation\n\n```\n$ git clone https://github.com/pbrisbin/liquid \u0026\u0026 cd liquid\n$ cabal sandbox init\n$ cabal install --dependencies-only -- enable-tests\n```\n\n# Usage\n\nGenerally speaking, the function `liquid` takes an object with a valid \n`ToJSON` instance and template content as `Text`. It returns either \n`Left error-message` or `Right processed-template`.\n\nHow you come about this jsonify-able object or the textual template is \nyour business, but here is an example of how I might do things:\n\n```haskell\n{-# LANGUAGE OverloadedStrings #-}\n\nimport Data.Aeson\nimport Data.Text (Text)\nimport Text.Liquid\n\nimport qualified Data.Text as T\n\ndata Post = Post { postTitle :: Text }\n\ndata User = User\n    { userName  :: Text\n    , userAge   :: Int\n    , userPosts :: [Post]\n    }\n\ninstance ToJSON Post where\n    toJSON (Post title) = object [\"title\" .= title]\n\ninstance ToJSON User where\n    toJSON (User name age posts) =\n      object [ \"name\"  .= name\n             , \"age\"   .= age\n             , \"posts\" .= map toJSON posts\n             ]\n\nliquid (User \"Pat\" 28 [Post \"Post one\", Post \"Post two\"]) $\n    T.unlines [ \"Name: {{name}}\"\n              , \"Age:  {{age}}\"\n              , \"Posts:\"\n              , \"{% for post in posts %}\"\n              , \"  * {{post.title}}\"\n              , \"{% endfor %}\"\n              ]\n```\n\nThis may seem verbose as a standalone example, but in a framework-using \nweb application (like Yesod), you'll likely already have models with \n`ToJSON` instances.\n\nA more realistic use case may simply be:\n\n```haskell\nmyHandler :: UserId -\u003e Handler Html\nmyHandler userId = do\n    user     \u003c- get404 userId\n    template \u003c- T.readFile \"templates/user.html\"\n\n    return . preEscapedToMarkup\n           $ either errorHandler id\n           $ liquid user template\n```\n\n## Testing\n\nRunning all specs:\n\n```\n$ cabal test\n```\n\nRunning one spec:\n\n```\n$ cabal exec -- ghc -isrc -itest -e main test/Text/Liquid/RenderSpec.hs\n```\n\nContinuously run specs as files are edited:\n\n```\n$ gem install bundler\n$ bundle\n$ bundle exec guard\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpbrisbin%2Fliquid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpbrisbin%2Fliquid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpbrisbin%2Fliquid/lists"}