{"id":18400580,"url":"https://github.com/andis-sprinkis/tparts","last_synced_at":"2026-02-07T14:32:22.444Z","repository":{"id":41435949,"uuid":"508079217","full_name":"andis-sprinkis/tparts","owner":"andis-sprinkis","description":"A static website generator script written in GAWK","archived":false,"fork":false,"pushed_at":"2026-02-04T13:51:05.000Z","size":597,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-05T00:55:32.592Z","etag":null,"topics":["awk","gawk","static-site-generator","website-generator"],"latest_commit_sha":null,"homepage":"","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andis-sprinkis.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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-06-27T22:26:33.000Z","updated_at":"2026-02-04T13:52:08.000Z","dependencies_parsed_at":"2023-02-18T15:15:30.221Z","dependency_job_id":"3fdadec4-0a67-4b4b-b2f7-b3a47e909420","html_url":"https://github.com/andis-sprinkis/tparts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andis-sprinkis/tparts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andis-sprinkis%2Ftparts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andis-sprinkis%2Ftparts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andis-sprinkis%2Ftparts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andis-sprinkis%2Ftparts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andis-sprinkis","download_url":"https://codeload.github.com/andis-sprinkis/tparts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andis-sprinkis%2Ftparts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29197022,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T12:38:28.597Z","status":"ssl_error","status_checked_at":"2026-02-07T12:38:23.888Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["awk","gawk","static-site-generator","website-generator"],"created_at":"2024-11-06T02:34:58.451Z","updated_at":"2026-02-07T14:32:22.438Z","avatar_url":"https://github.com/andis-sprinkis.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `tparts`\n\nA static website generator script.\n\nRequires GNU `awk` in a typical \\*nix shell environment.\n\n## The example website\n\nTo build the example website project (hosted [on github.io](https://andis-sprinkis.github.io/tparts/), [on gitlab.io](https://andis-sprinkis.gitlab.io/tparts)) from source files found in `./site` into the output directory `./dist`, run:\n\n```sh\ntparts ./site ./dist\n```\n\nOr run the `build` script:\n\n```sh\n./build\n```\n\nYou can use an HTTP Web server, such as [`serve`](https://www.npmjs.com/package/serve), to preview the site locally:\n\n```sh\nserve ./dist\n```\n\n## Goals and non-goals\n\n-   Goals\n    1. Generates static web documents, handling the repetative parts.\n    1. A boilerplate for low-maintenance websites.\n    1. No external dependencies I need to worry about or maintain.\n    1. Remains as rudamentary and concise as possible.\n    1. The example web site project has a good UI accessibility.\n    1. Works _forever_, as I don't expect the GNU AWK to change a lot.\n-   Non-goals\n    1. Separating the content from the document structure or presentation (e.g. a Markdown parser).\n    1. A complex to develop and maintain document templating language (something comparable to Pug or Handlebars).\n\n## How the script works\n\nThe tparts script is for building a set of plain text files – the documents, in their target directories, from reusable, hierarchical parts – the template value files, with their file names prefixed by `_inline_`, `_block_`, `_pre_`.\n\nIn the example website project it means creating the HTML documents and the metadata files, like `manifest.webmanifest`, `robots.txt`, `sitemap.xml`, from the globally scoped and the document specific values in the available template value files, prefixed with `_`. Also copying the static assets files, like style-sheets and images, to their respective document directories.\n\nIn value files, the template value placeholders to be subsituted are the other value file names wrapped in the HTML comment syntax, e.g. the `\u003c-- _inline_lastmod --\u003e` is subsituted in place with contents of the file `_inline_lastmod`. The substitution is iterative, filling in the documents, exhausiting the names of known value files.\n\nTemplate value file name prefixes determine value placeholder substitution type – how the value file text content will be inserted in the output:\n\n-   `_inline_` – to be inserted inline\n\n    (The configuration values, which don't get directly inserted into the documents also use this prefix.)\n\n-   `_block_` – to be inserted as a block of one or multiple new lines\n-   `_pre_` – to be inserted as preformatted text (HTML `\u003cpre\u003e`)\n\nTemplate value files values can be defined in a hierarchy of scopes, e.g. in the example project, where we get 2 scopes, the value files under paths\n\n1.  `./site/*` are the project scope values\n1.  `./site/(documents|sitemap)/\u003cdocument label\u003e/*` are the document local scope values, where the document local scope value files overwrite the above project scope values\n\nSome notable value files and their contents:\n\n-   `_inline_build_entrypoint` – the name of the root level template value file for a document.\n-   `_inline_path` – the document nested directory path in the project build.\n-   `_inline_filename` – the filename of a document in the project build.\n-   `_inline_lastmod` – the document last modified date, used in the example site sitemap entries.\n-   `_inline_static_asset_caching_id` – build-time generated ID string, used in the example site document static asset URLs for cache busting.\n-   `_inline_sitemap_skip` – boolean property value (`0` or `1`) for omitting documents from being added to `sitemap.xml`.\n\n### Runtime data structures\n\nThis section describes how the tparts script indexes the value files in memory during building the project.\n\n#### Template values files index\n\nDeclared as variable `_values_files_index`\n\nIndex of the all known template values files, grouped by their scope directory and indexed by file path.\n\n```\n_values_files_index: [\n  \u003cDocument template value file directory path\u003e: [\n    \u003cDocument template value name\u003e: [\n      path: \u003cTemplate value file path\u003e\n      type: \u003cSubstitution type (_inline_, _block_ or _pre_)\u003e\n      value: \u003cContent of the template value\u003e\n    ]\n    ..\n  ]\n  ..\n]\n```\n\ne.g.\n\n```\n_values_files_index: [\n  /home/user/tparts/site/documents/404: [\n    _inline_title: [\n      path: /home/user/tparts/site/documents/404/_inline_title\n      type: _inline_\n      value: Not found\n    ]\n    ..\n  ]\n  /home/user/tparts/site: [\n    _block_document.html: [\n      path: /home/user/tparts/site/_block_document.html\n      type: _block_\n      value: \u003c!DOCTYPE html\u003e\n               \u003chtml lang=\"\u003c!-- _inline_lang --\u003e\"\u003e\n               \u003chead\u003e\n             ..\n    ]\n    ..\n  ]\n  ..\n]\n```\n\n#### Document level resolved value indices\n\nDeclared as variables `_generic_documents`, `_sitemap_entry`, `_sitemap`\n\nWhile the previously mentioned `_values_files_index` is a flat list caching all template values, the values are subsequently written in the document-level values indices, resolved according their document scopes hierarchy.\n\nSo, when building a document level values index, the values defined on the very document scope, for example the value `./site/documents/index/_inline_title`, take precedence over defined corresponding project scope values, such as `./site/_inline_title`.\n\nDocument level resolved values indices data structure:\n\n```\n\u003cEnumerated list of documents\u003e: [\n  \u003cIndex integer\u003e: [\n    path_src: \u003cDocument source directory path\u003e\n    paths_values_dir \u003cList of value directories paths,\n     in order of project to document scope\u003e: [\n      \u003cIndex integer\u003e: \u003cTemplate value directory path\u003e\n      ..\n    ]\n    values_index \u003cList of scope-resolved values for the document\u003e: [\n      \u003cTemplate value name\u003e: [\n        path: \u003cTemplate value file path\u003e\n        type: \u003cSubstitution type (_inline_, _block_ or _pre_)\u003e\n        value: \u003cContent of template value\u003e\n      ]\n      ..\n    ]\n    ..\n  ]\n]\n```\n\ne.g.\n\n```\n_generic_documents: [\n  1: [\n    path_src: /home/user/tparts/site/documents/index\n    paths_values_dir: [\n      /home/user/project/tparts/site\n      /home/user/project/tparts/site/documents/index\n    ]\n    values_index: [\n      _inline_domain: [\n        path: /home/user/project/tparts/site/_inline_domain\n        type: _inline\n        value: example.com\n      ]\n      _inline_title: [\n        path: /home/user/project/tparts/site/documents/index/_inline_title\n        type: _inline\n        value: Index page\n      ]\n      _block_layout_index_children.html: [\n        path: /home/user/project/tparts/site/documents/index/_block_layout_index_children.html\n        type: _block\n        value: \u003csection\u003e\n                 \u003ch1\u003eExample index page\u003c/h1\u003e\n               ..\n      ]\n      ..\n    ]\n  ]\n  ..\n]\n```\n\n---\n\nThis software is licensed under the GNU General Public License Version 3.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandis-sprinkis%2Ftparts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandis-sprinkis%2Ftparts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandis-sprinkis%2Ftparts/lists"}