encre_css/plugins/layout/break_before/
mod.rs

1#![doc = include_str!("README.md")]
2#![doc(alias = "layout")]
3use crate::prelude::build_plugin::*;
4
5#[derive(Debug)]
6pub(crate) struct PluginDefinition;
7
8impl Plugin for PluginDefinition {
9    fn can_handle(&self, context: ContextCanHandle) -> bool {
10        matches!(
11            context.modifier,
12            Modifier::Builtin {
13                value: "auto"
14                    | "avoid"
15                    | "all"
16                    | "avoid-page"
17                    | "page"
18                    | "left"
19                    | "right"
20                    | "column",
21                ..
22            }
23        )
24    }
25
26    fn handle(&self, context: &mut ContextHandle) {
27        if let Modifier::Builtin { value, .. } = context.modifier {
28            context.buffer.line(format_args!("break-before: {value};"));
29        }
30    }
31}