💾 Archived View for rawtext.club › ~hut › inlineswap.gmi captured on 2023-12-28 at 16:49:46. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-03-01)

-=-=-=-=-=-=-

Inlineswap

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.

website of ranger

inlineswap

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.

Other commands

There's 2 more commands, documented => https://github.com/hut/inlineswap/blob/master/inlineswap in the comments of the executable file.

Real-life example

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.

index.html

Should I use it?

Probably not. Learn something more useful.

Navigation panel

Blog

About

Projects

RSS Feed

More articles tagged with "ranger"

Written on 2021-06-04 by hut