Skip to content

Commit

Permalink
Apostrophe should not always cause step to return CharClass::InWord (#…
Browse files Browse the repository at this point in the history
…244)

Similar to ", ”, «, and other such characters, an apostrophe can mark
a quotation, in which case the character after it may need to be
upper case. Before this commit, Hayagriva always considered the character
after an apostrophe to be within a word, and therefore lowercased it.
  • Loading branch information
sandbergja authored Nov 20, 2024
1 parent 20b1d74 commit 2f4f74d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lang/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl CharClass {
}
'(' | '[' | '{' => Self::NewSubclause,
')' | ']' | '}' => self,
'"' | '”' | '“' | '»' | '›' | '«' | '‹' | '‘' => self,
'"' | '”' | '“' | '»' | '›' | '«' | '‹' | '‘' | '\'' => self,
',' | ';' => {
if self.is_in_word() {
Self::MaybeSubclause
Expand Down Expand Up @@ -913,6 +913,10 @@ mod tests {
let title =
case.transform("Around a table: the reason why we just could not care");
assert_eq!("Around a Table: The Reason Why We Just Could Not Care", title);

let title =
case.transform("'My colleague is a robot' – exploring frontline employees' willingness to work with collaborative service robots");
assert_eq!("'My Colleague Is a Robot' – Exploring Frontline Employees' Willingness to Work with Collaborative Service Robots", title);
}

#[test]
Expand Down

0 comments on commit 2f4f74d

Please sign in to comment.