{"id":21270645,"url":"https://github.com/timstr/baumkuchen","last_synced_at":"2025-03-15T12:12:18.686Z","repository":{"id":235741736,"uuid":"770190475","full_name":"timstr/baumkuchen","owner":"timstr","description":"simple static HTML site generator with XHTML syntax and reusable components","archived":false,"fork":false,"pushed_at":"2024-08-13T03:42:27.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T02:31:19.024Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timstr.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":"2024-03-11T05:21:43.000Z","updated_at":"2024-08-13T03:42:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"0863322d-ee81-4c90-bb8d-21445431c44e","html_url":"https://github.com/timstr/baumkuchen","commit_stats":null,"previous_names":["timstr/baumkuchen"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timstr%2Fbaumkuchen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timstr%2Fbaumkuchen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timstr%2Fbaumkuchen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timstr%2Fbaumkuchen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timstr","download_url":"https://codeload.github.com/timstr/baumkuchen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243725636,"owners_count":20337670,"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-21T08:18:09.809Z","updated_at":"2025-03-15T12:12:18.659Z","avatar_url":"https://github.com/timstr.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# baumkuchen\n\nA simple and minimalist static HTML site generator. Use it when all you really need is to copy and paste some HTML around.\n\n## Basic Usage\n\n1. Start with ordinary HTML pages, either written from scratch or taken from an existing HTML website.\n2. Identify repeated structure and extract it into a separate html file, defining a new element\n3. Use the new element in your HTML pages as a shorthand\n4. Run baumkuchen to substitute and expand elements, producing a complete HTML site.\n\n## Example\n\nSuppose we have a page like this:\n\n```html\n\u003chtml\u003e\n    \u003cbody\u003e\n        \u003cdiv class=\"icon-grid\"\u003e\n            \u003cdiv class=\"icon-row\"\u003e\n                \u003cdiv class=\"icon-outer\"\u003e\n                    \u003cimg src=\"a.png\" /\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"icon-outer\"\u003e\n                    \u003cimg src=\"b.png\" /\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"icon-outer\"\u003e\n                    \u003cimg src=\"c.png\" /\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n            \u003cdiv class=\"icon-row\"\u003e\n                \u003cdiv class=\"icon-outer\"\u003e\n                    \u003cimg src=\"d.png\" /\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"icon-outer\"\u003e\n                    \u003cimg src=\"e.png\" /\u003e\n                \u003c/div\u003e\n                \u003cdiv class=\"icon-outer\"\u003e\n                    \u003cimg src=\"f.png\" /\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n\nThere's already a ton of repetition in this basic example. Let's first carve out the `\u003cdiv class=\"icon-outer\"\u003e` and its contents. To do that, let's create a file `elements/myicon.html` with the following:\n\n```html\n\u003cdiv class=\"icon-outer\"\u003e\n    \u003cimg src=\"${self.src}\" /\u003e\n\u003c/div\u003e\n```\n\nThis defines a new element called `myicon` which takes a `src` attribute. This lets us simplify the above page into:\n\n```html\n\u003chtml\u003e\n    \u003cbody\u003e\n        \u003cdiv class=\"icon-grid\"\u003e\n            \u003cdiv class=\"icon-row\"\u003e\n                \u003cmyicon src=\"a.png\" /\u003e\n                \u003cmyicon src=\"b.png\" /\u003e\n                \u003cmyicon src=\"c.png\" /\u003e\n            \u003c/div\u003e\n            \u003cdiv class=\"icon-row\"\u003e\n                \u003cmyicon src=\"d.png\" /\u003e\n                \u003cmyicon src=\"e.png\" /\u003e\n                \u003cmyicon src=\"f.png\" /\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n\nWe could keep going if we like. For example, given `elements/myicongrid.html`:\n\n```html\n\u003cdiv class=\"icon-grid\"\u003e\n    \u003cself.inner /\u003e\n\u003c/div\u003e\n```\n\nand `elements/myiconrow.html`:\n\n```html\n\u003cdiv class=\"icon-row\"\u003e\n    \u003cforeachchild.x\u003e\n        \u003cx /\u003e\n    \u003c/foreachchild.x\u003e\n\u003c/div\u003e\n```\n\nThe page now can be reduced to\n\n```html\n\u003chtml\u003e\n    \u003cbody\u003e\n        \u003cmyicongrid\u003e\n            \u003cmyiconrow\u003e\n                \u003cmyicon src=\"a.png\" /\u003e\n                \u003cmyicon src=\"b.png\" /\u003e\n                \u003cmyicon src=\"c.png\" /\u003e\n            \u003c/myiconrow\u003e\n            \u003cmyiconrow\u003e\n                \u003cmyicon src=\"d.png\" /\u003e\n                \u003cmyicon src=\"e.png\" /\u003e\n                \u003cmyicon src=\"f.png\" /\u003e\n            \u003c/myiconrow\u003e\n        \u003c/myicongrid\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n\nWe run baumkuchen by passing it the path to the shorthand HTML pages, elements, and output directory, respectively.\n\n```plaintext\n\u003e baumkuchen path/to/pages/ elements/ output/\n```\n\nAfterwards, `output/` here contains all files (not just html) copied from the input directory, with any HTML files expanded according to the provided element library.\n\nA few other utilities exist currently such as `\u003cif\u003e` elements:\n\n```html\n\u003cif self.filepath=\"/artwork/.*\"\u003e\n    \u003cthen\u003e\n        \u003cartworktabmenu /\u003e\n    \u003c/then\u003e\n\u003c/if\u003e\n```\n\nand maybe a couple others as I create them.\n\n## Caveats\n\n-   This library is new and experimental\n-   This is all the documentation that exists so far\n-   Yes, this is an abuse of notation.\n-   Efforts have been made to keep the syntax friendly for HTML text editors, but yours may not like the non-standard tag names\n-   Baumkuchen is not aware of what tags mean in any way. It just substitutes and expands the ones with names matching elmement files.\n\n## About the name\n\n[Baumkuchen](https://en.wikipedia.org/wiki/Baumkuchen) is German (like me) for a type of layer cake. It literally means \"tree cake\". Here, \"tree\" is a nod to the DOM tree, and \"cake\" as in baking, as in we're baking a static website from a higher-level authoring format.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimstr%2Fbaumkuchen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimstr%2Fbaumkuchen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimstr%2Fbaumkuchen/lists"}