Expand description
Comments: threads readers leave on a page, kept by a comment store. The
Store port is what a store must do — list, create, reply, resolve —
and Comments is what the server writes through: every write it makes
announces itself on the change bus, so open pages hear it whatever keeps
the threads. The YAML files under .devpage/comments/ are one store
(yaml); tests keep threads in memory ([memory]). Where a store
keeps threads across versions of a document, anchor carries each one
onto the next version’s text.
Modules§
- anchor
- Carrying a thread onto a new version of its page: the page’s text as the page script reads it, and where a thread’s quote is in it now. Pure — the server hands it the new version’s HTML and stores what it answers.
- yaml
- The comment store as files: one YAML file per thread under
.devpage/comments/, by the path of the page it is about. It writes nothing outside.devpage/.
Structs§
- Anchor
- What a thread is attached to: rendered text, with a little context.
- Comments
- The comments of the documents under one scope: a store, and the bus every
successful write is announced on —
comments <page>, once, as the write lands — so open pages fetch that page’s threads again. - Listed
- A thread with its id, as the page receives it.
- Message
- Thread
- A thread as stored: its anchor and its messages, oldest first.
Traits§
- Store
- The comment store port: where one served folder’s threads are kept. A
pageis the address of the Markdown file a thread is about (/a.md); one that climbs out of the served folder, and an id that isn’t a thread’s, are errors. Writes are silent — announcing them isComments’s job.
Functions§
- is_id
- Whether
idcan be a thread’s: letters, digits and dashes, never empty. - is_page
- Whether
pagestays inside the served folder: only plain path parts. - local_
author - The local author:
git config user.nameas git sees it from the served folder — its global setting counts, so no.gitfolder is needed — or the system’s user name when git has none. - new_id
- A new thread’s id: the UTC time it was started, to the second, and four hex digits from the clock’s nanoseconds — so a page’s threads list oldest first — with when it was started.