aboutsummaryrefslogtreecommitdiffstats
path: root/src/construct/attention.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-04 15:21:11 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-04 15:21:11 +0200
commit0450e7c2b12bd3ef53e0cffb60a3dd860325b478 (patch)
treecc73bb48ae6102b27b7b864f13585eb77ef86c2c /src/construct/attention.rs
parent8eb4631bd7c4345ec2a0c9b2ca2e05bdb1d79dd7 (diff)
downloadmarkdown-rs-0450e7c2b12bd3ef53e0cffb60a3dd860325b478.tar.gz
markdown-rs-0450e7c2b12bd3ef53e0cffb60a3dd860325b478.tar.bz2
markdown-rs-0450e7c2b12bd3ef53e0cffb60a3dd860325b478.zip
Add support for unicode punctuation
Diffstat (limited to 'src/construct/attention.rs')
-rw-r--r--src/construct/attention.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/construct/attention.rs b/src/construct/attention.rs
index d4541b4..f4bb841 100644
--- a/src/construct/attention.rs
+++ b/src/construct/attention.rs
@@ -1,6 +1,7 @@
//! To do.
use crate::tokenizer::{Code, Event, EventType, Point, State, StateFnResult, TokenType, Tokenizer};
+use crate::unicode::PUNCTUATION;
use crate::util::edit_map::EditMap;
/// To do
@@ -421,10 +422,7 @@ fn classify_character(code: Code) -> GroupKind {
// Unicode whitespace.
Code::Char(char) if char.is_whitespace() => GroupKind::Whitespace,
// Unicode punctuation.
- // To do: `is_punctuation` is not in rust? Why not?
- // Perhaps we need to generate stuff just like:
- // <https://github.com/micromark/micromark/blob/main/packages/micromark-util-character/dev/lib/unicode-punctuation-regex.js>.
- Code::Char(char) if char.is_ascii_punctuation() => GroupKind::Punctuation,
+ Code::Char(char) if PUNCTUATION.contains(&char) => GroupKind::Punctuation,
Code::Char(_) => GroupKind::Other,
}
}