{"id":14966036,"url":"https://github.com/softmoth/raku-template-mustache","last_synced_at":"2025-10-25T13:31:07.344Z","repository":{"id":18009414,"uuid":"21030675","full_name":"softmoth/raku-Template-Mustache","owner":"softmoth","description":"Raku library for the Mustache template format","archived":false,"fork":false,"pushed_at":"2022-10-11T04:43:03.000Z","size":161,"stargazers_count":21,"open_issues_count":2,"forks_count":19,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-01-31T07:12:00.440Z","etag":null,"topics":["mustache","mustache-implementations","raku"],"latest_commit_sha":null,"homepage":"https://modules.raku.org/dist/Template::Mustache:cpan:SOFTMOTH","language":"Raku","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"artistic-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/softmoth.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","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":"2014-06-20T08:21:06.000Z","updated_at":"2024-06-06T13:56:35.000Z","dependencies_parsed_at":"2023-01-11T20:27:48.232Z","dependency_job_id":null,"html_url":"https://github.com/softmoth/raku-Template-Mustache","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softmoth%2Fraku-Template-Mustache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softmoth%2Fraku-Template-Mustache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softmoth%2Fraku-Template-Mustache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softmoth%2Fraku-Template-Mustache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softmoth","download_url":"https://codeload.github.com/softmoth/raku-Template-Mustache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238147580,"owners_count":19424286,"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":["mustache","mustache-implementations","raku"],"created_at":"2024-09-24T13:35:44.181Z","updated_at":"2025-10-25T13:31:02.003Z","avatar_url":"https://github.com/softmoth.png","language":"Raku","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/softmoth/raku-Template-Mustache.svg?branch=master)](https://travis-ci.org/softmoth/raku-Template-Mustache) [![Windows Status](https://ci.appveyor.com/api/projects/status/github/softmoth/raku-Template-Mustache?branch=master\u0026passingText=Windows%20-%20OK\u0026failingText=Windows%20-%20FAIL\u0026pendingText=Windows%20-%20pending\u0026svg=true)](https://ci.appveyor.com/project/softmoth/raku-Template-Mustache/branch/master)\n\nRaku implementation of Mustache templates, [http://mustache.github.io/](http://mustache.github.io/).\n\nSynopsis\n========\n\n```raku\nuse Template::Mustache;\n\n# Call .render as a class method\nTemplate::Mustache.render('Hello, {{planet}}!', { planet =\u003e 'world' }).say;\n\n# Or instantiate an instance\nmy $stache = Template::Mustache.new: :from\u003c./views\u003e;\n\n# Subroutines are called\nsay $stache.render('The time is {{time}}', {\n    time =\u003e { ~DateTime.new(now).local }\n});\n\nmy @people =\n    { :name('James T. Kirk'), :title\u003cCaptain\u003e },\n    { :name('Wesley'), :title('Dread Pirate'), :emcee },\n    { :name('Dana Scully'), :title('Special Agent') },\n    ;\n\n# See this template in ./t/views/roster.mustache\n$stache.render('roster', { :@people }).say;\n\nmy %context =\n    event =\u003e 'Masters of the Universe Convention',\n    :@people,\n    ;\nmy %partials =\n    welcome =\u003e\n        qq:b{Welcome to the {{event}}! We’re pleased to have you here.\\n\\n},\n    ;\n\n# See this result in ./t/50-readme.t\nTemplate::Mustache.render(q:to/EOF/,\n        {{\u003e welcome}}\n        {{\u003e roster}}\n\n            Dinner at 7PM in the Grand Ballroom. Bring a chair!\n        EOF\n    %context,\n    :from([%partials, './views'])\n).say;\n```\n\nDescription\n===========\n\nLogging\n-------\n\n### Log levels\n\nMessages are logged with varying severity levels (from most to least severe): `Fatal`, `Error`, `Warn`, `Info`, `Verbose`, `Audit`, `Debug`, `Trace`, `Trace2`\n\nBy default, only messages of `Error` or worse are logged. That default can be changed with the `TEMPLATE_MUSTACHE_LOGLEVEL` environment variable.\n\n    TEMPLATE_MUSTACHE_LOGLEVEL=Debug\n\nThe default is overridden with the `:log-level` option to `Template::Mustache.new`, or a `Template::Mustache::Logger` object can be passed via the `:logger` option.\n\n```raku\nmy $stache = Template::Mustache.new: :log-level\u003cTrace\u003e;\n\nmy $logger = Template::Mustache::Logger.new: :level\u003cDebug\u003e;\nmy $stache = Template::Mustache.new: :$logger;\n```\n\nEither method can be used with the `.render` method, as well.\n\n```raku\nmy %data = hello =\u003e 'world';\n\nTemplate::Mustache.render: 'Hello, {{hello}}!', %data, :log-level\u003cTrace\u003e;\n\nmy $logger = Template::Mustache::Logger.new: :level\u003cDebug\u003e;\nTemplate::Mustache.render: 'Hello, {{hello}}!', %data, :$logger;\n```\n\n### Log routine\n\nBy default, any messages at level `Warn` or worse are logged with the `warn` routine. A `CONTROL` block can handle such warnings if needed; see [Language/phasers](https://docs.raku.org/language/phasers#CONTROL) for details. Less severe messages (`Info` and up) are logged with the `note` routine.\n\nThe routine can be set per log level, in the `Template::Mustache::Logger.routines` hash.\n\n```raku\n# Use say instead of note for Info and up; the more severe\n# levels (C\u003cWarn\u003e down to C\u003cFatal\u003e) still use the warn routine\nmy $stache = Template::Mustache.new: :log-routine(\u0026say);\n\n# But even those can be set explicitly\n$stache.logger.routines{$_} = \u0026die for \u003cWarn Error Fatal\u003e;\n\n$stache.render: '{{missing}}', {};  # dies\n```\n\n### method log\n\n  * `multi method log(Exception $exception, LogLevel :$level)`\n\n  * `multi method log(LogLevel :$level, *@msgs)`\n\nEmit a message at `$level` (`Info` by default).\n\nExtra features\n==============\n\nTemplate inheritence\n--------------------\n\nSupport for `hogan.js`-style [template inheritence](https://github.com/groue/GRMustache/blob/master/Guides/template_inheritance.md) is available.\n\nPragma: KEEP-UNUSED-VARIABLES\n-----------------------------\n\nSpecify `:pragma\u003cKEEP-UNUSED-VARIABLES\u003e` to either `Template::Mustache.new` or `.render`, and any variables which are not defined in the data context will be kept in the rendered text. See `t/13-pragmas.t` for examples.\n\nMore Examples and Tests\n=======================\n\nThe Mustache spec provides a wealth of examples to demonstrate exactly how the format behaves.\n\n[https://github.com/mustache/spec/tree/master/specs/](https://github.com/mustache/spec/tree/master/specs/)\n\nAll of the official Mustache spec tests pass. A copy of the tests is distributed in `t/specs`.\n\nTo check against the official specs repository, clone it into `../mustache-spec`:\n\n    git clone --depth=1 https://github.com/mustache/spec.git ../mustache-spec\n    prove -v -e 'raku -Ilib' t/\n\nExtra Specifications\n--------------------\n\nThe test file `t/specs/inheritable_partials.json` is taken from [groue/GRMustache](https://github.com/groue/GRMustache).\n\nOther Mustache Implementations\n==============================\n\nThere are many, many Mustache implementations in various languages. Some of note are:\n\n  * The original Ruby version [https://github.com/defunkt/mustache](https://github.com/defunkt/mustache)\n\n  * Twitter's hogan.js [https://github.com/twitter/hogan.js](https://github.com/twitter/hogan.js)\n\n  * mustache.java [https://github.com/spullara/mustache.java](https://github.com/spullara/mustache.java)\n\n  * GRMustache (Objective C) [https://github.com/groue/GRMustache](https://github.com/groue/GRMustache)\n\n  * mustache.php [https://github.com/bobthecow/mustache.php](https://github.com/bobthecow/mustache.php)\n\nTODO\n====\n\n  * full object support (with method calls; currently the object is just stringified)\n\n  * global helpers (context items that float at the top of the stack)\n\n  * database loader\n\n  * pragmas (FILTERS?)\n\nLicense\n=======\n\n[Artistic License 2.0](http://www.perlfoundation.org/artistic_license_2_0)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftmoth%2Fraku-template-mustache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftmoth%2Fraku-template-mustache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftmoth%2Fraku-template-mustache/lists"}