diff options
author | tempest <git@ashen.earth> | 2025-06-17 00:13:27 -0600 |
---|---|---|
committer | tempest <git@ashen.earth> | 2025-06-17 00:13:27 -0600 |
commit | 6364b044811beee2c63445c5ace7b9d6bf63f16e (patch) | |
tree | 79017008da12365be50c47062c9c7c3914cb7bf8 /src/render.rs | |
parent | 289ebcf15b99637ad3647276f0dc7ec602501b4c (diff) |
Allow attributes to have -
Diffstat (limited to 'src/render.rs')
-rw-r--r-- | src/render.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/render.rs b/src/render.rs index 7edcd9e..73e1a5e 100644 --- a/src/render.rs +++ b/src/render.rs @@ -62,9 +62,14 @@ impl RenderNode { }, RenderNode::Element { name, attributes, children } => { - let text_attributes = attributes.into_iter() - .map(|(key, value)| format!(" {key}=\"{value}\"")) - .collect::<Vec<_>>().join(""); + let text_attributes = attributes + .into_iter() + .map(|(key, value)| { + let corrected_key = key.replace("_", "-"); + format!(" {corrected_key}=\"{value}\"") + }) + .collect::<Vec<_>>() + .join(""); Box::pin(async move { let rendered_children = join_all(children.into_iter() |