diff --git a/src/parser/org.rs b/src/parser/org.rs index 5a934f0..05cdabc 100644 --- a/src/parser/org.rs +++ b/src/parser/org.rs @@ -169,7 +169,7 @@ struct OpenGreater { /// org-element plain link at column 0: `file+emacs:` / `file+sys:` / /// `file:` / `shell:` / `elisp:` / `help:` / `info:` / `http://` / /// `https://` / `eww:` / `irc:` / `bbdb:` / `gnus:` / `rmail:` / -/// `mhe:` / `mailto:` / +/// `mhe:` / `vm:` / `wl:` / `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. @@ -202,6 +202,10 @@ pub(crate) fn org_plain_link_marker_len(line: &str) -> Option { "rmail:" } else if t.starts_with("mhe:") { "mhe:" + } else if t.starts_with("vm:") { + "vm:" + } else if t.starts_with("wl:") { + "wl:" } 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 ffbd659..5cfbf51 100644 --- a/tests/org_file_token_punct.rs +++ b/tests/org_file_token_punct.rs @@ -259,6 +259,36 @@ fn leftover_mhe_plain_link_after_path_hangs_and_splits() { assert_eq!(format_text(&out, &org_cfg()).unwrap(), out); } +#[test] +fn leftover_vm_plain_link_after_path_hangs_and_splits() { + let input = concat!("vm:folder leftover. Next.\n", "After. Next.\n",); + let out = format_text(input, &org_cfg()).unwrap(); + assert!( + !out.contains("vm:folder leftover. Next."), + "leftover after vm 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_wl_plain_link_after_path_hangs_and_splits() { + let input = concat!("wl:folder leftover. Next.\n", "After. Next.\n",); + let out = format_text(input, &org_cfg()).unwrap(); + assert!( + !out.contains("wl:folder leftover. Next."), + "leftover after wl 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",);