Function parse_hyperlinks::parser::restructured_text::rst_text_label2dest
source · pub fn rst_text_label2dest(
i: &str
) -> IResult<&str, (Cow<'_, str>, Cow<'_, str>, Cow<'_, str>)>
Expand description
Parse a RestructuredText combined inline hyperlink with link reference definition.
The parser expects to start at the link start (`) to succeed.
As rst does not know about link titles,
the parser always returns an empty link_title
as Cow::Borrowed("")
.
use parse_hyperlinks::parser::Link;
use parse_hyperlinks::parser::restructured_text::rst_text_label2dest;
use std::borrow::Cow;
assert_eq!(
rst_text_label2dest("`name <destination>`_abc"),
Ok(("abc", (Cow::from("name"), Cow::from("destination"), Cow::from(""))))
);
A hyperlink reference may directly embed a destination URI or (since Docutils
0.11) a hyperlink reference within angle brackets <>
as shown in the
following example:
abc `Python home page <http://www.python.org>`_ abc
The bracketed URI must be preceded by whitespace and be the last text before the end string.