Handle 3 or more slashes in the path for plain links.
This commit is contained in:
parent
038535174b
commit
bbcafef8bf
13
org_mode_samples/object/plain_link/multiple_slashes.org
Normal file
13
org_mode_samples/object/plain_link/multiple_slashes.org
Normal file
@ -0,0 +1,13 @@
|
||||
file:foo
|
||||
file:/bar
|
||||
file://baz
|
||||
file:///lorem
|
||||
file:////ipsum
|
||||
file://///dolar
|
||||
|
||||
https:foo
|
||||
https:/bar
|
||||
https://baz
|
||||
https:///lorem
|
||||
https:////ipsum
|
||||
https://///dolar
|
@ -2,11 +2,13 @@ use nom::branch::alt;
|
||||
use nom::bytes::complete::is_not;
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::bytes::complete::tag_no_case;
|
||||
use nom::bytes::complete::take;
|
||||
use nom::character::complete::anychar;
|
||||
use nom::character::complete::none_of;
|
||||
use nom::character::complete::one_of;
|
||||
use nom::combinator::consumed;
|
||||
use nom::combinator::eof;
|
||||
use nom::combinator::flat_map;
|
||||
use nom::combinator::map;
|
||||
use nom::combinator::map_parser;
|
||||
use nom::combinator::not;
|
||||
@ -17,6 +19,7 @@ use nom::combinator::rest;
|
||||
use nom::combinator::verify;
|
||||
use nom::multi::many0;
|
||||
use nom::multi::many1;
|
||||
use nom::multi::many1_count;
|
||||
use nom::multi::many_till;
|
||||
use nom::sequence::tuple;
|
||||
|
||||
@ -135,13 +138,17 @@ fn file_path_plain<'b, 'g, 'r, 's>(
|
||||
exit_matcher: &path_plain_end,
|
||||
});
|
||||
let parser_context = context.with_additional_node(&parser_context);
|
||||
let (remaining, (raw_link, (_, application, _, path, search_option))) = consumed(tuple((
|
||||
let (remaining, (raw_link, (_, application, _, _, path, search_option))) = consumed(tuple((
|
||||
peek(tag("file")),
|
||||
map_parser(
|
||||
parser_with_context!(protocol)(&parser_context),
|
||||
parse_file_and_application,
|
||||
),
|
||||
tag(":"),
|
||||
opt(flat_map(
|
||||
peek(map(verify(many1_count(tag("/")), |c| *c >= 3), |c| c - 1)),
|
||||
take,
|
||||
)),
|
||||
parser_with_context!(path_plain)(&parser_context),
|
||||
opt(map(
|
||||
tuple((
|
||||
|
Loading…
Reference in New Issue
Block a user