Restrict protocol links to org-link-parameters.
This commit is contained in:
@@ -2,7 +2,6 @@ use nom::branch::alt;
|
||||
use nom::bytes::complete::escaped;
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::bytes::complete::take_till1;
|
||||
use nom::bytes::complete::take_until;
|
||||
use nom::character::complete::anychar;
|
||||
use nom::combinator::consumed;
|
||||
use nom::combinator::eof;
|
||||
@@ -18,6 +17,7 @@ use nom::sequence::tuple;
|
||||
|
||||
use super::object_parser::regular_link_description_set_object;
|
||||
use super::org_source::OrgSource;
|
||||
use super::plain_link::protocol;
|
||||
use super::util::exit_matcher_parser;
|
||||
use super::util::get_consumed;
|
||||
use super::util::maybe_consume_object_trailing_whitespace_if_not_exiting;
|
||||
@@ -99,7 +99,7 @@ struct PathReg<'s> {
|
||||
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
fn pathreg<'b, 'g, 'r, 's>(
|
||||
_context: RefContext<'b, 'g, 'r, 's>,
|
||||
context: RefContext<'b, 'g, 'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, PathReg<'s>> {
|
||||
let (remaining, path) = map_parser(
|
||||
@@ -111,18 +111,21 @@ fn pathreg<'b, 'g, 'r, 's>(
|
||||
'\\',
|
||||
anychar,
|
||||
),
|
||||
parse_path_reg,
|
||||
parser_with_context!(parse_path_reg)(context),
|
||||
)(input)?;
|
||||
Ok((remaining, path))
|
||||
}
|
||||
|
||||
fn parse_path_reg<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, PathReg<'s>> {
|
||||
fn parse_path_reg<'b, 'g, 'r, 's>(
|
||||
context: RefContext<'b, 'g, 'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, PathReg<'s>> {
|
||||
alt((
|
||||
file_path_reg,
|
||||
id_path_reg,
|
||||
custom_id_path_reg,
|
||||
code_ref_path_reg,
|
||||
protocol_path_reg,
|
||||
parser_with_context!(protocol_path_reg)(context),
|
||||
fuzzy_path_reg,
|
||||
))(input)
|
||||
}
|
||||
@@ -189,9 +192,15 @@ fn code_ref_path_reg<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, PathReg<'s>
|
||||
))
|
||||
}
|
||||
|
||||
fn protocol_path_reg<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, PathReg<'s>> {
|
||||
let (remaining, (raw_link, (protocol, _, path))) =
|
||||
consumed(tuple((take_until(":"), tag(":"), rest)))(input)?;
|
||||
fn protocol_path_reg<'b, 'g, 'r, 's>(
|
||||
context: RefContext<'b, 'g, 'r, 's>,
|
||||
input: OrgSource<'s>,
|
||||
) -> Res<OrgSource<'s>, PathReg<'s>> {
|
||||
let (remaining, (raw_link, (protocol, _, path))) = consumed(tuple((
|
||||
parser_with_context!(protocol)(context),
|
||||
tag(":"),
|
||||
rest,
|
||||
)))(input)?;
|
||||
Ok((
|
||||
remaining,
|
||||
PathReg {
|
||||
|
||||
Reference in New Issue
Block a user