https://github.com/markusfisch/simsalabash
Hypertext mechanics in Bash
https://github.com/markusfisch/simsalabash
bash shell static-site-generator
Last synced: 4 months ago
JSON representation
Hypertext mechanics in Bash
- Host: GitHub
- URL: https://github.com/markusfisch/simsalabash
- Owner: markusfisch
- License: unlicense
- Created: 2011-11-25T21:39:39.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2021-04-04T15:42:32.000Z (over 4 years ago)
- Last Synced: 2023-03-11T13:38:08.005Z (over 2 years ago)
- Topics: bash, shell, static-site-generator
- Language: Shell
- Homepage:
- Size: 48.8 KB
- Stars: 12
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Hypertext mechanics in Bash
===========================For command line nerds. With love.
A sample is worth a thousand words:
$ mkdir contents htdocs layouts
$ echo 'Hello World
' > contents/Hello-World
$ echo '`content`' > layouts/contents.html
$ simsalabash
$ firefox htdocs/index.htmlFind more reasonable examples in examples/.
How does it work?
-----------------For every file in contents/, the corresponding layout will get expanded into
htdocs/ where the output is stored under the name of the content file with
the extension of the layout file.Layouts correspond to content files, when their name (without extension) does
match a component of the (relative) path of the content file. Matching starts
from the rear end with the file name.In your content and/or layout files you may use shell expansions like
$(command)
or
$((expression))
or
Hi, this is $USER talking.
to combine your website.
simsalabash does provide the following handy commands:
title - prints the title which is the formatted file name
of the content file in processusage: title
nav - prints a recursive standard list navigation
usage: [(UNFOLD|FLAT)=1] nav [PATH]
PATH - content path (optional, defaults to content/)
UNFOLD - unfold navigation, this will make a sitemap
FLAT - do not dive into subdirectoriescontent - prints the content of file in process
usage: content
include - include (and expand) another content/layout file
usage: include FILE...
FILE - path and name of file to include
Apart from that, you're free to invoke any command you like. For
example, you may do something like this:$FILE was written by $(whoami)
$FILE holds the path and name of the content file in process.
How to extend simsalabash?
--------------------------There are two places for additional source files:
$HOME/.simsalabash/
$PWD/lib/Use the first location for general extensions you want to have always.
Use the latter for project specific extensions and modifications.You can override existing functions to extend simsalabash or add
new ones to add further functionality.How to use Markdown?
--------------------Download Markdown.pl from
http://daringfireball.net/projects/markdown/
and put it into your path. Then paste this
content()
{
include "$FILE" | Markdown.pl
}into a file in $HOME/.simsalabash/ to override and extend the default
function.Purpose
-------simsalabash aims to be a simple tool to combine a website from a bunch
of text files and generate a recursive standard list navigation for it.It was designed to minify the effort to build and maintain small static
websites and targets the experienced Bash user.But simsalabash is not a Jack of all Trades. Please check out the advantages
and disadvantages:Advantages and principles
-------------------------* Little to no configuration.
* Meaningful structure of content/ which mirrors your web site.
* Automatically generates a recursive standard list navigation.
* Easy sorting of navigation items with .nav files.
* The output directory is not temporary so assets and downloads won't
get copied everytime you're doing an rsync.
* No dependencies beyond Bash, cat, mktemp, rm and probably tr (Bash < 4).Disadvantages and limitations
-----------------------------* Markdown and things like that are external.
* There's no integrated web server and never will be.
* Bash is slow (but fast enough for any web site of reasonable size).
* Bash is not object-oriented, nor easy, nor hip.Alternatives
------------Find a comprehensive list at [staticsitegenerators.net](http://staticsitegenerators.net/).