Handle orgifying text in regular link path and raw-link.
This commit is contained in:
@@ -2,6 +2,7 @@ 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;
|
||||
@@ -116,6 +117,7 @@ fn parse_path_reg<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, PathReg<'s>> {
|
||||
id_path_reg,
|
||||
custom_id_path_reg,
|
||||
code_ref_path_reg,
|
||||
protocol_path_reg,
|
||||
fuzzy_path_reg,
|
||||
))(input)
|
||||
}
|
||||
@@ -172,6 +174,19 @@ 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)?;
|
||||
Ok((
|
||||
remaining,
|
||||
PathReg {
|
||||
link_type: LinkType::Protocol(protocol.into()),
|
||||
path: path.into(),
|
||||
raw_link: raw_link.into(),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
fn fuzzy_path_reg<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, PathReg<'s>> {
|
||||
let (remaining, body) = rest(input)?;
|
||||
Ok((
|
||||
|
||||
Reference in New Issue
Block a user