cargo fmt

This commit is contained in:
aiongg
2026-10-24 21:06:29 +00:00
parent 34ec59fee1
commit 69137e8469
2 changed files with 28 additions and 7 deletions
+5 -3
View File
@@ -355,9 +355,11 @@ fn remove_toc(s: &mut Session, start: usize, end: usize) -> Result<usize, CmdErr
start
}
};
let titled = start.checked_sub(1).and_then(|i| s.doc.body.get(i)).and_then(|b| b.as_para()).is_some_and(|p| {
p.props.style.as_deref() == Some("TOCHeading") && p.section.is_none() && toc_field(p).is_none()
});
let titled = start
.checked_sub(1)
.and_then(|i| s.doc.body.get(i))
.and_then(|b| b.as_para())
.is_some_and(|p| p.props.style.as_deref() == Some("TOCHeading") && p.section.is_none() && toc_field(p).is_none());
if titled {
s.doc.remove_block(StoryRef::Body, &Path::top(start - 1))?;
return Ok(at - 1);
+23 -4
View File
@@ -142,9 +142,19 @@ fn new_comment(s: &mut Session, v: &Value) -> CmdResult {
let id = comment_id(s)?;
let initials = s.user_initials();
let now = now_iso();
s.doc
.comments
.insert(id, Comment { author: s.author.clone(), initials, date: now.clone(), date_utc: Some(now), parent: None, resolved: false, part, ..Default::default() });
s.doc.comments.insert(
id,
Comment {
author: s.author.clone(),
initials,
date: now.clone(),
date_utc: Some(now),
parent: None,
resolved: false,
part,
..Default::default()
},
);
let props = Default::default();
s.doc.insert_object(&b, InlineObject::CommentEnd { id }, &props)?;
s.doc.insert_object(&a, InlineObject::CommentStart { id }, &props)?;
@@ -174,7 +184,16 @@ fn reply(s: &mut Session, v: &Value) -> CmdResult {
let now = now_iso();
s.doc.comments.insert(
id,
Comment { author: s.author.clone(), initials, date: now.clone(), date_utc: Some(now), parent: Some(parent), resolved: false, part, ..Default::default() },
Comment {
author: s.author.clone(),
initials,
date: now.clone(),
date_utc: Some(now),
parent: Some(parent),
resolved: false,
part,
..Default::default()
},
);
Ok(json!({"id": id}))
}