mirror of
https://github.com/typst/typst
synced 2025-05-13 20:46:23 +08:00
change page numbering for outline (#284)
This commit is contained in:
parent
766d1be72b
commit
6545620891
@ -1,4 +1,4 @@
|
|||||||
use super::{Counter, HeadingElem, LocalName};
|
use super::{Counter, CounterKey, HeadingElem, LocalName};
|
||||||
use crate::layout::{BoxElem, HElem, HideElem, ParbreakElem, RepeatElem};
|
use crate::layout::{BoxElem, HElem, HideElem, ParbreakElem, RepeatElem};
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use crate::text::{LinebreakElem, SpaceElem, TextElem};
|
use crate::text::{LinebreakElem, SpaceElem, TextElem};
|
||||||
@ -160,7 +160,10 @@ impl Show for OutlineElem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add the page number and linebreak.
|
// Add the page number and linebreak.
|
||||||
let page = vt.introspector.page(location);
|
let page = Counter::new(CounterKey::Page)
|
||||||
|
// query the page counter state at location of heading
|
||||||
|
.at(vt, location)?
|
||||||
|
.first();
|
||||||
let end = TextElem::packed(eco_format!("{page}"));
|
let end = TextElem::packed(eco_format!("{page}"));
|
||||||
seq.push(end.linked(Destination::Location(location)));
|
seq.push(end.linked(Destination::Location(location)));
|
||||||
seq.push(LinebreakElem::new().pack());
|
seq.push(LinebreakElem::new().pack());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user