oficina / mapa Public

Clone
git clone https://amadan.net/oficina/mapa

Plain git — no account needed to clone.

Download

Download this file

1package mapa
2
3import "amadan.net/oficina/mapa/internal/mapa/markup"
4
5// S3 is the page's bytes as the suite contract's S3 serves them (§8),
6// the seam for slice 1 item 6. Absent parts are omitted with their
7// separator, as Fichas §6.4 does: a team page is its title, a blank line
8// and its body, or exactly its title when the body is empty; a daily
9// note is its ISO date, a blank line and its body; a scratch page is
10// exactly its body. The body is as stored: link text as typed, embeds as
11// their reference string, never expanded; and each image as its alt
12// text, so no image id and no byte reaches a sibling (images §2.1). So
13// the bytes change only when the page's own revision does (§3.2, gate
14// 3).
15func (record Record) S3(kind string) string {
16 record.Body = markup.ImagesAsAlt(record.Body)
17 head := ""
18 switch kind {
19 case KindPage:
20 head = record.Title
21 case KindDaily:
22 head = record.Date
23 }
24 switch {
25 case head == "":
26 return record.Body
27 case record.Body == "":
28 return head
29 }
30 return head + "\n\n" + record.Body
31}
32