{"id":37751924,"url":"https://github.com/dongyx/shsub","last_synced_at":"2026-01-16T14:23:19.854Z","repository":{"id":143898904,"uuid":"486532083","full_name":"dongyx/shsub","owner":"dongyx","description":"Fast Template Engine for Shell","archived":false,"fork":false,"pushed_at":"2025-07-01T16:46:24.000Z","size":91,"stargazers_count":28,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-01T17:41:05.331Z","etag":null,"topics":["bash","c","formatter","linux","mini-language","posix-shell","preprocess","preprocessing","preprocessor","programming-language","shell","static-site-generation","static-site-generator","template-engine","template-language","templating","unix"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dongyx.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}},"created_at":"2022-04-28T09:39:00.000Z","updated_at":"2025-07-01T16:45:36.000Z","dependencies_parsed_at":"2025-07-05T12:16:01.696Z","dependency_job_id":null,"html_url":"https://github.com/dongyx/shsub","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/dongyx/shsub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dongyx%2Fshsub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dongyx%2Fshsub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dongyx%2Fshsub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dongyx%2Fshsub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dongyx","download_url":"https://codeload.github.com/dongyx/shsub/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dongyx%2Fshsub/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28479393,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"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":["bash","c","formatter","linux","mini-language","posix-shell","preprocess","preprocessing","preprocessor","programming-language","shell","static-site-generation","static-site-generator","template-engine","template-language","templating","unix"],"created_at":"2026-01-16T14:23:19.738Z","updated_at":"2026-01-16T14:23:19.848Z","avatar_url":"https://github.com/dongyx.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Shsub\n=====\n\nShsub is a fast template engine for Shell.\n\nThe following file `notes.tpl` demonstrates a simple template:\n\n\t\u003cul\u003e\n\t\u003c%for i in notes/*.md; do-%\u003e\n\t\u003c%\ttitle=\"$(grep '^# ' \"$i\" | head -n1)\"-%\u003e\n\t\t\u003cli\u003e\u003c%=\"$title\"%\u003e\u003c/li\u003e\n\t\u003c%done-%\u003e\n\t\u003c/ul\u003e\n\nThe following command prints a HTML list\nreporting titles of your Markdown notes.\n\n\t$ shsub notes.tpl\n\n**Key Features**\n\n- Fast: One-pass compiler written in C;\n- Low memory footprint: No dynamic allocation;\n- Light-weight: Standalone executable.\n\n**Table of Contents**\n\n- [Template Syntax](#template-syntax)\n- [Installation](#installation)\n- [Documentation](#documentation)\n- [Migrating from 1.x](#migrating-from-1x)\n- [Credits](#credits)\n\nTemplate Syntax\n---------------\n\n- Shell commands are surrounded by `\u003c%` and `%\u003e`\nand are compiled to the commands themselves;\n\n- Shell expressions are surrounded by `\u003c%=` and `%\u003e`\nand each `\u003c%=expr%\u003e` is compiled to `printf %s expr`;\n\n- Ordinary text is compiled to the commands printing that text;\n\n- Template comments are surrounded by `\u003c%!` and `%\u003e`\nand are ignored;\n\n- A template can include other templates by `\u003c%+filename%\u003e`;\n\n- If `-%\u003e` is used instead of `%\u003e`,\nthe following newline character will be ignored;\n\n- `\u003c%%` and `%%\u003e` are compiled to literal `\u003c%` and `%\u003e`.\n\nInstallation\n------------\n\nIt would be better to select a version from the\n[release page](https://github.com/dongyx/shsub/releases)\nthan downloading the working code,\nunless you understand the status of the working code.\nThe latest stable release is always recommended.\n\n\t$ make\n\t$ sudo make install\n\nBy default, Shsub is installed to `/usr/local`.\nYou could call `shsub --version` to check the installation.\n\nDocumentation\n-------------\n\nCalling Shsub with `--help` prints a brief of the command-line options.\nThe complete description is documented in the man page shipped with the installation.\n\nThe implementation is explained in the [paper](https://www.dyx.name/notes/shsub-impl.html).\nIf you attempt to contribute to this project, it may help.\n\nMigrating from 1.x\n------------------\n\nThe breaking changes since Shsub 2.0.0 are:\n\n- Shebang comments are no longer supported;\nIf an executable is required,\ncompile the template to a shell script using the `-c` option;\n\n- Expressions are no longer automatically quoted and escaped;\n\n- The `progname` environment variable is no longer set;\nIf the template needs to use `$0`,\ncompile it to a shell script using the `-c` option;\n\nTo make parallel installations of Shsub 1.x and the later version,\nuse the `name` installation variable:\n\n\tsudo make install name=shsub2\n\nThis will install with the name `shsub2`\ninstead of the default `shsub`.\nBoth the executable and the man page will use the specified name.\n\nCredits\n-------\n\nShsub was created by [DONG Yuxuan](https://www.dyx.name) in 2022.\n\nOther code contributors:\n\n- [Will Clardy](https://quexxon.net)\n\n[Chris Wellons (*skeeto*)](https://nullprogram.com) reviewed the code\nand gave useful advice.\n\nThe syntax of Shsub is inspired by\nJakub Jirutka's [ESH](https://github.com/jirutka/esh).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdongyx%2Fshsub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdongyx%2Fshsub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdongyx%2Fshsub/lists"}