Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.77.2
toolchain: 1.85.0
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
Expand All @@ -31,7 +31,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.77.2
toolchain: 1.85.0
components: clippy
override: true
- uses: actions-rs/clippy-check@v1
Expand Down Expand Up @@ -68,9 +68,9 @@ jobs:
matrix:
include:
- os: ubuntu-latest
rust: 1.77.2
rust: 1.85.0
- os: windows-latest
rust: 1.77.2
rust: 1.85.0
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@main
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- update rust toolchain version to match MSRV of chatmail core: 1.85.0

## 0.14.1 - Allow country TLDs in scheme-less links

- allow country TLDs in scheme-less links
Expand Down Expand Up @@ -62,7 +64,7 @@
- upgraded nom to 7
- The following generic schemes (schemes that don't end in `://`) get linkified now:
`mailto:`, `news:`, `feed:`, `tel:`, `sms:`, `geo:`, `maps:`, `bitcoin:`, `bitcoincash:`, `eth:`, `ethereum:`, `magnet:`
- added `scheme` property to `LinkDestination`
- added `scheme` property to `LinkDestination`

## 0.7.0 - All the Hashtags

Expand Down
10 changes: 10 additions & 0 deletions docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,13 @@ The third priority is binary size, so be careful with huge extra libraries, mayb
7. `cd message_parser_wasm/`
8. `wasm-pack build --scope deltachat --target web`
9. `wasm-pack publish --target web`


### Reorder imports
We use [`group_imports="StdExternalCrate"`](https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#group_imports) to group imports,
which requires the nightly version of the rust toolchain,
so you need to run the following comand to fix the order of the imports:

```
cargo +nightly fmt -- --config=group_imports="StdExternalCrate"
```
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.77.2
1.85.0
15 changes: 3 additions & 12 deletions src/parser/is_emoji.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,20 +243,11 @@ mod emoji_test {
#[test]
fn test_string_contains_only_emojis_and_count() {
assert_eq!(count_emojis_if_only_contains_emoji("#️⃣"), Some(1));
assert_eq!(
count_emojis_if_only_contains_emoji("👩🏽‍❤️‍👨🏽Hashtag"),
None
);
assert_eq!(count_emojis_if_only_contains_emoji("👩🏽‍❤️‍👨🏽Hashtag"), None);
assert_eq!(count_emojis_if_only_contains_emoji("❤️‍🔥"), Some(1));
assert_eq!(count_emojis_if_only_contains_emoji("👩🏽‍❤️‍👨🏽"), Some(1));
assert_eq!(
count_emojis_if_only_contains_emoji("👩🏽‍❤️‍👨🏽👩🏽‍❤️‍👨🏽"),
Some(2)
);
assert_eq!(
count_emojis_if_only_contains_emoji("👩🏽‍❤️‍👨🏽❤️‍🔥👩🏽‍❤️‍👨🏽"),
Some(3)
);
assert_eq!(count_emojis_if_only_contains_emoji("👩🏽‍❤️‍👨🏽👩🏽‍❤️‍👨🏽"), Some(2));
assert_eq!(count_emojis_if_only_contains_emoji("👩🏽‍❤️‍👨🏽❤️‍🔥👩🏽‍❤️‍👨🏽"), Some(3));
// hair color
assert_eq!(count_emojis_if_only_contains_emoji("👨‍🦰"), Some(1));
assert_eq!(count_emojis_if_only_contains_emoji("👨‍🦳"), Some(1));
Expand Down
3 changes: 1 addition & 2 deletions src/parser/link_url/ip/ipv6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ use nom::{
IResult,
};

use crate::parser::{parse_from_text::base_parsers::CustomError, utils::is_hex_digit};

use super::ipv4::ipv4;
use crate::parser::{parse_from_text::base_parsers::CustomError, utils::is_hex_digit};

fn h16(input: &str) -> IResult<&str, &str, CustomError<&str>> {
take_while_m_n(1, 4, is_hex_digit)(input)
Expand Down
11 changes: 5 additions & 6 deletions src/parser/link_url/parse_link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ use nom::{
IResult, Slice,
};

use super::{
allowed_tlds::check_if_tld_is_allowed,
parenthesis_counter::count_chars_in_complete_parenthesis,
punycode_warning::get_puny_code_warning,
};
use crate::parser::{
link_url::{
ip::{ip_literal::ip_literal, ipv4::ipv4},
Expand All @@ -22,12 +27,6 @@ use crate::parser::{
},
};

use super::{
allowed_tlds::check_if_tld_is_allowed,
parenthesis_counter::count_chars_in_complete_parenthesis,
punycode_warning::get_puny_code_warning,
};

/// determines which generic schemes (without '://') get linkifyed
fn is_allowed_generic_scheme(scheme: &str) -> bool {
matches!(
Expand Down
3 changes: 1 addition & 2 deletions src/parser/parse_from_text/desktop_subset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ use nom::{
IResult,
};

use crate::parser::LinkDestination;

use super::base_parsers::CustomError;
use super::markdown_elements::{delimited_email_address, delimited_link};
use super::text_elements::parse_text_element;
use super::Element;
use crate::parser::LinkDestination;

// [labeled](https://link)
pub(crate) fn labeled_link(input: &str) -> IResult<&str, Element, CustomError<&str>> {
Expand Down
6 changes: 4 additions & 2 deletions src/parser/parse_from_text/hashtag_content_char_ranges.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::parser::utils::is_in_one_of_ranges;
use std::ops::RangeInclusive;

use crate::parser::utils::is_in_one_of_ranges;

const NUMBER_OF_RANGES: usize = 850;

/*
Expand Down Expand Up @@ -882,9 +883,10 @@ pub(crate) fn hashtag_content_char(c: char) -> bool {

#[cfg(test)]
mod test {
use std::ops::RangeInclusive;

use crate::parser::parse_from_text::hashtag_content_char_ranges::hashtag_content_char;
use crate::parser::utils::is_in_one_of_ranges;
use std::ops::RangeInclusive;

#[test]
fn test_range_function() {
Expand Down
9 changes: 4 additions & 5 deletions src/parser/parse_from_text/text_elements.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/// nom parsers for text elements
use crate::parser::link_url::LinkDestination;

use super::hashtag_content_char_ranges::hashtag_content_char;
use super::Element;
use nom::{
bytes::{
complete::{tag, take, take_while, take_while1},
Expand All @@ -15,6 +10,10 @@ use nom::{
};

use super::base_parsers::CustomError;
use super::hashtag_content_char_ranges::hashtag_content_char;
use super::Element;
/// nom parsers for text elements
use crate::parser::link_url::LinkDestination;

fn linebreak(input: &str) -> IResult<&str, char, CustomError<&str>> {
char('\n')(input)
Expand Down
3 changes: 2 additions & 1 deletion tests/text_to_ast/desktop_set.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use super::*;
use deltachat_message_parser::parser::{link_url::PunycodeWarning, parse_desktop_set};

use super::*;

#[test]
fn do_not_parse_markdown_elements() {
assert_eq!(
Expand Down
3 changes: 2 additions & 1 deletion tests/text_to_ast/markdown.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use super::*;
use deltachat_message_parser::parser::parse_markdown_text;

use super::*;

#[test]
fn bold_capitalized_command_suggestion() {
let input = "**/TELL** world";
Expand Down
3 changes: 2 additions & 1 deletion tests/text_to_ast/text_only.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use super::*;
use deltachat_message_parser::parser::parse_only_text;

use super::*;

#[test]
fn do_not_parse_markdown_elements() {
assert_eq!(
Expand Down
Loading