diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-04 15:21:11 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-04 15:21:11 +0200 |
commit | 0450e7c2b12bd3ef53e0cffb60a3dd860325b478 (patch) | |
tree | cc73bb48ae6102b27b7b864f13585eb77ef86c2c /src/construct/attention.rs | |
parent | 8eb4631bd7c4345ec2a0c9b2ca2e05bdb1d79dd7 (diff) | |
download | markdown-rs-0450e7c2b12bd3ef53e0cffb60a3dd860325b478.tar.gz markdown-rs-0450e7c2b12bd3ef53e0cffb60a3dd860325b478.tar.bz2 markdown-rs-0450e7c2b12bd3ef53e0cffb60a3dd860325b478.zip |
Add support for unicode punctuation
Diffstat (limited to '')
-rw-r--r-- | src/construct/attention.rs | 6 |
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, } } |