{"id":19888621,"url":"https://github.com/postgrest/plmustache","last_synced_at":"2025-05-02T17:32:20.655Z","repository":{"id":210729213,"uuid":"689683657","full_name":"PostgREST/plmustache","owner":"PostgREST","description":"Logic-less templates for Postgres","archived":false,"fork":false,"pushed_at":"2024-09-15T19:14:42.000Z","size":42,"stargazers_count":37,"open_issues_count":8,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-09-15T20:31:46.419Z","etag":null,"topics":["c","html","mustache","postgres","postgresql","postgresql-extension"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PostgREST.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":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-10T15:33:04.000Z","updated_at":"2024-09-15T19:14:46.000Z","dependencies_parsed_at":"2024-08-05T04:44:06.939Z","dependency_job_id":"d50afa04-0b54-46e8-947a-dd070413ea2d","html_url":"https://github.com/PostgREST/plmustache","commit_stats":null,"previous_names":["postgrest/plmustache"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PostgREST%2Fplmustache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PostgREST%2Fplmustache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PostgREST%2Fplmustache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PostgREST%2Fplmustache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PostgREST","download_url":"https://codeload.github.com/PostgREST/plmustache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224324468,"owners_count":17292521,"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":["c","html","mustache","postgres","postgresql","postgresql-extension"],"created_at":"2024-11-12T18:07:44.349Z","updated_at":"2025-05-02T17:32:20.637Z","avatar_url":"https://github.com/PostgREST.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# plmustache\n\n[![Coverage Status](https://coveralls.io/repos/github/PostgREST/plmustache/badge.svg)](https://coveralls.io/github/PostgREST/plmustache)\n\nA PostgreSQL extension that provides a language handler for [Mustache](https://mustache.github.io/) templates using https://gitlab.com/jobol/mustach.\n\n## Roadmap\n\n- [x] variable interpolation\n- [x] sections\n  - [x] bools\n  - [ ] arrays\n- [ ] partials\n- [ ] inheritance\n- [ ] lambdas\n\n## Features\n\n### Variables\n\nVariables are handled as per the [mustache spec](https://mustache.github.io/mustache.5.html), a `{{key}}` variable will be interpolated.\n\n```sql\ncreate or replace function win_money(you text, qt money, at timestamptz) returns text as $$\nHello {{you}}!\nYou just won {{qt}} at {{at}}.\n$$ language plmustache;\n\nselect win_money('Sir Meowalot', '12000', now());\n                         win_money\n-----------------------------------------------------------\n Hello Sir Meowalot!                                            +\n You just won $12,000.00 at 2023-12-04 07:44:26.915735-05.\n(1 row)\n```\n\n#### Escaped and Unescaped\n\nA double mustache `{{key}}` will be escaped and a triple mustache `{{{key}}}` will not be escaped.\n\n```sql\ncreate or replace function escape_me(tag text) returns text as $$\n{{tag}}\n$$ language plmustache;\n\nselect escape_me('\u003cscript\u003eevil()\u003c/script\u003e');\n              escape_me\n-------------------------------------\n \u0026lt;script\u0026gt;evil()\u0026lt;/script\u0026gt;\n(1 row)\n\ncreate or replace function do_not_escape_me(tag text) returns text as $$\n{{{tag}}}\n$$ language plmustache;\n\nselect do_not_escape_me('\u003cscript\u003eevil()\u003c/script\u003e');\n    do_not_escape_me\n-------------------------\n \u003cscript\u003eevil()\u003c/script\u003e\n(1 row)\n```\n\n### Sections\n\nBoolean sections:\n\n```sql\ncreate or replace function show_cat(cat text, show bool default true) returns text as $$\n{{#show}}\nA cat appears, it's {{cat}}.\n{{/show}}\n{{^show}}\nA mysterious cat is hiding.\n{{/show}}\n$$ language plmustache;\n\nselect show_cat('Mr. Sleepy');\n            show_cat\n---------------------------------\n A cat appears, it's Mr. Sleepy.+\n\n(1 row)\n\nselect show_cat('Mr. Sleepy', false);\n          show_cat\n-----------------------------\n A mysterious cat is hiding.+\n\n(1 row)\n```\n\nArray iterators:\n\n```sql\ncreate or replace function hello_cats(cats text[]) returns text as $$\nSay hello to: {{#cats}}{{.}}, {{/cats}}\n$$ language plmustache;\n\n\npostgres=# select hello_cats('{Sir Meowalot, Mr. Sleepy, Paquito}');\n                    hello_cats\n---------------------------------------------------\n Say hello to: Sir Meowalot, Mr. Sleepy, Paquito,\n(1 row)\n```\n\n## Installation\n\nClone the repo and submodules:\n\n```\ngit clone --recurse-submodules https://github.com/PostgREST/plmustache\n```\n\nBuild mustach:\n\n```\ncd mustach\nmake \u0026\u0026 sudo make install\nsudo ldconfig\n```\n\nBuild plmustache:\n\n```\ncd ..\n\nmake \u0026\u0026 sudo make install\n```\n\nThen on SQL you can do:\n\n```sql\nCREATE EXTENSION plmustache;\n```\n\nplmustache is tested on Postgres 12, 13, 14, 15, 16.\n\n## Development\n\nFor testing on your local database:\n\n```\nmake installcheck\n```\n\nFor an isolated and reproducible enviroment you can use [Nix](https://nixos.org/download.html).\n\n```\n$ nix-shell\n\n$ with-pg-15 psql\n\n$ with-pg-15 make installcheck\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostgrest%2Fplmustache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpostgrest%2Fplmustache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostgrest%2Fplmustache/lists"}