summaryrefslogtreecommitdiff
path: root/library/src/shared/ext.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-05-20 21:36:24 +0200
committerLaurenz <laurmaedje@gmail.com>2023-05-20 21:36:24 +0200
commit1321862cd54eb4abefb5d435285e3de9e0848c4c (patch)
tree904d04546da0a17dbf0fe96790c0a9c2f6393141 /library/src/shared/ext.rs
parent35b883cfd9e6acfcaee1a98bf2bdd4f6c5de5fbf (diff)
Footnotes
Diffstat (limited to 'library/src/shared/ext.rs')
-rw-r--r--library/src/shared/ext.rs11
1 files changed, 11 insertions, 0 deletions
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<Option<GenAlign>>) -> 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<Option<GenAlign>>) -> Self {
self.styled(AlignElem::set_alignment(aligns))
}