diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-06-09 13:45:36 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-06-09 13:45:36 +0200 |
| commit | 6aff11057bc88257c9383137952bb41b5b85c3dc (patch) | |
| tree | 45545207da5045060a127426ed5c4e4958de71bf /src/frame.rs | |
| parent | cd5a14bc240b21f8f538ff7fc1d116d23611d6c5 (diff) | |
Non-outlined headings
Diffstat (limited to 'src/frame.rs')
| -rw-r--r-- | src/frame.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/frame.rs b/src/frame.rs index 7972b069..934c3f22 100644 --- a/src/frame.rs +++ b/src/frame.rs @@ -1,6 +1,7 @@ //! Finished layouts. use std::fmt::{self, Debug, Formatter, Write}; +use std::num::NonZeroUsize; use std::sync::Arc; use crate::eval::{Dict, Value}; @@ -71,7 +72,7 @@ impl Frame { /// group based on the number of elements in the frame. pub fn push_frame(&mut self, pos: Point, frame: impl FrameRepr) { if (self.elements.is_empty() || frame.as_ref().is_light()) - && frame.as_ref().role().is_none() + && frame.as_ref().role().map_or(true, Role::is_weak) { frame.inline(self, self.layer(), pos); } else { @@ -95,7 +96,7 @@ impl Frame { /// Add a frame at a position in the background. pub fn prepend_frame(&mut self, pos: Point, frame: impl FrameRepr) { if (self.elements.is_empty() || frame.as_ref().is_light()) - && frame.as_ref().role().is_none() + && frame.as_ref().role().map_or(true, Role::is_weak) { frame.inline(self, 0, pos); } else { @@ -412,8 +413,8 @@ impl Location { pub enum Role { /// A paragraph. Paragraph, - /// A heading with some level. - Heading(usize), + /// A heading with some level and whether it should be part of the outline. + Heading { level: NonZeroUsize, outlined: bool }, /// A generic block-level subdivision. GenericBlock, /// A generic inline subdivision. |
