summaryrefslogtreecommitdiff
path: root/src/library/layout
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/layout')
-rw-r--r--src/library/layout/container.rs4
-rw-r--r--src/library/layout/pad.rs2
-rw-r--r--src/library/layout/page.rs15
3 files changed, 4 insertions, 17 deletions
diff --git a/src/library/layout/container.rs b/src/library/layout/container.rs
index 6689dd48..5264f258 100644
--- a/src/library/layout/container.rs
+++ b/src/library/layout/container.rs
@@ -8,7 +8,7 @@ impl BoxNode {
fn construct(_: &mut Context, args: &mut Args) -> TypResult<Content> {
let width = args.named("width")?;
let height = args.named("height")?;
- let body: LayoutNode = args.find()?.unwrap_or_default();
+ let body: LayoutNode = args.eat()?.unwrap_or_default();
Ok(Content::inline(body.sized(Spec::new(width, height))))
}
}
@@ -19,6 +19,6 @@ pub struct BlockNode;
#[node]
impl BlockNode {
fn construct(_: &mut Context, args: &mut Args) -> TypResult<Content> {
- Ok(Content::Block(args.find()?.unwrap_or_default()))
+ Ok(Content::Block(args.eat()?.unwrap_or_default()))
}
}
diff --git a/src/library/layout/pad.rs b/src/library/layout/pad.rs
index 2be21bcb..aff0e8b0 100644
--- a/src/library/layout/pad.rs
+++ b/src/library/layout/pad.rs
@@ -12,7 +12,7 @@ pub struct PadNode {
#[node]
impl PadNode {
fn construct(_: &mut Context, args: &mut Args) -> TypResult<Content> {
- let all = args.find()?;
+ let all = args.named("rest")?.or(args.find()?);
let x = args.named("x")?;
let y = args.named("y")?;
let left = args.named("left")?.or(x).or(all).unwrap_or_default();
diff --git a/src/library/layout/page.rs b/src/library/layout/page.rs
index c8495e64..324ac285 100644
--- a/src/library/layout/page.rs
+++ b/src/library/layout/page.rs
@@ -39,24 +39,11 @@ impl PageNode {
Ok(Content::Page(Self(args.expect("body")?)))
}
- fn set(args: &mut Args) -> TypResult<StyleMap> {
- let mut styles = StyleMap::new();
-
+ fn set(...) {
if let Some(paper) = args.named_or_find::<Paper>("paper")? {
styles.set(Self::WIDTH, Smart::Custom(paper.width().into()));
styles.set(Self::HEIGHT, Smart::Custom(paper.height().into()));
}
-
- styles.set_opt(Self::WIDTH, args.named("width")?);
- styles.set_opt(Self::HEIGHT, args.named("height")?);
- styles.set_opt(Self::MARGINS, args.named("margins")?);
- styles.set_opt(Self::FLIPPED, args.named("flipped")?);
- styles.set_opt(Self::FILL, args.named("fill")?);
- styles.set_opt(Self::COLUMNS, args.named("columns")?);
- styles.set_opt(Self::HEADER, args.named("header")?);
- styles.set_opt(Self::FOOTER, args.named("footer")?);
-
- Ok(styles)
}
}