Do not strip "//" from plain link path.
This commit is contained in:
parent
ba8115c648
commit
1bbe8fc688
@ -101,6 +101,7 @@ fn post<'b, 'g, 'r, 's>(
|
|||||||
Ok((remaining, ()))
|
Ok((remaining, ()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
fn parse_path_plain<'b, 'g, 'r, 's>(
|
fn parse_path_plain<'b, 'g, 'r, 's>(
|
||||||
context: RefContext<'b, 'g, 'r, 's>,
|
context: RefContext<'b, 'g, 'r, 's>,
|
||||||
input: OrgSource<'s>,
|
input: OrgSource<'s>,
|
||||||
@ -111,6 +112,7 @@ fn parse_path_plain<'b, 'g, 'r, 's>(
|
|||||||
))(input)
|
))(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
pub(crate) fn parse_file_and_application<'s>(
|
pub(crate) fn parse_file_and_application<'s>(
|
||||||
input: OrgSource<'s>,
|
input: OrgSource<'s>,
|
||||||
) -> Res<OrgSource<'s>, Option<OrgSource<'s>>> {
|
) -> Res<OrgSource<'s>, Option<OrgSource<'s>>> {
|
||||||
@ -122,6 +124,7 @@ pub(crate) fn parse_file_and_application<'s>(
|
|||||||
Ok((remaining, application))
|
Ok((remaining, application))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
fn file_path_plain<'b, 'g, 'r, 's>(
|
fn file_path_plain<'b, 'g, 'r, 's>(
|
||||||
context: RefContext<'b, 'g, 'r, 's>,
|
context: RefContext<'b, 'g, 'r, 's>,
|
||||||
input: OrgSource<'s>,
|
input: OrgSource<'s>,
|
||||||
@ -132,15 +135,14 @@ fn file_path_plain<'b, 'g, 'r, 's>(
|
|||||||
exit_matcher: &path_plain_end,
|
exit_matcher: &path_plain_end,
|
||||||
});
|
});
|
||||||
let parser_context = context.with_additional_node(&parser_context);
|
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")),
|
peek(tag("file")),
|
||||||
map_parser(
|
map_parser(
|
||||||
parser_with_context!(protocol)(&parser_context),
|
parser_with_context!(protocol)(&parser_context),
|
||||||
parse_file_and_application,
|
parse_file_and_application,
|
||||||
),
|
),
|
||||||
tag(":"),
|
tag(":"),
|
||||||
opt(tag("//")),
|
recognize(opt(parser_with_context!(path_plain)(&parser_context))),
|
||||||
parser_with_context!(path_plain)(&parser_context),
|
|
||||||
opt(map(
|
opt(map(
|
||||||
tuple((
|
tuple((
|
||||||
tag("::"),
|
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>(
|
fn protocol_path_plain<'b, 'g, 'r, 's>(
|
||||||
context: RefContext<'b, 'g, 'r, 's>,
|
context: RefContext<'b, 'g, 'r, 's>,
|
||||||
input: OrgSource<'s>,
|
input: OrgSource<'s>,
|
||||||
|
@ -133,6 +133,7 @@ fn pathreg<'b, 'g, 'r, 's>(
|
|||||||
Ok((remaining, path))
|
Ok((remaining, path))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
fn parse_path_reg<'b, 'g, 'r, 's>(
|
fn parse_path_reg<'b, 'g, 'r, 's>(
|
||||||
context: RefContext<'b, 'g, 'r, 's>,
|
context: RefContext<'b, 'g, 'r, 's>,
|
||||||
input: OrgSource<'s>,
|
input: OrgSource<'s>,
|
||||||
@ -188,6 +189,7 @@ enum ParserState {
|
|||||||
Percent,
|
Percent,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
fn apply_link_templates<'b, 'g, 'r, 's>(
|
fn apply_link_templates<'b, 'g, 'r, 's>(
|
||||||
context: RefContext<'b, 'g, 'r, 's>,
|
context: RefContext<'b, 'g, 'r, 's>,
|
||||||
input: OrgSource<'s>,
|
input: OrgSource<'s>,
|
||||||
@ -247,6 +249,7 @@ fn apply_link_templates<'b, 'g, 'r, 's>(
|
|||||||
Some(ret)
|
Some(ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
fn file_path_reg<'b, 'g, 'r, 's>(
|
fn file_path_reg<'b, 'g, 'r, 's>(
|
||||||
context: RefContext<'b, 'g, 'r, 's>,
|
context: RefContext<'b, 'g, 'r, 's>,
|
||||||
input: OrgSource<'s>,
|
input: OrgSource<'s>,
|
||||||
@ -305,6 +308,7 @@ fn file_path_reg<'b, 'g, 'r, 's>(
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
fn id_path_reg<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, PathReg<'s>> {
|
fn id_path_reg<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, PathReg<'s>> {
|
||||||
let (remaining, (raw_link, (_, path))) = consumed(tuple((tag("id:"), rest)))(input)?;
|
let (remaining, (raw_link, (_, path))) = consumed(tuple((tag("id:"), rest)))(input)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -319,6 +323,7 @@ fn id_path_reg<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, PathReg<'s>> {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
fn custom_id_path_reg<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, PathReg<'s>> {
|
fn custom_id_path_reg<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, PathReg<'s>> {
|
||||||
let (remaining, (raw_link, (_, path))) = consumed(tuple((tag("#"), rest)))(input)?;
|
let (remaining, (raw_link, (_, path))) = consumed(tuple((tag("#"), rest)))(input)?;
|
||||||
Ok((
|
Ok((
|
||||||
@ -333,6 +338,7 @@ fn custom_id_path_reg<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, PathReg<'s
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
fn code_ref_path_reg<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, PathReg<'s>> {
|
fn code_ref_path_reg<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, PathReg<'s>> {
|
||||||
let (remaining, (raw_link, (_, path, _))) = consumed(tuple((
|
let (remaining, (raw_link, (_, path, _))) = consumed(tuple((
|
||||||
tag("("),
|
tag("("),
|
||||||
@ -351,6 +357,7 @@ fn code_ref_path_reg<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, PathReg<'s>
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
fn protocol_path_reg<'b, 'g, 'r, 's>(
|
fn protocol_path_reg<'b, 'g, 'r, 's>(
|
||||||
context: RefContext<'b, 'g, 'r, 's>,
|
context: RefContext<'b, 'g, 'r, 's>,
|
||||||
input: OrgSource<'s>,
|
input: OrgSource<'s>,
|
||||||
@ -372,6 +379,7 @@ fn protocol_path_reg<'b, 'g, 'r, 's>(
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||||
fn fuzzy_path_reg<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, PathReg<'s>> {
|
fn fuzzy_path_reg<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, PathReg<'s>> {
|
||||||
let (remaining, body) = rest(input)?;
|
let (remaining, body) = rest(input)?;
|
||||||
Ok((
|
Ok((
|
||||||
|
Loading…
x
Reference in New Issue
Block a user