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)) {let 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() != '') {let line = lines[i]let 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
- 31cabfccmission 021: E2E script, report, LOG, STATUSmre
- 6aea8683editor look: .empty rule only for p.empty, files off where tickets has no upload, state note one line, events test scrolls the editor into view; synced md-editor (components d702d76+6f27ad3); gate 377/0, events 52/0mre
- dce6ffa6Merge branch 'w28-deflake'mre
- 536092a1tickets (mission 019): de-flake the m016 comment clicks (B: unliked) — calmClick waits until the button stops moving; test only, no app changemre
- 9c5fd42amission 020: attachments E2E proof (lisbeth Chrome, real-data copy), reportmre
- 1206404fREADME attachments, report 018, LOG/STATUSmre
- 3d9e7f3ctests: m017 gate fixes (list count, waits before delete clicks); gate 373/0mre
- dd41d5bcre-sync components 15be2ac; mission 018mre
- 420ad1bbtickets (mission 017 WIP, tickets#27): comment attachments — lib/attachments.hl (storage/attachments, limits, type by content, members-only GET /api/attachments/:id, delete drops, edit keeps), multipart POST …/comments (lib/multipart.hl), Respond block in FilesUpload (blocks verbatim from components w27c 1f8d79d), gate m017 checks written (not yet run); report, LOG, STATUSmre
- a7a1380dmission brief 017mre
- f83d9c0dtickets (mission 016): report reports/016-comments-block.md, LOG, STATUS, README gate countmre
- eef80f55tickets (mission 016): comments through the shared Comments block (layouts#2) — edit (author, earlier versions kept), delete (author, asks; leaves one line in the history), like (members, toggle) on the server (lib/comments.hl, append-only tables), faces + API …/comments/:comment/{edit,delete,like}, push commentChanged; every run of comments is a block in place in the history; Markdown fields on the Hybriel MdEditor (shared/md-editor.js retired: it took over the block's <md-editor>); blocks copied verbatim from components.hybriel 9db927d (tools/sync-components.sh); gates browser 351/0 (old 326/0), events 52/0 (old 52/0)mre
- eb7aeeb9mission brief 016mre
- e4c34759paths: projects moved into /media/STORAGE/projects/WorldAPI/mre
- 26efb23freport w6-events (events test)mre
- c6bfab04mission 015: re-vendor Hybriel 0f396652 (static build), reportmre
- b7ec5981mission brief 015mre
- 5dc68731docker-compose: init: true (hybriel#156, PID 1 ignored SIGTERM, every restart waited 10 s)mre
- 8a460b16mission 014: Apollo's 'stream opened right after the start gets no live events' is not a tickets bug — events.mjs checks early streamsmre
- 6309ca81mission brief 014mre