{"id":26140104,"url":"https://github.com/crowdagger/postiche","last_synced_at":"2026-03-12T14:40:19.914Z","repository":{"id":274727375,"uuid":"923869468","full_name":"crowdagger/postiche","owner":"crowdagger","description":"Minimal scheme implementation of string templates inspired by mustache","archived":false,"fork":false,"pushed_at":"2025-02-09T10:54:06.000Z","size":49,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-24T10:10:59.793Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scheme","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crowdagger.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,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"lise_henry"}},"created_at":"2025-01-29T00:54:07.000Z","updated_at":"2025-02-09T10:54:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"9d18ab82-dc02-44cf-93fe-1d61af16603e","html_url":"https://github.com/crowdagger/postiche","commit_stats":null,"previous_names":["crowdagger/postiche"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/crowdagger/postiche","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdagger%2Fpostiche","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdagger%2Fpostiche/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdagger%2Fpostiche/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdagger%2Fpostiche/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crowdagger","download_url":"https://codeload.github.com/crowdagger/postiche/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdagger%2Fpostiche/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30428537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T14:34:45.044Z","status":"ssl_error","status_checked_at":"2026-03-12T14:09:33.793Z","response_time":114,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2025-03-11T02:45:12.128Z","updated_at":"2026-03-12T14:40:19.897Z","avatar_url":"https://github.com/crowdagger.png","language":"Scheme","funding_links":["https://github.com/sponsors/lise_henry"],"categories":[],"sub_categories":[],"readme":"# Postiche\n\nMinimal scheme implementation of string templates inspired by\n[mustache](https://mustache.github.io/).\n\n## Usage\n\nPut `{{stuff}}` inside of strings and it will be replaced by some\nother stuff:\n\n```scheme\n(import (scheme base)\n        (scheme write)\n        (postiche mustache))\n\n;; \"Compile\" the string template (it's just a list but whatever)\n(define tpl (process-template \"This a {{adj}} example\\n\"))\n\n;; Provide a context (as an association list) to the template\n(display (apply-template tpl\n                         '((adj . \"silly\"))))\n\n```\n\nwill display \"This is a silly example\". Yay!\n\n\n## Syntax\n\nSyntax is inspired by mustache, but everything is not (and won't be)\nimplemented. \n\n### Variables \n`{{var}}` will be replaced by the value of `var` as provided in the\ncontext. \n\nUnlike (real) Mustache, there is no HTML escaping. \n\nTemplate:\n\n```\n* {{animal}}\n* {{color}}\n```\n\nContext:\n\n```scheme\n'(( animal . \"cat\")\n  ( color . \"orange\"))\n```\n\nOutput:\n```\n* cat\n* orange\n```\n\nLike Mustache, it is possible to access nested elements using the `.`\nsyntax in a tag:\n\nTemplate:\n\n```\n* {{cat.name}}\n* {{cat.color}}\n```\n\nContext:\n```scheme\n'((cat . ((name . \"Pipoune\")\n          (color . \"Orange\"))))\n```\n\nOutput:\n\n```\n* Pipoune\n* Orange\n```\n\n### Sections\n\nSections allow for conditionals and/or list. A section starts with\n`{{#tag}}` and ends with `{{/tag}}`. The inner part will be rendered\nzero, one, or more times, depending of the value of `tag` in context.\n\n#### False values\n\nIf `tag` is not present, or its value is `#f` or `()`, the section\nsimply won't be rendered:\n\nTemplate:\n\n```\nA little {{#pred}} silly{{/pred}} example\n```\n\nContext:\n\n```scheme\n'(( pred . #f )) ;; an empty ( '() ) context gives same results\n```\n\nOutput:\n\n```\nA little example\n```\n\n#### Non false atoms\n\nIf the tag evaluates to a string or an atom, the section content will\nbe rendered:\n\n```\nA little {{#pred}} silly{{/pred}} example\n```\n\nContext:\n\n```scheme\n'(( pred . \"whatever\" )) \n```\n\nOutput:\n\n```\nA little silly example\n```\n\nInside of the section, the value correponding to the tag can also be\naccessed with the `{{.}}` syntax: \n\n```\nA little {{#pred}}{{.}}silly{{/pred}} example\n```\n\nContext:\n\n```scheme\n'(( pred . \"contrived and\" )) \n```\n\nOutput:\n\n```\nA little contrived and silly example\n```\n\nThis syntax is, however, more useful if the value is a list.\n\n#### Lists\n\nIndeed, when `tag` corresponds to a list, the section will be repeated\nfor every element of the list.\n\nTemplate:\n\n```\nLook!{{#foo}} {{.}} example!{{/foo}}\n```\n\nContext:\n\n```scheme\n'(( foo . (\"An\" \"Another\" \"A final\")))\n```\n\nOutput:\n\n```\nLook! An example! Another example! A final example!\n```\n\n#### List of associations lists\n\nFor those who are not afraid of nested parenthesis, it is also\npossible to set each individual element of the list to an association\nlist. In this case, it is possible to access named elements of the\ncurrent item:\n\nTemplate:\n\n```\nANIMAL NOISES\n=============\n{{#animals}} * {{name}}: \"{{noise}}\"\n{{/animals}}\n```\n\nContext :\n\n```scheme\n'((animals . (((name . \"cat\")\n               (noise . \"meow\"))\n              ((name . \"dog\")\n               (noise . \"woof\"))\n              ((name . \"duck\")\n               (noise . \"quack\")))))\n```\n\nOutput: \n\n```\nANIMAL NOISES\n=============\n * cat: \"meow\"\n * dog: \"woof\"\n * duck: \"quack\"\n```\n\n\n#### Inverted sections\n\nSometimes, you want something to be displayed when a value is *not*\nset. In order to do this, you can mark an \"inverted section\" with the\n`{{^tag}}...{{/tag}}` syntax.\n\nSuch \"inverted section\" will only be displayed if var is false or\nempty, similar to the `unless` operator.\n\nTemplate:\n\n```\nA little {{^pred}} silly{{/pred}} example\n```\n\nContext:\n\n```scheme\n'()\n```\n\nOutput:\n\n```\nA little silly example\n```\n\n## Changing delimiters\n\nDepending of the language you are writing in, `{{` and `}}` delimiters\nmight be annoying. It is possible to modify them by giving additional\nargument to `process-template`:\n\n```scheme\n(define my-tpl (process-template \"Some «adj» delimiters\" \"«\" \"»\"))\n(display (apply-template my-tpl\n                         '((adj . unusual))))\n; displays \"Some unusual delimiters\"\n```\n\n\n## Escaping\n\nNo HTML escaping or any escaping. \n\n## Compatibility \n\nCode is written trying to conform to R7RS, but only tested with Guile\nat the moment. \n\n## License\n\nGNU Lesser General Public License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrowdagger%2Fpostiche","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrowdagger%2Fpostiche","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrowdagger%2Fpostiche/lists"}