encre_css/plugins/layout/clear/
mod.rs1#![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: "start" | "end" | "left" | "right" | "both" | "none",
14 ..
15 }
16 )
17 }
18
19 fn handle(&self, context: &mut ContextHandle) {
20 if let Modifier::Builtin { value, .. } = context.modifier {
21 if *value == "start" {
22 context.buffer.line(format_args!("clear: inline-start;"));
23 } else if *value == "end" {
24 context.buffer.line(format_args!("clear: inline-end;"));
25 } else {
26 context.buffer.line(format_args!("clear: {value};"));
27 }
28 }
29 }
30}