From 652ae51422e52e3a0109ce059b679a5a1365f54d Mon Sep 17 00:00:00 2001 From: Alex Roper Date: Mon, 4 May 2020 21:30:45 -0700 Subject: [PATCH 1/2] Fix is_commented to look for only a single space. --- src/elements/title.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/elements/title.rs b/src/elements/title.rs index 0a3292f..1938dca 100644 --- a/src/elements/title.rs +++ b/src/elements/title.rs @@ -82,7 +82,7 @@ impl Title<'_> { /// Returns `true` if this headline is commented pub fn is_commented(&self) -> bool { - self.raw.starts_with("COMMENT ") + self.raw.starts_with("COMMENT ") } pub fn into_owned(self) -> Title<'static> { From 945aaba941efb6faf6b9eb418177a0d37463d8e3 Mon Sep 17 00:00:00 2001 From: Alex Roper Date: Mon, 4 May 2020 21:53:36 -0700 Subject: [PATCH 2/2] Handle cases like '* COMMENT' and '* COMMENT '. Per the Org spec, the "first word" of the title must be COMMENT. They don't define word more precisely, but I think this should include it being the only word, and this seems to be Org's behavior currently. --- src/elements/title.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/elements/title.rs b/src/elements/title.rs index 1938dca..1818a77 100644 --- a/src/elements/title.rs +++ b/src/elements/title.rs @@ -82,7 +82,7 @@ impl Title<'_> { /// Returns `true` if this headline is commented pub fn is_commented(&self) -> bool { - self.raw.starts_with("COMMENT ") + self.raw.starts_with("COMMENT ") || self.raw == "COMMENT" } pub fn into_owned(self) -> Title<'static> {