Function parse_hyperlinks::parser::restructured_text::rst_text2dest
source · pub fn rst_text2dest(
i: &str
) -> IResult<&str, (Cow<'_, str>, Cow<'_, str>, Cow<'_, str>)>
Expand description
Parse a RestructuredText inline hyperlink.
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_text2dest;
use std::borrow::Cow;
assert_eq!(
rst_text2dest("`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.