{"id":16660934,"url":"https://github.com/agrafix/hsmarty","last_synced_at":"2025-04-09T18:51:51.574Z","repository":{"id":10436287,"uuid":"12601130","full_name":"agrafix/HSmarty","owner":"agrafix","description":"Haskell implementation of a subset of the PHP-Smarty template language","archived":false,"fork":false,"pushed_at":"2022-07-31T19:40:51.000Z","size":61,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-04T15:46:22.668Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agrafix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-04T20:16:33.000Z","updated_at":"2022-07-31T03:34:22.000Z","dependencies_parsed_at":"2022-09-06T19:01:04.152Z","dependency_job_id":null,"html_url":"https://github.com/agrafix/HSmarty","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrafix%2FHSmarty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrafix%2FHSmarty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrafix%2FHSmarty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agrafix%2FHSmarty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agrafix","download_url":"https://codeload.github.com/agrafix/HSmarty/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248092674,"owners_count":21046529,"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-12T10:32:28.107Z","updated_at":"2025-04-09T18:51:51.552Z","avatar_url":"https://github.com/agrafix.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HSmarty\n\nHaskell implementation of a subset of the [PHP-Smarty][1] template language.\n\n## Usage\n```haskell\n{-# LANGUAGE OverloadedStrings #-}\nmodule Main where\n\nimport Text.HSmarty\n\nimport qualified Data.HashMap.Strict as HM\nimport qualified Data.Text as T\n\nmain :: IO ()\nmain =\n   renderTemplate \"test.tpl\" $\n   HM.fromList [ ( \"title\", mkParam (\"SomeTitle\" :: T.Text))\n               , ( \"list\", mkParam ([\"a\", \"b\"] :: [T.Text]))\n               ]\n```\n\n## Implemented features\n\n* Basic template parsing (See [Basic Syntax][2])\n* Smarty comments\n* Basic expressions (eg. `$var`, `$var.mapItem`, `$var[3]`, `$var@property`, `3+4`, ..)\n* Branching (eg. `{if ..}`, `{elseif ..}`, `{else}`, ..)\n* Looping with properties (eg. `{foreach $el as $k=\u003e$v}`, `{$v@last}`, `{foreachelse}`, `{/foreach}`)\n* Including other templates (`{include file='other.tpl'}`)\n* Defining functions (`{function name='foo'}...{/function}`)\n* Calling functions (`{foo arg1=\"bar\"}`)\n* Assigning variables (`{$foo=1+2+3}`)\n* Capturing output into variables (`{capture name='blabla'}\u003cb\u003e{$some}\u003c/b\u003e{/capture}`)\n\n### Non-Smarty features\n\n* Explicit scoping blocks (`{scope}{$localFoo=123}{$localFoo}{/scope}{* $localFoo not available here! *}`)\n\n## Contributing\n\nAll constributions adding features of the \"original\" PHP-Smarty V3 are welcome. For any other contributions please discuss in an issue first. Note that by sending a PR you agree that all your code can be released under the BSD3 license as part of this project or otherwise.\n\n[1]: http://www.smarty.net/\n[2]: http://www.smarty.net/docs/en/language.basic.syntax.tpl\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagrafix%2Fhsmarty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagrafix%2Fhsmarty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagrafix%2Fhsmarty/lists"}