feat: write the site as a Gemini capsule #12
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/gemini-output"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
motorino geminiwrites the site as a Gemini capsule, for an Agate server. I want the capsule to come from the same pages and news as the website, with no second copy to keep up.This branch is built on top of the blog news (#11), so it lists those commits too. I merge #11 first.
How it works
internal/gemtext: it reads the HTML a page renders to and writes gemtext, with no new dependency (the lenient mode ofencoding/xmlwith the HTML void elements and entities). Headings (three levels), one line paragraphs, the links of a paragraph, list, quote or table on lines of their own after it, bullets, quotes, preformatted blocks, tables as aligned columns (as records when wider than 80 columns), images as link lines. Lines that look like gemtext are protected./<code>/, English included. It comes from-lang, elsegemini_languageinsite.json, else the default language..meta. The server reads the language of the documents from<out>/.meta(Agate with--central-conf). For every language other than the root one there are two lines,en/*:;lang=enanden/**/*:;lang=en, since*does not cross folders, and the same two fornews/when the news are in another language. The file is never linked./news/with the index, the posts, the categories, the archives andnews/feed.gmi, the list of=> /news/2026/11/post.gmi 2026-11-14 Titlelines that feed readers subscribe to. No copies under the other languages. Every page ends with the navigation of its language, which links to the news.gemini_web_paths("/~") keeps a path that the web server serves by other means as a link to the website.Tests
make checkis green: 360 tests (205 at the top level), none failing. New tests: the converter (every element, links, blocks, broken HTML, wide tables), the capsule (tree with Italian and with English at the root,.metacontent for both, headings, navigation, the news pages and the feed, no empty file and no broken link on the whole capsule, links that stop the build, assets, drafts, web paths) and the command.I built the real site with it: 28 files, no empty file, no broken link, no HTML left in the pages.
Refs #10
Review fixes
%20..meta, with the path of its file. The server uses the first line that matches a document (I checked it with Agate 3.3.25), so these lines come before the folders.{{news_archive}}or{{categories_list}}leaves nothing with its heading, so a site without news says so once.logo,markordecorative, or rolepresentationornone) leaves no link line and its file is not copied: the logo no longer opens the home. Images of the content keep their alt.-cleanand the warning about old files work formotorino geminitoo.I served the real capsule with Agate (
--central-conf --lang it):/and the pages of the root arelang=it,/en/,/es/and/de/arelang=en,lang=esandlang=de, and/news/islang=en. I merged #11 into this branch, so I merge #11 first.- {{news_blog}} lists the posts as entries (title, long date, categories, description, a read more link) 10 to a page; the other pages are written under the index, at page/2/, page/3/ and so on, with a pager. - Archive pages for every year and month that has posts, at /news/2026/ and /news/2026/11/, when templates/archive.html exists, and a {{news_archive}} block. Refs #9The blog list, the pages of a category and the pages of an archive show every post as a note panel: a small line with the long date and the categories, the title in bold with a full stop (unless it ends with a full stop, a question mark or an exclamation mark), the description and a read more link whose aria-label names the post. The page of a post, {{news_list}} and the latest news of the home page are unchanged. A language without read_more gets the title as the link on the category and archive pages, as those pages worked before; the blog list still needs the string. Refs #9- groupArchive compared each post with the last group only, so two posts near midnight at the end of a month, written with different offsets, listed the same month twice and the build failed with "both published as". Posts are grouped by their own year and month, newest first. - {{news_archive}} is empty when there are no posts, so the index says there is no news once, and the heading of an empty {{news_archive}} or {{categories_list}} goes with it. - tests for exactly ten posts, eleven posts, a single post, a title with quotes, an ampersand, a tag and non Latin letters, and a neighbour written in another language Refs #9- 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