Skip to main content

parse

Function parse 

Source
pub fn parse(text: &str) -> Vec<Entry>
Expand description

Split a note file into entries.

Two rules, in order:

  1. A <!-- spar:followup --> line always starts an entry. spar writes one above every entry it appends, so a file written from this release on is read exactly rather than guessed at, and the first ## line after the marker is that entry’s title rather than a boundary.
  2. Otherwise a ## line starts an entry unless it names one of the sections a bug report is written in, or there is nothing open for it to be a section of.

Rule 2 is generous about what counts as a section, on purpose, because the two ways to be wrong are not the same size. Mistaking a section for a title splits one follow-up into four and files an issue called “Impact” carrying a fragment: visible, embarrassing, and on somebody else’s tracker. Mistaking a title for a section merges two follow-ups into one issue that carries both: fat, and recoverable by reading it. Nothing is lost.

A heading inside a fenced code block is never a boundary. A body is free to carry a snippet, style::issue_body deliberately protects fenced blocks from the length budget, and a snippet containing a ## line would otherwise split the entry that quotes it.

Rejected as a third signal: “an entry follows a Found while working on #N. line”. Provenance is not guaranteed, a hand written entry has none, and a parser that leans on prose is one an edit breaks.