{"id":13822562,"url":"https://github.com/davidB/handlebars_misc_helpers","last_synced_at":"2025-05-16T17:31:13.252Z","repository":{"id":35026952,"uuid":"198047113","full_name":"davidB/handlebars_misc_helpers","owner":"davidB","description":"A collection of helpers for handlebars (rust) to manage string, json, yaml, toml, path, file, http request.","archived":false,"fork":false,"pushed_at":"2024-11-11T02:33:25.000Z","size":212,"stargazers_count":26,"open_issues_count":5,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-13T18:37:06.277Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://crates.io/crates/handlebars_misc_helpers","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2019-07-21T11:17:15.000Z","updated_at":"2024-09-23T14:32:45.000Z","dependencies_parsed_at":"2024-01-18T04:06:53.531Z","dependency_job_id":"180e005b-a717-464b-9768-30a3905034a9","html_url":"https://github.com/davidB/handlebars_misc_helpers","commit_stats":{"total_commits":132,"total_committers":6,"mean_commits":22.0,"dds":"0.18181818181818177","last_synced_commit":"3f7183d8eb39f7ea3a1e3d2871ef1e5cae2f1e69"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidB%2Fhandlebars_misc_helpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidB%2Fhandlebars_misc_helpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidB%2Fhandlebars_misc_helpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidB%2Fhandlebars_misc_helpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidB","download_url":"https://codeload.github.com/davidB/handlebars_misc_helpers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225442813,"owners_count":17475115,"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-08-04T08:02:06.371Z","updated_at":"2024-11-19T23:30:40.257Z","avatar_url":"https://github.com/davidB.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# handlebars_misc_helpers \u003c!-- omit in toc --\u003e\n\n[![crates license](https://img.shields.io/crates/l/handlebars_misc_helpers.svg)](http://creativecommons.org/publicdomain/zero/1.0/)\n[![crate version](https://img.shields.io/crates/v/handlebars_misc_helpers.svg)](https://crates.io/crates/handlebars_misc_helpers)\n[![Documentation](https://docs.rs/handlebars_misc_helpers/badge.svg)](https://docs.rs/handlebars_misc_helpers/)\n\n[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)\n[![Actions Status](https://github.com/davidB/handlebars_misc_helpers/workflows/ci-flow/badge.svg)](https://github.com/davidB/handlebars_misc_helpers/actions)\n[![test coverage](https://codecov.io/gh/davidB/handlebars_misc_helpers/branch/master/graph/badge.svg)](https://codecov.io/gh/davidB/handlebars_misc_helpers)\n\nA collection of helpers for handlebars (rust) to manage String, JSON, YAML, TOML, path, file, and HTTP requests.\n\nHelpers extend the template to generate or transform content.\nFew helpers are included, but if you need more helpers, ask via an issue or a PR.\n\nTo use a helper:\n\n```handlebars\n// arguments are space separated\n{{ helper_name arguments}}\n```\n\nTo chain helpers, use parenthesis:\n\n```handlebars\n{{ to_upper_case (to_singular \"Hello foo-bars\") }}\n// -\u003e BAR\n\n{{ first_non_empty (unquote (json_str_query \"package.edition\" (read_to_str \"Cargo.toml\") format=\"toml\")) (env_var \"MY_VERSION\") \"foo\" }}\n// -\u003e 2018\n```\n\nsee [Handlebars templating language](https://handlebarsjs.com/)\n\nTo not \"import\" useless dependencies, use the crate's features:\n\n```toml\ndefault = [\"string\", \"http_attohttpc\", \"json\", \"jsonnet\", \"regex\", \"uuid\"]\nhttp_attohttpc = [\"dep:attohttpc\"]\nhttp_reqwest = [\"dep:reqwest\"]\njson = [\n    \"dep:jmespath\",\n    \"dep:serde\",\n    \"dep:serde_json\",\n    \"dep:serde_yaml\",\n    \"dep:toml\",\n]\njsonnet = [\"dep:jsonnet-rs\"]\njsontype = [\"dep:serde_json\"]\nregex = [\"dep:regex\"]\nstring = [\"dep:cruet\", \"dep:enquote\", \"jsontype\"]\nuuid = [\"dep:uuid\"]\n```\n\n\u003c!-- TOC depthFrom:2 --\u003e\n\n- [String transformation](#string-transformation)\n- [Regular expression](#regular-expression)\n- [UUID](#uuid)\n- [HTTP content](#http-content)\n- [Path extraction](#path-extraction)\n- [File](#file)\n- [Environment variable](#environment-variable)\n- [JSON \\\u0026 YAML \\\u0026 TOML](#json--yaml--toml)\n  - [Helpers](#helpers)\n  - [Blocks](#blocks)\n  - [Edition via Jsonnet](#edition-via-jsonnet)\n- [Assign, set](#assign-set)\n- [Replace section](#replace-section)\n\n\u003c!-- /TOC --\u003e\n\n## String transformation\n\n| helper signature                         | usage sample                               | sample out            |\n| ---------------------------------------- | ------------------------------------------ | --------------------- |\n| `replace s:String from:String to:String` | `replace \"Hello old\" \"old\" \"new\"`          | `\"Hello new\"`         |\n| `to_lower_case s:String`                 | `to_lower_case \"Hello foo-bars\"`           | `\"hello foo-bars\"`    |\n| `to_upper_case s:String`                 | `to_upper_case \"Hello foo-bars\"`           | `\"HELLO FOO-BARS\"`    |\n| `to_camel_case s:String`                 | `to_camel_case \"Hello foo-bars\"`           | `\"helloFooBars\"`      |\n| `to_pascal_case s:String`                | `to_pascal_case \"Hello foo-bars\"`          | `\"HelloFooBars\"`      |\n| `to_snake_case s:String`                 | `to_snake_case \"Hello foo-bars\"`           | `\"hello_foo_bars\"`    |\n| `to_screaming_snake_case s:String`       | `to_screaming_snake_case \"Hello foo-bars\"` | `\"HELLO_FOO_BARS\"`    |\n| `to_kebab_case s:String`                 | `to_kebab_case \"Hello foo-bars\"`           | `\"hello-foo-bars\"`    |\n| `to_train_case s:String`                 | `to_train_case \"Hello foo-bars\"`           | `\"Hello-Foo-Bars\"`    |\n| `to_sentence_case s:String`              | `to_sentence_case \"Hello foo-bars\"`        | `\"Hello foo\" bars`    |\n| `to_title_case s:String`                 | `to_title_case \"Hello foo-bars\"`           | `\"Hello Foo Bars\"`    |\n| `to_class_case s:String`                 | `to_class_case \"Hello foo-bars\"`           | `\"HelloFooBar\"`       |\n| `to_table_case s:String`                 | `to_table_case \"Hello foo-bars\"`           | `\"hello_foo_bars\"`    |\n| `to_plural s:String`                     | `to_plural \"Hello foo-bars\"`               | `\"bars\"`              |\n| `to_singular s:String`                   | `to_singular \"Hello foo-bars\"`             | `\"bar\"`               |\n| `to_foreign_key s:String`                | `to_foreign_key \"Hello foo-bars\"`          | `\"hello_foo_bars_id\"` |\n| `demodulize s:String`                    | `demodulize \"Test::Foo::Bar\"`              | `\"Bar\"`               |\n| `ordinalize s:String+`                   | `ordinalize \"9\"`                           | `\"9th\"`               |\n| `deordinalize s:String+`                 | `deordinalize \"9th\"`                       | `\"9\"`                 |\n| `trim s:String`                          | `trim \" foo \"`                             | `\"foo\"`               |\n| `trim_start s:String`                    | `trim_start \" foo \"`                       | `\"foo \"`              |\n| `trim_end s:String`                      | `trim_end \" foo \"`                         | `\" foo\"`              |\n| `unquote s:String`                       | `unquote \"\\\"foo\\\"\"`                        | `\"foo\"`               |\n| `enquote symbol:String s:String`         | `enquote \"\" \"foo\"`                         | `\"\\\"foo\\\"\"`           |\n| `first_non_empty s:String+`              | `first_non_empty \"\" null \"foo\" \"bar\"`      | `\"foo\"`               |\n\n## Regular expression\n\n| usage                                                                                                                    | output                                                             |\n| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------ |\n| `{{ regex_is_match  pattern=\"(?\u003cfirst\u003e\\\\w)(\\\\w)(?:\\\\w)\\\\w(?\u003clast\u003e\\\\w)\" on=\"today\" }}`                                    | `true`                                                             |\n| `{{#if (regex_is_match pattern=\"(?\u003cfirst\u003e\\\\w)(\\\\w)(?:\\\\w)\\\\w(?\u003clast\u003e\\\\w)\" on=\"today\" ) }}ok{{/if}}`                      | `ok`                                                               |\n| `{{ regex_captures pattern=\"(?\u003cfirst\u003e\\\\w)(\\\\w)(?:\\\\w)\\\\w(?\u003clast\u003e\\\\w)\" on=\"today\" }}`                                     | `[object]`                                                         |\n| `{{ json_to_str( regex_captures pattern=\"(?\u003cfirst\u003e\\\\w)(\\\\w)(?:\\\\w)\\\\w(?\u003clast\u003e\\\\w)\" on=\"today\" ) }}`                      | `{\"_0\":\"today\",\"_1\":\"t\",\"_2\":\"o\",\"_3\":\"y\",\"first\":\"t\",\"last\":\"y\"}` |\n| `{{ set captures=( regex_captures pattern=\"(?\u003cfirst\u003e\\\\w)(\\\\w)(?:\\\\w)\\\\w(?\u003clast\u003e\\\\w)\" on=\"today\" ) }}{{ captures.last }}` | `y`                                                                |\n\n## UUID\n\n| usage                     | output                                 |\n| ------------------------- | -------------------------------------- |\n| `{{ uuid_new_v4 }}`       | `6db4d8a7-8117-4b72-9dbc-988e6ee2a6e3` |\n| `{{ len (uuid_new_v4) }}` | `36`                                   |\n| `{{ uuid_new_v7 }}`       | `94d7bb75-9b16-40dd-878d-5fbb37b8ae2c` |\n| `{{ len (uuid_new_v7) }}` | `36`                                   |\n\n## HTTP content\n\nThe helpers can render the body's response from an HTTP request.\n\n| helper signature                | usage sample                           |\n| ------------------------------- | -------------------------------------- |\n| `http_get url:String`           | `http_get \"http://hello/...\"`          |\n| `gitignore_io templates:String` | `gitignore_io \"rust,visualstudiocode\"` |\n\n## Path extraction\n\nHelper able to extract (or transform) path (defined as string).\n\nfor the same input: `\"/hello/bar/foo.txt\"`\n\n| helper_name | sample output  |\n| ----------- | -------------- |\n| file_name   | `\"foo.txt\"`    |\n| parent      | `\"/hello/bar\"` |\n| extension   | `\"txt\"`        |\n\n## File\n\nHelper to read file content.\n\n| usage                                     | output                     |\n| ----------------------------------------- | -------------------------- |\n| `{{ read_to_str \"/foo/bar\" }}`            | content of file `/foo/bar` |\n| `{{ read_to_str \"file/does/not/exist\" }}` | empty string               |\n\n## Environment variable\n\nThe helper can get environment variables.\n\n| helper_name | usage            |\n| ----------- | ---------------- |\n| env_var     | `env_var \"HOME\"` |\n\nSome special environment variables are predefined (some of them come from [`std::env::consts` - Rust](https://doc.rust-lang.org/std/env/consts/index.html)):\n\n\u003ctable\u003e\n    \u003cthead\u003e\n        \u003ctr\u003e\n            \u003cth\u003evariable\u003c/th\u003e\n            \u003cth\u003epossible values\u003c/th\u003e\n        \u003c/tr\u003e\n    \u003c/thead\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\u003ctd\u003e\u003ccode\u003e\"ARCH\"\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003cul\u003e\n            \u003cli\u003ex86\u003c/li\u003e\n            \u003cli\u003ex86_64\u003c/li\u003e\n            \u003cli\u003earm\u003c/li\u003e\n            \u003cli\u003eaarch64\u003c/li\u003e\n            \u003cli\u003emips\u003c/li\u003e\n            \u003cli\u003emips64\u003c/li\u003e\n            \u003cli\u003epowerpc\u003c/li\u003e\n            \u003cli\u003epowerpc64\u003c/li\u003e\n            \u003cli\u003es390x\u003c/li\u003e\n            \u003cli\u003esparc64\u003c/li\u003e\n        \u003c/ul\u003e\u003c/td\u003e\u003c/tr\u003e\n        \u003ctr\u003e\u003ctd\u003e\u003ccode\u003e\"DLL_EXTENSION\"\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003cul\u003e\n            \u003cli\u003eso\u003c/li\u003e\n            \u003cli\u003edylib\u003c/li\u003e\n            \u003cli\u003edll\u003c/li\u003e\n        \u003c/ul\u003e\u003c/td\u003e\u003c/tr\u003e\n        \u003ctr\u003e\u003ctd\u003e\u003ccode\u003e\"DLL_PREFIX\"\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003cul\u003e\n            \u003cli\u003elib\u003c/li\u003e\n            \u003cli\u003e\"\" (an empty string)\u003c/li\u003e\n        \u003c/ul\u003e\u003c/td\u003e\u003c/tr\u003e\n        \u003ctr\u003e\u003ctd\u003e\u003ccode\u003e\"DLL_SUFFIX\"\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003cul\u003e\n            \u003cli\u003e.so\u003c/li\u003e\n            \u003cli\u003e.dylib\u003c/li\u003e\n            \u003cli\u003e.dll\u003c/li\u003e\n        \u003c/ul\u003e\u003c/td\u003e\u003c/tr\u003e\n        \u003ctr\u003e\u003ctd\u003e\u003ccode\u003e\"EXE_EXTENSION\"\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003cul\u003e\n            \u003cli\u003eexe\u003c/li\u003e\n            \u003cli\u003e\"\" (an empty string)\u003c/li\u003e\n        \u003c/ul\u003e\u003c/td\u003e\u003c/tr\u003e\n        \u003ctr\u003e\u003ctd\u003e\u003ccode\u003e\"EXE_SUFFIX\"\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003cul\u003e\n            \u003cli\u003e.exe\u003c/li\u003e\n            \u003cli\u003e.nexe\u003c/li\u003e\n            \u003cli\u003e.pexe\u003c/li\u003e\n            \u003cli\u003e\"\" (an empty string)\u003c/li\u003e\n        \u003c/ul\u003e\u003c/td\u003e\u003c/tr\u003e\n        \u003ctr\u003e\u003ctd\u003e\u003ccode\u003e\"FAMILY\"\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003cul\u003e\n            \u003cli\u003eunix\u003c/li\u003e\n            \u003cli\u003ewindows\u003c/li\u003e\n        \u003c/ul\u003e\u003c/td\u003e\u003c/tr\u003e\n        \u003ctr\u003e\u003ctd\u003e\u003ccode\u003e\"OS\"\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003cul\u003e\n            \u003cli\u003elinux\u003c/li\u003e\n            \u003cli\u003emacos\u003c/li\u003e\n            \u003cli\u003eios\u003c/li\u003e\n            \u003cli\u003efreebsd\u003c/li\u003e\n            \u003cli\u003edragonfly\u003c/li\u003e\n            \u003cli\u003enetbsd\u003c/li\u003e\n            \u003cli\u003eopenbsd\u003c/li\u003e\n            \u003cli\u003esolaris\u003c/li\u003e\n            \u003cli\u003eandroid\u003c/li\u003e\n            \u003cli\u003ewindows\u003c/li\u003e\n        \u003c/ul\u003e\u003c/td\u003e\u003c/tr\u003e\n        \u003ctr\u003e\n          \u003ctd\u003e\u003ccode\u003e\"USERNAME\"\u003c/code\u003e\u003c/td\u003e\n          \u003ctd\u003etry to find the current username, in the order:\u003col\u003e\n            \u003cli\u003eenvironment variable \u003ccode\u003e\"USERNAME\"\u003c/code\u003e\u003c/li\u003e\n            \u003cli\u003eenvironment variable \u003ccode\u003e\"username\"\u003c/code\u003e\u003c/li\u003e\n            \u003cli\u003eenvironment variable \u003ccode\u003e\"USER\"\u003c/code\u003e\u003c/li\u003e\n            \u003cli\u003eenvironment variable \u003ccode\u003e\"user\"\u003c/code\u003e\u003c/li\u003e\n          \u003c/ol\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n    \u003c/tbody\u003e\n\u003c/table\u003e\n\n## JSON \u0026 YAML \u0026 TOML\n\n### Helpers\n\n- `json_query query:String data:Json`: Helper able to extract information from JSON using [JMESPath](http://jmespath.org/) syntax for `query`.\n- `json_str_query query:String data:String`: Helper able to extract information from JSON using [JMESPath](http://jmespath.org/) syntax for `query`, data follows the requested `format`.\n- `json_to_str data:Json`: convert JSON data into a string following the requested `format`.\n- `str_to_json data:String`: convert(parse) a string into a JSON following the requested `format`.\n\nThe optional requested `format`, is the format of the string with data:\n\n- `\"json\"` (default if omitted)\n- `\"json_pretty\"` JSON with indentation,...\n- `\"yaml\"`\n- `\"toml\"`\n- `\"toml_pretty\"`\n\n| usage                                                                                              | output                          |\n| -------------------------------------------------------------------------------------------------- | ------------------------------- |\n| `{{ json_query \"foo\" {} }}`                                                                        | ``                              |\n| `{{ json_to_str ( json_query \"foo\" {\"foo\":{\"bar\":{\"baz\":true}}} ) }}`                              | `{\"bar\":{\"baz\":true}}`          |\n| `{{ json_to_str ( json_query \"foo\" (str_to_json \"{\\\"foo\\\":{\\\"bar\\\":{\\\"baz\\\":true}}}\" ) ) }}`       | `{\"bar\":{\"baz\":true}}`          |\n| `{{ json_str_query \"foo\" \"{\\\"foo\\\":{\\\"bar\\\":{\\\"baz\\\":true}}}\" }}`                                  | `{\"bar\":{\"baz\":true}}`          |\n| `{{ json_str_query \"foo.bar.baz\" \"{\\\"foo\\\":{\\\"bar\\\":{\\\"baz\\\":true}}}\" }}`                          | `true`                          |\n| `{{ json_str_query \"foo\" \"foo:\\n bar:\\n  baz: true\\n\" format=\"yaml\"}}`                             | `bar:\\n  baz: true\\n`           |\n| `{{ json_to_str ( str_to_json \"{\\\"foo\\\":{\\\"bar\\\":{\\\"baz\\\":true}}}\" format=\"json\") format=\"yaml\"}}` | `foo:\\n  bar:\\n    baz: true\\n` |\n\n### Blocks\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cpre\u003e\u003ccode\u003e{{#from_json format=\"toml\"}}\n{\"foo\": {\"hello\":\"1.2.3\", \"bar\":{\"baz\":true} } }\n{{/from_json}}\n\u003c/code\u003e\u003c/pre\u003e\n\u003c/td\u003e\n\u003ctd\u003e\u003cpre\u003e\u003ccode\u003e[foo]\nhello = \"1.2.3\"\n\n[foo.bar]\nbaz = true\u003c/code\u003e\u003c/pre\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cpre\u003e\u003ccode\u003e{{#to_json format=\"toml\"}}\n[foo]\nbar = { baz = true }\nhello = \"1.2.3\"\n{{/to_json}}\u003c/code\u003e\u003c/pre\u003e\n\u003c/td\u003e\n\u003ctd\u003e\u003cpre\u003e\u003ccode\u003e{\n  \"foo\": {\n    \"bar\": {\n      \"baz\": true\n    },\n    \"hello\": \"1.2.3\"\n  }\n}\u003c/code\u003e\u003c/pre\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cpre\u003e\u003ccode\u003e{{#from_json format=\"yaml\"}}\n{\"foo\":{\"bar\":{\"baz\":true}}}\n{{/from_json}}\u003c/code\u003e\u003c/pre\u003e\n\u003c/td\u003e\n\u003ctd\u003e\u003cpre\u003e\u003ccode\u003efoo:\n  bar:\n    baz: true\u003c/code\u003e\u003c/pre\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cpre\u003e\u003ccode\u003e{{#to_json format=\"yaml\"}}\nfoo:\n    bar:\n        baz: true\n{{/to_json}}\u003c/code\u003e\u003c/pre\u003e\n\u003c/td\u003e\n\u003ctd\u003e\u003cpre\u003e\u003ccode\u003e{\n  \"foo\": {\n    \"bar\": {\n      \"baz\": true\n    }\n  }\n}\u003c/code\u003e\u003c/pre\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\nNote: YAML \u0026 TOML content are used as input and output formats for JSON data. So capabilities are limited to what JSON support (eg. no date-time type like in TOML).\n\n### Edition via Jsonnet\n\nFor a more advanced edition of JSON, you can use Jsonnet.\n\n\u003e A data templating language for app and tool developers\n\n- See the doc of [jsonnet](https://jsonnet.org/learning/tutorial.html) for more samples, and syntax info,...\n- This block can be combined with conversion helper/block for YAML \u0026 TOML to provide edition capabilities for those format\n- the output should be a valid JSON, except if `string_output = false` is set as a parameter of the block.\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cpre\u003e\u003ccode\u003e{{#jsonnet}}\nlocal v = {\"foo\":{\"bar\":{\"baz\":false}}};\nv {\n  \"foo\" +: {\n      \"bar\" +: {\n          \"baz2\": true\n      }\n  }\n}\n{{/jsonnet}}\u003c/code\u003e\u003c/pre\u003e\n\u003c/td\u003e\n\u003ctd\u003e\u003cpre\u003e\u003ccode\u003e{\n  \"foo\": {\n      \"bar\": {\n          \"baz\": false,\n          \"baz2\": true\n      }\n  }\n}\u003c/code\u003e\u003c/pre\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n## Assign, set\n\nThe helpers can assign a variable to use later in the template.\n\n⚠️ `assign` is deprecated and replaced by `set` (more compact and allows multiple assignments in one call)\n\n| usage                                                             | output          |\n| ----------------------------------------------------------------- | --------------- |\n| `{{ assign \"foo\" \"hello world\" }}{{ foo }}`                       | `hello world`   |\n| `{{ set foo=\"{}\" }}`                                              | ``              |\n| `{{ set foo=\"{}\" }}{{ foo }}`                                     | `{}`            |\n| `{{ set foo=\"hello world\" }}{{ foo }}`                            | `hello world`   |\n| `{{ set foo={} }}{{ foo }}`                                       | `[object]`      |\n| `{{ set foo={\"bar\": 33} }}{{ foo }}`                              | `[object]`      |\n| `{{ set foo={\"bar\": 33} }}{{ foo.bar }}`                          | `33`            |\n| `{{ set foo=\"world\" bar=\"hello\" }}\u003e{{ bar }} {{ foo }}\u003c`          | `\u003ehello world\u003c` |\n| `{{ set foo=\"world\" }}{{ set bar=\"hello\" }}\u003e{{ bar }} {{ foo }}\u003c` | `\u003ehello world\u003c` |\n\n## Replace section\n\nThis helper can replace a section delimited by a boundary.\n\nFor example with this template:\n\n```handlebars\n{{~#replace_section  begin=\"\u003c!-- #region head--\u003e\" end=\"\u003c!-- #endregion head --\u003e\" content }}\nThis is the new content of the block\n{{~/replace_section}}\n```\n\nThe `content` having\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"UTF-8\" /\u003e\n    \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" /\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /\u003e\n    \u003ctitle\u003eDocument\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003c!-- #region head--\u003e\n    Something by default\n    \u003c!-- #endregion head --\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\nThe content between `\u003c!-- #region head--\u003e` and `\u003c!-- #endregion head --\u003e` is replaced by the result of the inner template:\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"UTF-8\" /\u003e\n    \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" /\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /\u003e\n    \u003ctitle\u003eDocument\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003c!-- #region head--\u003eThis is the new content of the block\u003c!-- #endregion head --\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\nNote: you can remove the boundary by adding `remove_boundaries=true`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FdavidB%2Fhandlebars_misc_helpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FdavidB%2Fhandlebars_misc_helpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FdavidB%2Fhandlebars_misc_helpers/lists"}