From 1321862cd54eb4abefb5d435285e3de9e0848c4c Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 20 May 2023 21:36:24 +0200 Subject: Footnotes --- library/src/shared/ext.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'library/src/shared') diff --git a/library/src/shared/ext.rs b/library/src/shared/ext.rs index 72a82749..d7c80a30 100644 --- a/library/src/shared/ext.rs +++ b/library/src/shared/ext.rs @@ -18,6 +18,11 @@ pub trait ContentExt { /// Link the content somewhere. fn linked(self, dest: Destination) -> Self; + /// Make the content linkable by `.linked(Destination::Location(loc))`. + /// + /// Should be used in combination with [`Location::variant`]. + fn backlinked(self, loc: Location) -> Self; + /// Set alignments for this content. fn aligned(self, aligns: Axes>) -> Self; @@ -45,6 +50,12 @@ impl ContentExt for Content { self.styled(MetaElem::set_data(vec![Meta::Link(dest)])) } + fn backlinked(self, loc: Location) -> Self { + let mut backlink = Content::empty(); + backlink.set_location(loc); + self.styled(MetaElem::set_data(vec![Meta::Elem(backlink)])) + } + fn aligned(self, aligns: Axes>) -> Self { self.styled(AlignElem::set_alignment(aligns)) } -- cgit v1.2.3