Use note: lines for HTML metadata, not # comments

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-23 11:28:13 +03:30
parent 1b9848d14f
commit 4b4cf9aae8
8 changed files with 45 additions and 26 deletions

View File

@@ -20,18 +20,22 @@ WHITE_POINT = (96.422, 100.0, 82.521)
# (no ">") are references themselves. The " > REF" suffix is stripped to
# recover the real sample name used as sample_id.
REF_SEP = ">"
NOTE_PREFIX = "# note:"
NOTE_PREFIX = "note:"
def _is_note_line(line: str) -> bool:
return line.strip().lower().startswith(NOTE_PREFIX)
def load_notes(path: Path) -> list[str]:
"""Read display notes from '# note: ...' comment lines in the samples file."""
"""Read display notes from 'note: ...' lines in the samples file."""
if not path.exists():
return []
notes = []
for line in path.read_text(encoding="utf-8").splitlines():
stripped = line.strip()
if stripped.lower().startswith(NOTE_PREFIX):
notes.append(stripped[len(NOTE_PREFIX):].strip())
notes.append(stripped[len(NOTE_PREFIX) :].strip())
return notes
@@ -48,7 +52,9 @@ def _sample_lines(path: Path) -> list[str]:
return [
line.strip()
for line in path.read_text(encoding="utf-8").splitlines()
if line.strip() and not line.strip().startswith("#")
if line.strip()
and not line.strip().startswith("#")
and not _is_note_line(line)
]