feat(gemini): write the site as a Gemini capsule
`motorino gemini [-site DIR] [-out DIR] [-lang CODE] [-drafts]` turns the pages and the news into gemtext with the new gemtext package. - the language served by default sits at the root (-lang, then gemini_language in site.json, then the default language) and the others under /<code>/ - the news exist once, under /news/: index, posts, categories, archives and a gemlog style feed (news/feed.gmi, a date before each title) - every page ends with the navigation of its language, the language links and, on translations, the machine translation note - .meta for Agate (--central-conf): two lines per language other than the root one and two for the news when they are in another language, never linked - addresses are mapped to the capsule, a fragment is dropped, a missing target stops the build, assets are copied only when a page points to them, gemini_web_paths keeps paths served by other means as links to the website - blocks of generated lists become gemtext with the strings of the language file - the block replacement of a page is shared with the HTML build Refs #10
This commit is contained in:
parent
28745d452f
commit
2f169b8d9f
1 changed files with 1282 additions and 21 deletions
14
README.md
14
README.md
|
|
@ -1,6 +1,6 @@
|
|||
# motorino
|
||||
|
||||
The static site generator of [kmalloc.org](https://kmalloc.org/). It turns Markdown pages, news, templates and language files into plain HTML with no JavaScript. It is made for that one site and is not a general-purpose generator.
|
||||
The static site generator of [kmalloc.org](https://kmalloc.org/). It turns Markdown pages, news, templates and language files into plain HTML with no JavaScript, and into a Gemini capsule. It is made for that one site and is not a general-purpose generator.
|
||||
|
||||
Licence: GPL-3.0-or-later, see `LICENSE`.
|
||||
|
||||
|
|
@ -9,6 +9,8 @@ Licence: GPL-3.0-or-later, see `LICENSE`.
|
|||
```
|
||||
motorino build -site DIR -out DIR build the site in DIR into the output folder (defaults: . and public)
|
||||
motorino build -drafts ... the same, with the drafts and the posts dated in the future, for a preview
|
||||
motorino gemini -site DIR -out DIR write the same site as gemtext, for a Gemini server (defaults: . and capsule)
|
||||
motorino gemini -lang CODE ... the language at the root of the capsule; -drafts works as for build
|
||||
motorino new -site DIR "A title" write news/a-title.md, a draft with the header ready, and print its path
|
||||
motorino version print the version
|
||||
```
|
||||
|
|
@ -77,6 +79,16 @@ Pages: `Title`, `ID` (the same in every language, it links the translations), `D
|
|||
|
||||
`{{name}}`, with lowercase letters, digits and underscores, is replaced by a string from `site.json` or the language file. An unknown placeholder stops the build and names the file. Fenced code blocks (found the way CommonMark finds them, in lists and quotes too) are left as written, so an article can show a placeholder there. Anywhere else a backslash before the placeholder (`\{{name}}`) keeps it as written, in a code span too; two backslashes are one literal backslash followed by the value. Code spans are otherwise substituted, which is how a page shows a value in monospace. The id of a heading is not checked against ids that a template writes itself, such as the `news` of the latest news block. `{{news_list}}`, `{{latest_news}}` and `{{categories_list}}` stand alone in a paragraph and expand to generated lists.
|
||||
|
||||
## Gemini
|
||||
|
||||
`motorino gemini` reads the same site and writes gemtext: the pages of each language, the news once and a `.meta` file for the server. It does not read the templates, the style or the layouts: a page is its title, its text and a few navigation links.
|
||||
|
||||
- **Language at the root.** The language served by default sits at the root and the others under `/<code>/`, the default language of the site included. It is set with `-lang`, else `gemini_language` in `site.json`, else the default language of the site. The server must be started with the same default (Agate: `--lang`). It must be a language that has a home page.
|
||||
- **`.meta`.** The server reads the language of each document from `<out>/.meta`, which it never serves and no page links to. For every language other than the root one there are two lines, `en/*:;lang=en` and `en/**/*:;lang=en`, because a `*` does not cross folders, and the same two lines for `news/` when the news are not in the root language. It is for Agate run with `--central-conf`. A post that names another `Language` than the news is not given its own line.
|
||||
- **News.** They exist once, under `/news/`, as in the website: the index, the posts, the categories, the archives and `news/feed.gmi`, a list of `=> /news/2026/11/post.gmi 2026-11-14 Title` lines, newest first, which feed readers subscribe to. Every page ends with the navigation of its language, which has the news. `{{news_blog}}` lists all the posts, without pages of ten.
|
||||
- **Conversion.** A heading is a heading (three levels), a paragraph is a line, the links of a paragraph, list, quote or table follow it on lines of their own, a list is bullets (a list of only links is link lines), a quote or a note is a quote, code is a preformatted block, a table is a preformatted block of aligned columns, an image with an alt text is a link line, and emphasis is dropped. A page has one first level heading: its title; a first heading that says the title is dropped and the others go one level down. The blocks (`{{news_list}}`, `{{latest_news}}` and the others) become generated lines, with the texts of the language file.
|
||||
- **Addresses.** An address of the site becomes the address of its page in the capsule (`/people.html` is `/en/people.gmi`), and a fragment is dropped. A file listed in `assets` is copied when a page points to it, and only then. `http`, `https`, `mailto`, `gemini`, `xmpp`, `irc`, `ircs`, `matrix`, `bitcoin`, `magnet`, `tel` and `sms` links stay as they are. A path the website serves by other means (`/~squid/`) becomes a link to the website when it starts with one of the comma separated prefixes of `gemini_web_paths` in `site.json`. Any other address that leads nowhere stops the build and names the page.
|
||||
|
||||
## Development
|
||||
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in a new issue