{"id":16014924,"url":"https://github.com/thheller/zview","last_synced_at":"2025-04-05T03:13:25.534Z","repository":{"id":140238059,"uuid":"2475281","full_name":"thheller/zview","owner":"thheller","description":"zview - Erlang Template Engine (inspired by erlydtl, Django Templates, Liquid and others.)","archived":false,"fork":false,"pushed_at":"2012-01-18T23:22:44.000Z","size":171,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-10T11:13:59.712Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://github.com/thheller/zview","language":"Erlang","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/thheller.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}},"created_at":"2011-09-28T14:03:41.000Z","updated_at":"2013-10-01T23:35:07.000Z","dependencies_parsed_at":"2023-03-12T13:45:35.361Z","dependency_job_id":null,"html_url":"https://github.com/thheller/zview","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/thheller%2Fzview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thheller%2Fzview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thheller%2Fzview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thheller%2Fzview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thheller","download_url":"https://codeload.github.com/thheller/zview/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247280272,"owners_count":20912967,"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-10-08T15:05:32.969Z","updated_at":"2025-04-05T03:13:25.518Z","avatar_url":"https://github.com/thheller.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"zview - Introduction\n==============\n\nThis is zview, a Template Engine for Erlang (at least it will be sometime in the future).\n\nIts in early alpha and not recommended for use (half of the Stuff doesnt work yet).\n\nIt started out as a fork of erlydtl since I wanted to address some of the issue I had\nwith it. Turned out that changing those was way more work than expected and would have \nbroken most DTL Templates anyway, so I started from scratch, only reusing the\nerlydtl\\_scanner and erlydtl\\_parser, although those were modified too.\n\nI'll highlight the major differences later, first lets have a look:\n\n    \u003chtml\u003e\n      \u003chead\u003e\n        \u003ctitle\u003e{{ title | default: 'Default Page Title' }}\u003c/title\u003e\n      \u003c/head\u003e\n\n      \u003cbody\u003e\n\n        The usual for loop\n        \u003cul\u003e\n          {% for x in items %}\n            \u003cli\u003e{{ x }}\u003c/li\u003e\n          {% endfor %}\n        \u003c/ul\u003e\n\n        The usual if/else\n\n        {% if foo == 'bar' %}\n          bar\n        {% else %}\n          {{ foo }}\n        {% endif %}\n\n        Simple Tags\n        {% render \"other_template\" %}\n\n        Simple Block Tag, vars declared in Args are only available inside the do/end Block \n        {% with var1=\"test\" var2=some.nested.json.data.struct do %}\n          {{ var2 }}\n        {% end %}\n\n        Not defined, outputs nothing (instead of undefined like erlydtl)\n        {{ var1 }}\n\n        Custom Tags are defined by prefixing it with alias@\n        {% ext@simple_tag arg1=title %}\n\n        Custom Tags can have Blocks too\n        {% ext@custom_tag also=\"has args\" do %}\n          inside custom tag\n        {% end %}\n\n      \u003c/body\u003e\n    \u003c/html\u003e\n\nShould look familiar to anyone having used erlydtl, Django Templates or Liquid before.\n\nDocumentation\n-----\n\nTODO!!!\n\nDifferences in the Templates itself\n---\n\nMain Difference is that I wanted to be able to have the \nTemplate export Key/Value Pairs to the caller.\n\n    {% export meta=\"data\" some=var %}\n\n    {% export block do %}\n      \u003ch1\u003eSuper Duper Title\u003c/h1\u003e\n    {% end %}\n\n    {ok, Content, Exports} = zview:render(\"my_template.tpl\", [{var, \"test\"}]).\n\nExports will be a proplist containing [{meta, \"data\"}, {some, \"test\"}, {block, \"h1...\"}].\n\nI wanted this as a stricter alternative to View Inheritance. Templates are completely standalone\nand cannot have dependencies to the outside (other than the runtime, tags). You could still\nachieve the same as View Inheritance with a simple loop and some exports.\n \n    {% export layout=\"my_page_layout.html\" %}\n    {% export content do %}\n      Page Content\n    {% end %}\n\nCustom Block Tags:\n\n    {% ext@some_tag kw=\"args\" var=some.list do %}\n      tag content\n    {% end %}\n\nCustom Tags:\n\n    {% ext@some_tag with=\"args\" %}\n\nFilters may have multiple Args, and of course can be custom too:\n\n    {{ some_var | mod@some_filter: 'arg1', arg2, 'arg3' }}\n\nDifferences in the Runtime\n---\n\nWay too many to even start comparing them.\n\n\"Context\" Variables\n----\n\nThere are Variables that are only availble inside certains contexts/blocks. They are prefixed by \"$\".\n\n$loop\n---\n\nSame as forloop in DTL, Liquid and only available inside for loops, will raise an Error\nif called outside for loop.\n\n    {{ $loop.index }} Also has the common forloop attributes (index, index0, rindex, rindex0, first, last, length)\n\n$vars\n---\n\n{Key, Value} Pairs of all Vars given to the Template render fun. Mainly intended for debugging.\n    \n    {% for key, value in $vars %} \n      Key: {{ key }} Value: {{ value }}\n    {% endfor %}\n\n    \nProbably more I cant think of right now.\n\n\nThanks\n===\n\n- [erlydtl](https://github.com/evanmiller/erlydtl)\n  Without it I probably wouldnt even have started, never written a parser/compiler before so\n  it was a very valuable Reference. Also obviously Django Templates and Liquid for Inspiration.\n\n- [kvc](https://github.com/etrepum/kvc)\n  Used to do most Variable Lookups. Its awesome.\n\n\nLicense\n---\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthheller%2Fzview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthheller%2Fzview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthheller%2Fzview/lists"}