[][src]Function parse_hyperlinks::parser::restructured_text::rst_link

pub fn rst_link(i: &str) -> IResult<&str, (String, String)>

Parse a RestructuredText hyperlink. The parser expects to start at the link start (`) to succeed.

use parse_hyperlinks::parser::restructured_text::rst_link;
assert_eq!(
  rst_link("`name <destination>`_abc"),
  Ok(("abc", ("name".to_string(), "destination".to_string())))
);

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. For more details see the reStructuredText Markup Specification It returns either Ok((i, (link_name, link_destination))) or some error.