diff --git a/src/parser/org.rs b/src/parser/org.rs index 2af4f41..5a934f0 100644 --- a/src/parser/org.rs +++ b/src/parser/org.rs @@ -168,7 +168,8 @@ struct OpenGreater { /// or Unicode word characters (letters and digits). `:END:` is the closer. /// org-element plain link at column 0: `file+emacs:` / `file+sys:` / /// `file:` / `shell:` / `elisp:` / `help:` / `info:` / `http://` / -/// `https://` / `eww:` / `irc:` / `bbdb:` / `gnus:` / `mailto:` / +/// `https://` / `eww:` / `irc:` / `bbdb:` / `gnus:` / `rmail:` / +/// `mhe:` / `mailto:` / /// `news:` / `doi:` / `ftp://` / `attachment:` / `id:` plus the path. /// Leftover after the path is hung Prose. `file+emacs:` / `file+sys:` /// must be matched before `file:` or the `+…` is eaten as the path. @@ -197,6 +198,10 @@ pub(crate) fn org_plain_link_marker_len(line: &str) -> Option { "bbdb:" } else if t.starts_with("gnus:") { "gnus:" + } else if t.starts_with("rmail:") { + "rmail:" + } else if t.starts_with("mhe:") { + "mhe:" } else if t.starts_with("https://") { "https://" } else if t.starts_with("http://") { diff --git a/tests/org_file_token_punct.rs b/tests/org_file_token_punct.rs index 70c6e43..ffbd659 100644 --- a/tests/org_file_token_punct.rs +++ b/tests/org_file_token_punct.rs @@ -229,6 +229,36 @@ fn leftover_gnus_plain_link_after_path_hangs_and_splits() { assert_eq!(format_text(&out, &org_cfg()).unwrap(), out); } +#[test] +fn leftover_rmail_plain_link_after_path_hangs_and_splits() { + let input = concat!("rmail:folder leftover. Next.\n", "After. Next.\n",); + let out = format_text(input, &org_cfg()).unwrap(); + assert!( + !out.contains("rmail:folder leftover. Next."), + "leftover after rmail path must still split, got:\n{out}" + ); + assert!( + out.contains("After.\nNext."), + "following prose must still split, got:\n{out}" + ); + assert_eq!(format_text(&out, &org_cfg()).unwrap(), out); +} + +#[test] +fn leftover_mhe_plain_link_after_path_hangs_and_splits() { + let input = concat!("mhe:folder leftover. Next.\n", "After. Next.\n",); + let out = format_text(input, &org_cfg()).unwrap(); + assert!( + !out.contains("mhe:folder leftover. Next."), + "leftover after mhe path must still split, got:\n{out}" + ); + assert!( + out.contains("After.\nNext."), + "following prose must still split, got:\n{out}" + ); + assert_eq!(format_text(&out, &org_cfg()).unwrap(), out); +} + #[test] fn leftover_attachment_plain_link_after_path_hangs_and_splits() { let input = concat!("attachment:plot.png leftover. Next.\n", "After. Next.\n",);