💾 Archived View for gemini.strahinja.org › slweb captured on 2023-01-29 at 02:30:09. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-03-01)

➡️ Next capture (2023-03-20)

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

        oooo                      oooo   
         ,88                       ,88   
 ,oooo.  o8' oooo  oo o.   ,ooo.   o88o. 
 o8( )p ,88   `88  88 `8  ,88",8  ,88"`8o
 `o8o.  88'    88 ,88 ,8  88ooo^  88'  )8
d( )8o  o8. .  88o"88,o"  88' .   o8. ,8"
`8oo8'  `ooo^  `8" `8"    `8oo^   `ooo8" 

slweb

slweb is a static website generator which aims at being simplistic. It transforms custom Markdown-like syntax into HTML.

Q&A

Q: Is this suckless?

A: No. SGML, and by extension, HTML, isn't suckless.

Q: Why do you call it "simple" then?

A: Because one is not the synonym for the other.

Q: Why not make a website generator as a shell script?

A: slweb was a shell script in its conception (check its history of commits in git). However, I wanted to implement Markdown links with link ids [like][this]. This requires multiple passes by the parser and is better implemented as a full-blown program in C anyway. The other reason was that sed and awk have limits, which some of my pages hit.

[this]: https://some.site

Q: My static website generator is "truly simple", this is not simple!

A: Good for you. By the way, that is a statement and not a question.

Prerequisites

Optional dependencies

KaTeX

ImageMagick

Install

$ git clone https://git.sr.ht/~strahinja/slweb
$ cd slweb
$ su

Then, if you have apenwarr/redo:

apenwarr/redo

# redo install

if you don't:

# ./do install

You can specify any compiler which uses (or tolerates) -Wall, -std=c99, -c, -g and -o like GNU C, most notably tcc(1), by setting the SLWEB_CC environment variable. For example:

$ SLWEB_CC=tcc redo -j10

In the case of tcc, the tradeoff is that the debug information is limited compared to gcc, but the compilation time is significantly shorter.

Install (Arch)

$ <aur_helper> -S slweb

Examples

See the examples/ directory in this repository.

examples/

Given the file index.slw in the current directory:

---
site-name: Test website
site-desc: My first website in slweb
---

{main}
# Hello world

This is an _example_ of a statically generated HTML.

{/main}

after using the command:

$ slweb index.slw > index.html

file `index.html` contains:

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Test website</title>
    <meta charset="utf8" />
    <meta name="description" content="My first website in slweb" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="generator" content="slweb" />
</head>
<body>

<main>
<h1>Hello world</h1>

<p>This is an <em>example</em> of a statically generated HTML.</p>

</main>
</body>
</html>

TODO (checklist)

See the file TODO for more information.

TODO

Bugs and limitations

Bugs can be reported using the slweb ticket tracker.

slweb ticket tracker

See the manpage (man slweb) after installing slweb for more information.

License

slweb - Simple static website generator.

Copyright (C) 2020, 2021, 2022 Страхиња Радић

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

https://www.gnu.org/licenses/