From 1f53a8c244304d9dc5bea0e012cf07d8c0fc0027 Mon Sep 17 00:00:00 2001 From: PoiScript Date: Sun, 10 May 2020 01:46:09 +0800 Subject: [PATCH] fix(title): fix is_commented to recognize any whitespaces (#21) --- src/elements/title.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/elements/title.rs b/src/elements/title.rs index 68cfd04..b37d484 100644 --- a/src/elements/title.rs +++ b/src/elements/title.rs @@ -83,7 +83,8 @@ impl Title<'_> { /// Returns `true` if this headline is commented pub fn is_commented(&self) -> bool { - self.raw.starts_with("COMMENT ") || self.raw == "COMMENT" + self.raw.starts_with("COMMENT") + && (self.raw.len() == 7 || self.raw[7..].starts_with(char::is_whitespace)) } pub fn into_owned(self) -> Title<'static> {