summaryrefslogtreecommitdiff
path: root/src/library/container.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-01-17 16:01:01 +0100
committerLaurenz <laurmaedje@gmail.com>2022-01-17 16:01:01 +0100
commit0c5243fa802d8133d75c0823c3efa6f14794ba60 (patch)
treee8554c25aa9d5c3ec33c9b4d6de56f1c97d30eff /src/library/container.rs
parent4abdafcd158ab15d9d2ae18553067578ae559d33 (diff)
Basic tables
Diffstat (limited to 'src/library/container.rs')
-rw-r--r--src/library/container.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/library/container.rs b/src/library/container.rs
new file mode 100644
index 00000000..ae097a46
--- /dev/null
+++ b/src/library/container.rs
@@ -0,0 +1,26 @@
+//! Inline- and block-level containers.
+
+use super::prelude::*;
+
+/// Size content and place it into a paragraph.
+pub struct BoxNode;
+
+#[class]
+impl BoxNode {
+ fn construct(_: &mut EvalContext, args: &mut Args) -> TypResult<Node> {
+ let width = args.named("width")?;
+ let height = args.named("height")?;
+ let body: PackedNode = args.find().unwrap_or_default();
+ Ok(Node::inline(body.sized(Spec::new(width, height))))
+ }
+}
+
+/// Place content into a separate flow.
+pub struct BlockNode;
+
+#[class]
+impl BlockNode {
+ fn construct(_: &mut EvalContext, args: &mut Args) -> TypResult<Node> {
+ Ok(Node::Block(args.find().unwrap_or_default()))
+ }
+}