{"id":24649216,"url":"https://github.com/onepointert/cacao","last_synced_at":"2026-04-12T16:11:21.259Z","repository":{"id":228096602,"uuid":"773146322","full_name":"onepointerT/cacao","owner":"onepointerT","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-11T09:55:17.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-03T22:16:10.749Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/onepointerT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-03-16T21:51:29.000Z","updated_at":"2024-10-11T09:55:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"46ddd8f9-0a21-415f-9bcf-0e0feb987fb5","html_url":"https://github.com/onepointerT/cacao","commit_stats":null,"previous_names":["onepointert/cacao"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/onepointerT/cacao","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onepointerT%2Fcacao","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onepointerT%2Fcacao/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onepointerT%2Fcacao/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onepointerT%2Fcacao/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onepointerT","download_url":"https://codeload.github.com/onepointerT/cacao/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onepointerT%2Fcacao/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266111439,"owners_count":23877980,"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":"2025-01-25T17:16:21.976Z","updated_at":"2026-04-12T16:11:21.253Z","avatar_url":"https://github.com/onepointerT.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cacao\n### Concurrent Arbitrary Consent Artificial Objects\n#### v0.2.0\n\nThis small library is implemented to handle concurrent consent in arbitrary objects, operates on the alphabet with a simple syntax:\n\n````cacao\n* Outter top-level variables are surrounded by 1 to 3 hashtags with the following functionality:\n  * `###varname{}###` stores the variable content from this position until the occurence of the next and grabs everything of the regex inside the first braces to a variable or a delimiter in between into the environments variable's stack\n    * Inside of a second brace, the definition of storing, reading and creating variables can be done with cacao template variables inside an ECMA-Regex  surrounding with `###store_a_value_variable`, `##read_from_a_variable_and_insert_here` and `#create_a_variable_if_matching_tmpl{$regex_tmpl}`.\n  * `##varname{}{$cacao_script_regex}{$formatting_regex}##` defines a value at this position and stores it, according to an optional third brace with an ICase formatter terminated with `'|'` which then is followed by the variables given with `$varname`\n  * `#varname{}#` inserts the current value of varname from environment variables at this position and allows the formatter-brace (third brace once)\n* A second brace pair behind a variable definition then transforms the script and a third brace formats with the script \n  and cacao environment variables, e.g. `##varname{#body{}}_{#html_full{}}{}##\n  ` replaces `#body{}`\n  with the values from `cacao.env.html_full` on template substitution.\n````\n\nTo use the library, please import the index file\n\n````coffeescript\nimport 'cacao/index'\n````\n\nYou can use the python file `cacaodev.py` to compile the coffeescript files or simply run `npm run dev`.\n\n## Using\n\n#### Setup\n\nYou might want to have a look at `examples/`. You might for example define your html template like this:\n\n````js\nhtml_tmpl = Cacao.Environment.Template.fromFile 'cacao/examples/html.cacao'\nhtml_tmpl.readToEnv cacao.env\n````\n\nto setup the environment with one template only.\n\n#### Example 1\n\nTo get the content inside both html tags in the variable `cacao.env.body_html`, you can work like this\n\n````html\nhtml_text = \"\"\"\u003cdiv class=\"container\"\u003e\n    Some text\n    \u003c/div\u003e\"\"\"\n````\n````js\nhtml_tmpl.transform html_text, cacao.env\n````\n\nand you'll have the following variables in `cacao.env`:\n\n````js\ncacao.env.body_html == \"Some text\"\ncacao.env.starttag == \"div\"\ncacao.env.properties == \"\"\"class=\"container\"\"\"\"\n````\n\n#### Example 2\n\nIf using a programming or scripting language, it might be useful to know operands, tags and variables and transform them. In this example we'll see, how more dynamic [Jinja](https://jinja.palletsprojects.com/en/3.0.x/templates/) could work.\n\nTherefore there is a `Cacao.Transition` class, that can be used to make a fourier transformation or to determine variables\njust from there position in a string.\n\n````js\ncode_tmpl = Cacao.Transition.fromFile 'cacao/eamples/jinja_for.cacao'\ncode_tmpl.equiv.template_refactoring.readToEnv cacao.env\ncacao.env.jinja_text = code_tmpl.template_refactoring.tmpl_str\n````\n````jinja\n{% for elem in elements %}\n    #body_jinja{}\n{% endfor %}\n````\n````js\ncode_tmpl.transform jinja_text, cacao.env\n````\n\nshould then give the following variables in the environment\n\n````js\ncacao.env.operand == \"for\"\ncacao.env.what == \"elem in elements\"\ncacao.env.varnames == \"elem\"\ncacao.env.arrayname == \"elements\"\ncacao.env.body_jinja == \"#body_jinja{}\"\n````\n\nAs we can see, the next substitution would introduce everything from `cacao.env.body_jinja` variable into the templates's string, so we could to some magic for dynamic loops.\n\n````js\ncacao.env.html_full = \"\"\"\u003c#{cacao.env.starttag} #{cacao.env.properties}\u003e#body_jinja{}\u003c/#{cacao.env.starttag}\u003e\"\"\"\ncacao.env.body_jinja = \"#{cacao.env.hmtl_full}\"\ncode_tmpl.transform jinja_text, cacao.env\n````\n\nwould then give a html container per loop iteration in jinja and insert everything from jinja inside.\n\nMode and not -- more advanced examples and tests might follow.\n\n## Copyright\n\n````\nCopyright 2024 Sebastian Lau \u003csebastianlau995@gmail.com\u003e\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.`\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonepointert%2Fcacao","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonepointert%2Fcacao","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonepointert%2Fcacao/lists"}