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

pub fn rst_link_ref(
    i: &str
) -> IResult<&str, (Cow<'_, str>, Cow<'_, str>, Cow<'_, str>)>

Parse a RestructuredText link reference definition. It returns either Ok((i, (link_label, link_destination, link_title))) or some error.

This parser always returns an empty link_title as Cow::Borrowed("").

use parse_hyperlinks::parser::restructured_text::rst_link_ref;
use std::borrow::Cow;

assert_eq!(
  rst_link_ref("   .. _`label`: destination\nabc"),
  Ok(("\nabc", (Cow::from("label"), Cow::from("destination"), Cow::from(""))))
);

Here some examples for link references:

.. _Python home page: http://www.python.org
.. _`Python: home page`: http://www.python.org

See unit test test_rst_link_ref() for more examples.