Do not strip "//" from plain link path.

This commit is contained in:
Tom Alexander
2023-10-08 09:28:09 -04:00
parent ba8115c648
commit 1bbe8fc688
2 changed files with 14 additions and 3 deletions

View File

@@ -101,6 +101,7 @@ fn post<'b, 'g, 'r, 's>(
Ok((remaining, ()))
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn parse_path_plain<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>,
@@ -111,6 +112,7 @@ fn parse_path_plain<'b, 'g, 'r, 's>(
))(input)
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub(crate) fn parse_file_and_application<'s>(
input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Option<OrgSource<'s>>> {
@@ -122,6 +124,7 @@ pub(crate) fn parse_file_and_application<'s>(
Ok((remaining, application))
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn file_path_plain<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>,
@@ -132,15 +135,14 @@ 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(tag("//")),
parser_with_context!(path_plain)(&parser_context),
recognize(opt(parser_with_context!(path_plain)(&parser_context))),
opt(map(
tuple((
tag("::"),
@@ -165,6 +167,7 @@ fn file_path_plain<'b, 'g, 'r, 's>(
))
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn protocol_path_plain<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>,