summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/generate_html.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/generate_html.rs b/src/generate_html.rs
index 6909871..36f3325 100644
--- a/src/generate_html.rs
+++ b/src/generate_html.rs
@@ -468,6 +468,8 @@ fn sanitize_text(text: &str, fancy: bool) -> String {
true => chars[i + 1],
false => ' ',
};
+ let is_whitespace = |c: char| c.is_whitespace() || "()[].,".contains(c);
+
match c {
'&' => {
// The HTML syntax for unicode characters is &#0000
@@ -477,14 +479,14 @@ fn sanitize_text(text: &str, fancy: bool) -> String {
'<' => output.push_str("&lt;"),
'>' => output.push_str("&gt;"),
'"' => match fancy {
- true => match prev.is_whitespace() {
+ true => match is_whitespace(prev) {
true => output.push('“'),
false => output.push('”'),
}
false => output.push_str("&#34;"),
},
'\'' => match fancy {
- true => match prev.is_whitespace() {
+ true => match is_whitespace(prev) {
true => output.push('‘'),
false => output.push('’'),
}