tickets
All repositories: gitoria
2.4 KB
// lib/import.hl — the AntColony ticket file format (the import's parser), shared by tools/import.hl and the one-off// tools/fix-import-summaries.hl. Statics only (no top-level work: importing it runs nothing).//// A ticket file is `project:` and `subject:` header lines, a blank line, the summary.// The summary is HARD-WRAPPED text: lines are joined into paragraphs (one space between// them), a blank line starts a new paragraph, a list line starts a new line; paragraphs are separated by one empty line// ("\n\n") in the stored summary, which the ticket page renders with `white-space: pre-wrap`.// CRLF files work: every line is trim()med, which drops the carriage return. (Hybriel// strings have no escapes — "\r" would be two characters, so there is no CR constant.)static NL = ""// A MARKDOWN LIST LINE (`- `, `* `, `1. ` after trimming) stays its own line (ticket #15):// it starts a new line inside the paragraph ("\n"); a following ordinary line is still// joined onto it (a wrapped list item). Nested indentation is not kept.static isListLine = (line) => {if (line.startsWith('- ') || line.startsWith('* ')) { return true }let i = 0while (i < line.length && line.charCodeAt(i) >= 48 && line.charCodeAt(i) <= 57) { i = i + 1 }return i > 0 && line.slice(i, i + 2) == '. '}// hard-wrapped text → paragraphs joined by "\n\n" (list lines inside one by "\n")static paragraphsOf = (text) => {paras = []let cur = []for (raw of text.split(NL)) {line = raw.trim()if (line == '') {if (cur.length > 0) { paras.push(cur.join(NL)) }cur = []} else if (cur.length == 0 || isListLine(line)) {cur.push(line)} else {cur[cur.length - 1] = cur[cur.length - 1] + ' ' + line}}if (cur.length > 0) { paras.push(cur.join(NL)) }return paras.join(NL + NL)}// { project, subject, summary } or { error }static parse = (text) => {lines = text.split(NL)head = {}let i = 0while (i < lines.length && lines[i].trim() != '') {line = lines[i]c = line.indexOf(':')if (c > 0) { head[line.slice(0, c).trim().toLowerCase()] = line.slice(c + 1).trim() }i = i + 1}body = []i = i + 1while (i < lines.length) {body.push(lines[i])i = i + 1}if (head.project == null || head.project == '') { return { error = 'no project: line' } }if (head.subject == null || head.subject == '') { return { error = 'no subject: line' } }return { project = head.project subject = head.subject summary = paragraphsOf(body.join(NL)) }}
Branches
Latest commits
- 9f13fbdaTickets conductor: brief 026 prioritymre
- acc477d9Tickets conductor: brief 026 + Vinzenz recommendationsmre
- 9233a734Tickets conductor: brief 026 completemre
- 5da589fdTickets conductor: brief 026 + Gitoria's answermre
- a3cd5329Tickets conductor: tickets#51 opened, brief 026 draftmre
- 6f6e5797Tickets conductor: STATUS wordingmre
- 957de51fTickets conductor: T36 live, #36 review, #50 donemre
- bc2fde32Merge branch 'main' into t36-stylemre
- b7ca093atests: wait for the new row and normalize editor marker spacesmre
- 41da3525Tickets conductor: flake cause, T36 deploy stepmre
- 64c477e6Tickets conductor: deploy waits for Arachnemre
- 467d7286Tickets conductor: T36 done, deploy questionmre
- fed5ca81ticket_list: remove repeated selected-state coloursmre
- 8542fc8aTickets conductor: T36 proof reviewedmre
- 35980936inbox: preserve desktop columns after list styles were scopedmre
- 2a5b8b91Tickets conductor: T36 cap stop, resumed for proofmre
- c077a5cbstyles: format Style with nested language rulesmre
- ccdde2beticket: format Style with nested language rulesmre
- d083535bticket_list: nest Style rules and bare media queriesmre
- c24608ebmarkdown: format Style with nested language rulesmre