gitoria

tickets

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit80d8cfd180d8cfd1Tickets conductor: #51 livemre80d8cfd1/lib/import.hl

2.4 KB

  1. // lib/import.hl — the AntColony ticket file format (the import's parser), shared by tools/import.hl and the one-off
  2. // tools/fix-import-summaries.hl. Statics only (no top-level work: importing it runs nothing).
  3. //
  4. // A ticket file is `project:` and `subject:` header lines, a blank line, the summary.
  5. // The summary is HARD-WRAPPED text: lines are joined into paragraphs (one space between
  6. // them), a blank line starts a new paragraph, a list line starts a new line; paragraphs are separated by one empty line
  7. // ("\n\n") in the stored summary, which the ticket page renders with `white-space: pre-wrap`.
  8. // CRLF files work: every line is trim()med, which drops the carriage return. (Hybriel
  9. // strings have no escapes — "\r" would be two characters, so there is no CR constant.)
  10. static NL = "
  11. "
  12. // A MARKDOWN LIST LINE (`- `, `* `, `1. ` after trimming) stays its own line (ticket #15):
  13. // it starts a new line inside the paragraph ("\n"); a following ordinary line is still
  14. // joined onto it (a wrapped list item). Nested indentation is not kept.
  15. static isListLine = (line) => {
  16. if (line.startsWith('- ') || line.startsWith('* ')) { return true }
  17. let i = 0
  18. while (i < line.length && line.charCodeAt(i) >= 48 && line.charCodeAt(i) <= 57) { i = i + 1 }
  19. return i > 0 && line.slice(i, i + 2) == '. '
  20. }
  21. // hard-wrapped text → paragraphs joined by "\n\n" (list lines inside one by "\n")
  22. static paragraphsOf = (text) => {
  23. paras = []
  24. let cur = []
  25. for (raw of text.split(NL)) {
  26. line = raw.trim()
  27. if (line == '') {
  28. if (cur.length > 0) { paras.push(cur.join(NL)) }
  29. cur = []
  30. } else if (cur.length == 0 || isListLine(line)) {
  31. cur.push(line)
  32. } else {
  33. cur[cur.length - 1] = cur[cur.length - 1] + ' ' + line
  34. }
  35. }
  36. if (cur.length > 0) { paras.push(cur.join(NL)) }
  37. return paras.join(NL + NL)
  38. }
  39. // { project, subject, summary } or { error }
  40. static parse = (text) => {
  41. lines = text.split(NL)
  42. head = {}
  43. let i = 0
  44. while (i < lines.length && lines[i].trim() != '') {
  45. line = lines[i]
  46. c = line.indexOf(':')
  47. if (c > 0) { head[line.slice(0, c).trim().toLowerCase()] = line.slice(c + 1).trim() }
  48. i = i + 1
  49. }
  50. body = []
  51. i = i + 1
  52. while (i < lines.length) {
  53. body.push(lines[i])
  54. i = i + 1
  55. }
  56. if (head.project == null || head.project == '') { return { error = 'no project: line' } }
  57. if (head.subject == null || head.subject == '') { return { error = 'no subject: line' } }
  58. return { project = head.project subject = head.subject summary = paragraphsOf(body.join(NL)) }
  59. }

Branches

Latest commits

  • 80d8cfd1Tickets conductor: #51 livemre
  • 61641dd9Complete subscriptions deployment evidencemre
  • c980856cRecord successful subscriptions deployment and live checksmre
  • 4b4710adMerge branch 's51-subscriptions'mre
  • a731ef7eTickets conductor: S51 reviewed, deploy stepmre
  • b487b05aRecord verified direct push protocol handoffmre
  • 74e34cc3Verify encrypted push secrets and direct push retry semanticsmre
  • a1ac5cd0Push subscription notices directly to signed HyperConductor chat endpointsmre
  • d662ad27Remove superseded waker service for direct chat push protocolmre
  • c0ac927aTickets conductor: S51 redo for push protocolmre
  • ff2e8701Finalize subscription build verification and handoff reportmre
  • 07c6daeeTickets conductor: push allowlist URLsmre
  • 8517d14cTickets conductor: Hermes push endpointmre
  • aa4e192cTickets conductor: brief 027 push protocol changemre
  • 54bc5fe1Harden delta relevance, overflow caps and retry verificationmre
  • 8d8e2053Document subscription contract and exercise delta deliverymre
  • fd23726aAdd subscription delta API and signed wake bridgemre
  • c5d28fb5Tickets conductor: S51 startedmre
  • fd6ca1e6Tickets conductor: brief 027 waker design, push-test projectmre
  • e448e656Tickets conductor: STATUS #51mre