Remove all whitespace from search option if it contains any line breaks and handle triple+ slashes for file links.
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
use nom::branch::alt;
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::bytes::complete::take;
|
||||
use nom::bytes::complete::take_until;
|
||||
use nom::combinator::consumed;
|
||||
use nom::combinator::flat_map;
|
||||
use nom::combinator::map;
|
||||
use nom::combinator::map_parser;
|
||||
use nom::combinator::opt;
|
||||
use nom::combinator::peek;
|
||||
use nom::combinator::recognize;
|
||||
use nom::combinator::rest;
|
||||
use nom::combinator::verify;
|
||||
use nom::multi::many1_count;
|
||||
use nom::sequence::tuple;
|
||||
|
||||
use super::org_source::OrgSource;
|
||||
@@ -114,6 +118,10 @@ fn parse_file_angle_link<'b, 'g, 'r, 's>(
|
||||
)),
|
||||
|(_, application, _)| application,
|
||||
)(input)?;
|
||||
let (remaining, _) = opt(flat_map(
|
||||
peek(map(verify(many1_count(tag("/")), |c| *c >= 3), |c| c - 1)),
|
||||
take,
|
||||
))(remaining)?;
|
||||
let (remaining, path) = alt((take_until("::"), rest))(remaining)?;
|
||||
let (remaining, search_option) = opt(map(tuple((tag("::"), rest)), |(_, search_option)| {
|
||||
search_option
|
||||
|
||||
Reference in New Issue
Block a user