From 924746b8ab4904d24a3cb242b95e8b91f0970129 Mon Sep 17 00:00:00 2001 From: Thomas Ulmer Date: Tue, 2 Jun 2026 17:19:14 -0700 Subject: initial (functional?) version --- .gitignore | 6 ++ CHANGELOG.md | 5 ++ LICENSE | 20 +++++ README.md | 44 ++++++++++ loom.cabal | 30 +++++++ src/Main.hs | 257 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 362 insertions(+) create mode 100644 .gitignore create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 loom.cabal create mode 100644 src/Main.hs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3d60893 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +TAGS +*~ +test/* +testout/* +testbak/* +dist-newstyle \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d191c95 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for loom + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a379953 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2026 Thomas Ulmer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..89e3781 --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +# Loom - Minimal site "generator" +Loom is a single file haskell program that generates a static html site from a given set of framgents. It is heavily inspired by (node)[https://git.sr.ht/~tagglink/node]. + +## Building Loom +Loom requires a Haskell2010 compiler and the following packages: +- text +- filepath +- directory + +GHC should work if it's decently recent. MHS likely is also workable but untested. + +## Using Loom +Simply make a directory of html fragments such as: +``` +testbak/ +├── a.html +├── b +│   ├── c.frag +│   ├── d +│   │   ├── e.html +│   │   └── index.html +│   └── index.html +└── index.html +``` +where `.frag` and `.html` are equivalent, and invoke loom: +``` +loom -r {root path} -o {output path} [-s {static path}] +``` + +Each fragment will generate a html page in the output directory in the same structure. The generated page will be composed of a header and footer with the text of the fragment placed in `
`. The header also conatins the title of the page, which can be specified by placing a line +``` + +``` +on the first line of the fragment file. The title cannot contain newlines or the vertical bar character. If unspecified it will default to the basename of the fragment file. + +The header will also include a `