summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-05-27 16:37:03 +0200
committerLaurenz <laurmaedje@gmail.com>2022-05-27 16:37:03 +0200
commit8ba11b0722599892499337b3272cec38945d11de (patch)
treec120a2449aaf325cb675ea3363ee69758a734d86
parentf8009b5b59660b8252bd3ee2cedfd234a1c30cb1 (diff)
Reword
-rw-r--r--src/frame.rs3
-rw-r--r--src/model/locate.rs8
2 files changed, 6 insertions, 5 deletions
diff --git a/src/frame.rs b/src/frame.rs
index 2ece5147..2a16b6f2 100644
--- a/src/frame.rs
+++ b/src/frame.rs
@@ -219,7 +219,8 @@ pub enum Element {
Image(ImageId, Size),
/// A link to an external resource and its trigger region.
Link(Destination, Size),
- /// A pin identified by index.
+ /// A pin identified by index. This is used to find elements on the pages
+ /// and use their location in formatting. Exporters can just ignore it.
Pin(usize),
}
diff --git a/src/model/locate.rs b/src/model/locate.rs
index c61facc5..97c14034 100644
--- a/src/model/locate.rs
+++ b/src/model/locate.rs
@@ -85,7 +85,7 @@ struct SingleNode(Spanned<Func>);
impl SingleNode {
fn realize(&self, ctx: &mut Context) -> TypResult<Content> {
let idx = ctx.pins.cursor();
- let pin = ctx.pins.next(None, None);
+ let pin = ctx.pins.get_or_create(None, None);
let dict = pin.encode(None);
let args = Args::new(self.0.span, [Value::Dict(dict)]);
Ok(Content::Pin(idx) + self.0.v.call_detached(ctx, args)?.display())
@@ -106,7 +106,7 @@ struct EntryNode {
impl EntryNode {
fn realize(&self, ctx: &mut Context) -> TypResult<Content> {
let idx = ctx.pins.cursor();
- let pin = ctx.pins.next(Some(self.group.clone()), self.value.clone());
+ let pin = ctx.pins.get_or_create(Some(self.group.clone()), self.value.clone());
// Determine the index among the peers.
let index = ctx
@@ -231,8 +231,8 @@ impl PinBoard {
self.list.len() - self.list.iter().zip(&prev.list).filter(|(a, b)| a == b).count()
}
- /// Access the next pin.
- fn next(&mut self, group: Option<Group>, value: Option<Value>) -> Pin {
+ /// Access or create the next pin.
+ fn get_or_create(&mut self, group: Option<Group>, value: Option<Value>) -> Pin {
if self.frozen() {
return Pin::default();
}