feat: write the site as a Gemini capsule #12

Merged
squid merged 6 commits from feat/gemini-output into main 2026-11-16 11:55:40 +00:00

2026-11-16

tgiachi
fix(gemini): list items, spaces in addresses, wide tables, per post language, empty lists, layout images
All checks were successful
check / check (pull_request) Successful in 30s
- a list item with no text (only an image or a link without a label) has no empty bullet,
  its links are still written
- paragraphs and table cells of a list item do not stick together, and a preformatted
  block in an item stays a block after its bullet
- spaces in the address of a link line are written as %20
- a wide table with an empty first cell has no empty heading, a wide table with only a
  header or only one column is written as bullets, and the header is not lost
- a post in another language than the news has its own line in .meta, before the lines
  of the folders: the server uses the first line that matches a document (checked with
  Agate 3.3.25)
- an empty {{news_archive}} or {{categories_list}} leaves nothing, with its heading, so
  a site without news says so once
- images of the layout (class logo, mark or decorative, role presentation or none) leave
  no link line and the file is not copied
- the command test names files instead of counting them, and -clean and the warning
  about old files work for the gemini command too

Refs #10
2026-11-16 12:53:37 +01:00
tgiachi
Merge branch 'feat/blog-news' into feat/gemini-output
All checks were successful
check / check (pull_request) Successful in 30s
2026-11-16 12:50:17 +01:00
tgiachi
Merge branch 'feat/blog-news' into feat/gemini-output
All checks were successful
check / check (pull_request) Successful in 29s
2026-11-16 12:32:39 +01:00
tgiachi
feat(gemtext): write a table wider than 80 columns as records
All checks were successful
check / check (pull_request) Successful in 31s
A preformatted block is not wrapped by the readers, so a table with long cells
(the data retention table of the services page) became unreadable. A wide table
with a header row is now a heading for each row and a bullet for each other cell,
named by its column; without a header, one bullet per row.

Refs #10
2026-11-16 12:28:54 +01:00
tgiachi
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
2026-11-16 12:28:10 +01:00
tgiachi
feat(gemtext): convert the HTML of a page to gemtext
A new package, with no new dependency, that reads the HTML a page renders to (the
lenient mode of encoding/xml with the HTML void elements and entities) and writes
gemtext: three heading levels, one line paragraphs, the links of a paragraph, a list,
a quote or a table on lines of their own after it, bullets (a list of only links is
link lines), quotes (a note is a quote), preformatted blocks, tables as aligned
preformatted blocks, images as link lines, no emphasis, and lines that look like
gemtext are protected. Options.Link maps or drops an address and its error stops
the conversion; Options.Block expands the placeholders of generated blocks.

The language files also keep the order of the menu now (Lang.NavOrder), which the
Gemini output needs.

Refs #10
2026-11-16 12:19:38 +01:00