proto, memoryd: no line of an entry may start with §, and headers are exact
Implemented-By: OpenCode session (model recorded in docs/implementer-log.md)
This commit is contained in:
@@ -144,7 +144,8 @@ impl ConsolidateEntry {
|
||||
}
|
||||
|
||||
/// Why an entry's text is not a well-formed entry: empty once trimmed, too long, or holding a line
|
||||
/// that is only the separator. `None` when it is fine.
|
||||
/// that starts with the separator, spaces aside. In `notes.md` such a line would read as a header,
|
||||
/// and a header says where an entry came from. `None` when it is fine.
|
||||
pub fn entry_problem(text: &str, max: usize) -> Option<String> {
|
||||
if text.trim().is_empty() {
|
||||
return Some("an entry cannot be empty".to_string());
|
||||
@@ -156,9 +157,9 @@ pub fn entry_problem(text: &str, max: usize) -> Option<String> {
|
||||
));
|
||||
}
|
||||
for line in text.lines() {
|
||||
if line.trim() == SEPARATOR {
|
||||
if line.trim_start().starts_with(SEPARATOR) {
|
||||
return Some(format!(
|
||||
"an entry cannot hold a line that is only {SEPARATOR}"
|
||||
"an entry cannot hold a line that starts with {SEPARATOR}"
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user