Function parse_hyperlinks::parser::restructured_text::rst_label2label
source · pub fn rst_label2label(i: &str) -> IResult<&str, (Cow<'_, str>, Cow<'_, str>)>
Expand description
Parse a reStructuredText link reference to link reference definition. This type defines an alias (alternative name) for a link reference:
use parse_hyperlinks::parser::Link;
use parse_hyperlinks::parser::restructured_text::rst_label2label;
use std::borrow::Cow;
assert_eq!(
rst_label2label(" .. _`alt label`: `label`_\nabc"),
Ok(("\nabc", (Cow::from("alt label"), Cow::from("label"))))
);
assert_eq!(
rst_label2label(" .. __: label_\nabc"),
Ok(("\nabc", (Cow::from("_"), Cow::from("label"))))
);
assert_eq!(
rst_label2label(" __ label_\nabc"),
Ok(("\nabc", (Cow::from("_"), Cow::from("label"))))
);