Use note: lines for HTML metadata, not # comments
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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)
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user