💾 Archived View for rawtext.club › ~hut › inlineswap.gmi captured on 2023-09-08 at 17:55:30. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-03-01)
-=-=-=-=-=-=-
Seems like every programmer on earth wrote a static HTML generator ;). So here's mine: inlineswap, which is currently used by the website of ranger.
What's special about it? The main idea is that it will look for commands in your HTML files and put the result of those commands right back into the HTML file. This would be an example of the "run" command:
<!-- run echo '# Hello World' | markdown --> <!-- /run -->
which will be substituted in-place to:
<!-- run echo '# Hello World' | markdown --> <h1>Hello World</h1> <!-- /run -->
As a result, the source file is also the output file, which is a nice property that I only found in inlineswap so far.
There's 2 more commands, documented => https://github.com/hut/inlineswap/blob/master/inlineswap in the comments of the executable file.
A real-life example is the changelog page of the ranger website. It contains the following commands:
changelog page of the ranger website
<!-- get head from index.html --> <!-- run markdown CHANGELOG | sed 's/h1>/h2>/g' --> <!-- get foot from index.html -->
The index.html defines the "head" and "foot" parts with simple `<!-- head -->` and `<!-- foot -->` comments.
Probably not. Learn something more useful.
More articles tagged with "ranger"
Written on 2021-06-04 by hut