{"id":17816051,"url":"https://github.com/ialarmedalien/bio-kbase-templater","last_synced_at":"2025-04-02T09:13:28.484Z","repository":{"id":142217280,"uuid":"246897650","full_name":"ialarmedalien/Bio-KBase-Templater","owner":"ialarmedalien","description":"Module for rendering templates using Template Toolkit (Perl).","archived":false,"fork":false,"pushed_at":"2020-03-12T21:01:15.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-08T00:18:44.507Z","etag":null,"topics":["kbase","perl","template-toolkit"],"latest_commit_sha":null,"homepage":"","language":null,"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/ialarmedalien.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-12T17:51:29.000Z","updated_at":"2020-03-12T21:01:17.000Z","dependencies_parsed_at":"2023-06-18T11:02:57.640Z","dependency_job_id":null,"html_url":"https://github.com/ialarmedalien/Bio-KBase-Templater","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/ialarmedalien%2FBio-KBase-Templater","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ialarmedalien%2FBio-KBase-Templater/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ialarmedalien%2FBio-KBase-Templater/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ialarmedalien%2FBio-KBase-Templater/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ialarmedalien","download_url":"https://codeload.github.com/ialarmedalien/Bio-KBase-Templater/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246785453,"owners_count":20833494,"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":["kbase","perl","template-toolkit"],"created_at":"2024-10-27T16:33:55.338Z","updated_at":"2025-04-02T09:13:28.458Z","avatar_url":"https://github.com/ialarmedalien.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bio::KBase::Templater\n\nModule for rendering templates using [Template Toolkit](http://www.template-toolkit.org). This is intended for use with KBase apps (hence the module naming) but can be used anywhere.\n\n## Installation\n\n* Copy `Templater.pm` into `lib/Bio/KBase` of your app\n* Copy the contents of `t` into the `test` directory\n* Copy the `templates` directory into your root directory\n* Edit your `cpanfile` to include the module prerequisites:\n\n```\nrequires 'Cpanel::JSON::XS', '\u003e= 4.19';\nrequires 'JSON::MaybeXS', '\u003e= 1.004000';\nrequires 'Path::Tiny', '\u003e= 0.112';\nrequires 'Template::Plugin::JSON', '\u003e= 0.08';\nrequires 'Template', '\u003e= 2.26';\nrequires 'Test::Most', '\u003e= 0.35';\nrequires 'Test::Output', '\u003e= 1.031';\nrequires 'Try::Tiny', '\u003e= 0.30';\n```\n\nIf your app does not follow modern Perl conventions for specifying prerequisites, directory organisation, and basic testing, please read the advice in [ModernPerl.md](ModernPerl.md).\n\n## Usage\n\n### In an app:\n\n```\npackage MyApp;\n\nuse strict;\nuse warnings;\nuse feature qw( say );\nuse Bio::KBase::Templater;\n\nmy $data_for_template = {\n  title =\u003e '2020 Spring Sale',\n  price =\u003e {\n    gold        =\u003e 100,\n    platinum    =\u003e 200,\n    kryptonite  =\u003e 300,\n  }\n};\n\n# save the rendered template as a string\nmy $string;\nBio::KBase::Templater::render_template(\n    '/path/to/template/file.tt',\n    { template_data =\u003e $data_for_template },\n    \\$string,\n);\n\nsay $string;\n\n# or to a file\nBio::KBase::Templater::render_template(\n    '/path/to/template/file.tt',\n    { template_data =\u003e $data_for_template },\n    '/path/to/output/file.txt',\n);\n\n```\n\n### Sample template\n\n```\n[% WRAPPER standard_page.tt %]\n\u003ch3\u003e[% title %]\u003c/h3\u003e\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eSubstance\u003c/th\u003e\u003cth\u003eCost per ounce\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n  [% FOR substance IN price.keys %]\n    \u003ctr\u003e\n      \u003ctd\u003e[% substance %]\u003c/td\u003e\n      \u003ctd\u003e[% price.$substance %]\u003c/td\u003e\n    \u003c/tr\u003e\n  [% END %]\n  \u003c/tbody\u003e\n\u003c/table\u003e\n[% END %]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fialarmedalien%2Fbio-kbase-templater","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fialarmedalien%2Fbio-kbase-templater","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fialarmedalien%2Fbio-kbase-templater/lists"}