{"id":23236910,"url":"https://github.com/cdrubin/pash-lua","last_synced_at":"2025-04-05T21:17:58.074Z","repository":{"id":68785194,"uuid":"74222724","full_name":"cdrubin/pash-lua","owner":"cdrubin","description":"templated text document manipulator - think generic tool that can also be a static site generator","archived":false,"fork":false,"pushed_at":"2024-01-28T19:03:56.000Z","size":1245,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-12T00:38:59.901Z","etag":null,"topics":["lua","static-site-generator","template"],"latest_commit_sha":null,"homepage":"","language":"Lua","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/cdrubin.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-11-19T17:07:12.000Z","updated_at":"2024-11-24T19:30:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"f81178b9-df15-4dd8-a7fe-2fd2e48b743e","html_url":"https://github.com/cdrubin/pash-lua","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdrubin%2Fpash-lua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdrubin%2Fpash-lua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdrubin%2Fpash-lua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdrubin%2Fpash-lua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdrubin","download_url":"https://codeload.github.com/cdrubin/pash-lua/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399896,"owners_count":20932881,"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":["lua","static-site-generator","template"],"created_at":"2024-12-19T04:13:07.143Z","updated_at":"2025-04-05T21:17:58.039Z","avatar_url":"https://github.com/cdrubin.png","language":"Lua","readme":"pash\n====\n\n*pash* is a text processor that allows lua to be executed in \nthe context of page generation. Developed as a static website \ngenerator that uses [templet](https://colberg.org/lua-templet) for templating.\n\n*pash* adds execution of `_context.pash` to the environment \nwhen processing the contents of a directory (and child directories inherit\nthe environment of their parents).\n\nFiles and directories that begin with `_` or `.` are ignored.\n\nShe understands two kinds of tags inside source files :\n\nCode\n----\nStarting a line with the **|** character indicates that what follows is lua code\n``` lua\n| for i = 1,5 do\n  \u003cbr /\u003e\n| end\n```\n  \nValue\n-----\nWhen the **${...}** is encountered in a source file the results of the code within elipses is inserted into the source \n``` lua\n| for i = 1,5 do %]\n  \u003cli\u003eItem ${ i }\u003c/li\u003e\n| end\n```\n    \nThere is one built-in function provided:\n\n``` lua\n  ${ include( '_snippet/menu.html' ) }\n```\n      \n*pash* could certainly process any filetype but we usually have her\nchew on HTML, CSS and JS template files.\n      \nA common need when using pash as a static site generator\nis the use of a _layout_ inside which to embed the\ncontent of a page. Specifying a layout can be done in a `_context.pash`\nfile so that all pages in that directory and any of its child directories \nuse a particular layout. Specifying the layout template can of course\nalso be done inside the page itself.\n      \n```lua\npage.layout = '_layout/site.html'\n```\n      \n**avoid** doing something like the following :\n```lua\npage = { layout = '_layout/site.html' }\n```\nbecause you will be clobbering the page table contents created elsewhere.\n      \nWhen specifying a layout the page is rendered to the variable `page.content`.\n      \nSo with a layout like this :\n      \n```\n_layouts/\n  site.html\n_snippets/\n  menu.html\n_context.pash\nindex.html\n```\n          \nwe could have :\n```\n--- _context.pash\npage.layout = '_layout/site.html'\n\n          \n--- _layout/site.html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003e${ page.title }\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n${ page.content }\n  \u003c/body\u003e\n\u003c/html\u003e\n              \n              \n--- index.html\n| page.title = 'The truth about Pashlicks'\n              \nPashlicks loves her sisters Josie and Marmite\n```\n              \nto produce an index.html file containing :\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eThe truth about Pashlicks\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n\nPashlicks loves her sisters Josie and Marmite\n  \u003c/body\u003e\n\u003c/html\u003e\n\n```\n\nEvery page has some *special* variables availabe in its environment:\n\n```lua\npage.file      -- filename of file being processed\npage.directory -- directory of the file being processed\npage.path      -- path to file from root of site\npage.level     -- level in the tree at which this page sits\n\nsite.tree      -- tree of site\n\npash           -- a lua table available for user data and functions\n```\n                \nCalling pash should be as simple as :\n\n```bash\n./pash.script \u003csrc\u003e \u003cdest\u003e\n```\n\nor use the [APE](https://justine.lol/ape.html) binary distribution thanks to [cosmopolitan libc](https://justine.lol/cosmopolitan/index.html):\n\n```\n./pash.com\n```\n(which happens to be a .zip file that contains the dependencies)\n\nTo create a new package:\n\n```bash\ncp lua.com.original pash.com\nzip pash.com main.lua inspect.lua templet.lua markdown.lua json.lua\n./pash.com\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdrubin%2Fpash-lua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdrubin%2Fpash-lua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdrubin%2Fpash-lua/lists"}