developer. open to conversation and working on projects together. email me @ [email protected] and lets talk.
chief technical officer of thriftedd.
HTML nodes in Rust.
Home Page: https://docs.rs/html-node
License: MIT License
Really minor enhancement I think.
So I have decided Hyperscript is a good idea. Upon using it with html-node, it actually works great, except the html generated keeps newlines, useless space characters, and I suppose tabs if I was using them. Ultimately, my html is tidy when it is sent off by the server, except for the formatting I've entered in the attribute string.
This isn't a particularly huge deal. A few spaces never killed anyone. It's more like I see it and my brain says no.
Attributes have not had formatted code placed into them in the past, so this wasn't really a thing.
So something like this:
<button _="on click set :dialog to the closest <dialog/>
then set :video to the next <video/>
then repeat in :video.srcObject.getTracks()
call it.stop()
end
then send reset to the next <canvas/>
then call :dialog.close()">
That will be sent over the wire with the formatting.
impl Display for Element {
/// Format as an HTML element.
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "<{}", self.name)?;
for (key, value) in &self.attributes {
write!(f, " {key}")?;
if let Some(value) = value {
let encoded_value = html_escape::encode_double_quoted_attribute(value);
write!(f, r#"="{encoded_value}""#)?;
}
}
write!(f, ">")?;
if let Some(children) = &self.children {
write_children(f, children, false)?;
write!(f, "</{}>", self.name)?;
};
Ok(())
}
}
Looks like this piece of code here one could just add something which removes this type of whitespace from the value
variable before passing it to encode_double_quoted_attribute
. Specifically, replace all newlines + zero or more spaces + zero or more tabs with one space. Something like that. That assumes I'm even looking in the right spot.
I'm willing to implement this myself. Feedback?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.