{"id":20342347,"url":"https://github.com/spacether/mustache_to_handlebars","last_synced_at":"2025-10-26T23:06:08.548Z","repository":{"id":45137365,"uuid":"413487139","full_name":"spacether/mustache_to_handlebars","owner":"spacether","description":"A python tool to convert mustache templates to handlebars","archived":false,"fork":false,"pushed_at":"2022-01-05T21:26:42.000Z","size":58,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-14T19:11:48.491Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/spacether.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["spacether"]}},"created_at":"2021-10-04T15:47:41.000Z","updated_at":"2022-07-30T18:02:09.000Z","dependencies_parsed_at":"2022-08-26T08:23:24.717Z","dependency_job_id":null,"html_url":"https://github.com/spacether/mustache_to_handlebars","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/spacether%2Fmustache_to_handlebars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacether%2Fmustache_to_handlebars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacether%2Fmustache_to_handlebars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacether%2Fmustache_to_handlebars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spacether","download_url":"https://codeload.github.com/spacether/mustache_to_handlebars/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241869568,"owners_count":20034090,"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-11-14T21:33:10.638Z","updated_at":"2025-10-26T23:06:03.527Z","avatar_url":"https://github.com/spacether.png","language":"Python","funding_links":["https://github.com/sponsors/spacether"],"categories":[],"sub_categories":[],"readme":"# mustache_to_handlebars\nA python tool to convert mustache templates to handlebars\n\nThis assumes that the specific implementations are:\n- mustache: (Java) artifactId=jmustache https://github.com/samskivert/jmustache\n- handlebars: (Java) artifactId=handlebars https://github.com/jknack/handlebars.java\n\n### Features\nHandles conversion for if/unless first + last\n- {{#-first}} -\u003e {{#if @first}}\n- {{#-last}} -\u003e {{#if @last}}\n- {{^-first}} -\u003e {{#unless @first}}\n- {{^-last}} -\u003e {{#unless @last}}\n- {{/-first}} -\u003e {{\\if}} OR {{\\unless}}\n- {{/-last}} -\u003e {{\\if}} OR {{\\unless}}\n\nTags that begin with # are ambiguous when going from mustache to handlebars because\nin mustache, # handles, truthy input, array input, and object context input.\nSo in handlebars, a mustache #someTag can be #if someTag, #each someTag, or #with someTag\n- this tool prints out those ambiguous tags so the user can decide which usage it should be\n- one can assign those tags to the if/each/with use cases with the command line arguments\n  - -handlebars_if_tags\n  - -handlebars_each_tags\n  - -handlebars_with_tags\n\nReplaces array index tags\n- {{myArray.0}} -\u003e {{myArray.[0]}}\n- {{{myArray.0}}} -\u003e {{{myArray.[0]}}}\n- {{#myArray.0}} -\u003e {{#if myArray.[0]}} if you define myArray[0] as a handlebars_if_tag\n\nFeatures that have not yet been implemented:\n- replacing {{.}} or {{{.}}} references with the enclosing tag variable\n\n## Usage\nClone this repo\n```\n# make the virtual env\npython3 -m venv venv\n# activate it\nvenv bin/activate\n# install the tool into it\nmake install\n```\nInvocations:\n```\nusage: mustache_to_handlebars [-h] [-out_dir OUT_DIR] [-handlebars_if_tags HANDLEBARS_IF_TAGS] [-handlebars_each_tags HANDLEBARS_EACH_TAGS]\n                              [-handlebars_with_tags HANDLEBARS_WITH_TAGS] [-remove_whitespace_before_open] [-remove_whitespace_after_open]\n                              [-remove_whitespace_before_close] [-remove_whitespace_after_close] [-only_in_dir] [-delete_in_files]\n                              in_dir\n\nconvert templates from mustache to handebars\n\npositional arguments:\n  in_dir                the folder containing your mustache templates\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -out_dir OUT_DIR      the folder to write the handlebars templates to. if unset in_dir will be used\n  -handlebars_if_tags HANDLEBARS_IF_TAGS\n                        a list of tags passed in a space delimited string like 'someTag anotherTag'\n  -handlebars_each_tags HANDLEBARS_EACH_TAGS\n                        a list of tags passed in a space delimited string like 'someTag anotherTag'\n  -handlebars_with_tags HANDLEBARS_WITH_TAGS\n                        a list of tags passed in a space delimited string like 'someTag anotherTag'\n  -remove_whitespace_before_open\n  -remove_whitespace_after_open\n  -remove_whitespace_before_close\n  -remove_whitespace_after_close\n  -only_in_dir          the program recurses through descendant directories by default, to only search in_dir, set this parameter\n  -delete_in_files      if passed, the mustache template files will be deleted\n```\n\n## testing\nInstall pytest in your virtual environment and then run make test","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacether%2Fmustache_to_handlebars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspacether%2Fmustache_to_handlebars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacether%2Fmustache_to_handlebars/lists"}