fixup! parser: impl link references

This commit is contained in:
Noah Hellman 2023-01-28 11:20:04 +01:00
parent 56190c4b0d
commit 726f1bc7b0

View file

@ -368,25 +368,17 @@ impl<'s> Parser<'s> {
SpanLinkType::Inline, SpanLinkType::Inline,
), ),
inline::Container::ReferenceLink => Container::Link( inline::Container::ReferenceLink => Container::Link(
if let Some(url) = self self.link_definitions
.link_definitions
.get(self.inlines.src(inline.span).as_ref()) .get(self.inlines.src(inline.span).as_ref())
{ .cloned()
url.clone() .unwrap_or_else(|| "".into()),
} else {
"".into()
},
LinkType::Span(SpanLinkType::Reference), LinkType::Span(SpanLinkType::Reference),
), ),
inline::Container::ReferenceImage => Container::Image( inline::Container::ReferenceImage => Container::Image(
if let Some(url) = self self.link_definitions
.link_definitions
.get(self.inlines.src(inline.span).as_ref()) .get(self.inlines.src(inline.span).as_ref())
{ .cloned()
url.clone() .unwrap_or_else(|| "".into()),
} else {
"".into()
},
SpanLinkType::Reference, SpanLinkType::Reference,
), ),
inline::Container::Autolink => todo!("{:?}", c), inline::Container::Autolink => todo!("{:?}", c),