encre_css/plugins/
css_property.rs1use crate::prelude::build_plugin::*;
5
6#[derive(Debug)]
7pub(crate) struct CssPropertyPlugin;
8
9impl Plugin for CssPropertyPlugin {
10    fn can_handle(&self, _context: ContextCanHandle) -> bool {
11        unreachable!();
13    }
14
15    fn handle(&self, context: &mut ContextHandle) {
16        match context.modifier {
17            Modifier::Builtin { .. } => unreachable!(),
18            Modifier::Arbitrary { value, .. } => {
19                for line in value.lines() {
20                    if let Some((prop, value)) = line.split_once(':') {
21                        context.buffer.line(format_args!("{prop}: {value};"));
22                    }
23                }
24            }
25        }
26    }
27}