Compare commits
7 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 01d9e06d63 | |||
| d26ef729eb | |||
| f08eda2758 | |||
| 190e00ed62 | |||
| bb7dedc9eb | |||
| 59b81d637b | |||
| ec7a461758 |
8 changed files with 37 additions and 24 deletions
|
|
@ -17,6 +17,13 @@ A dependency update to an incompatible version is considered a breaking change.
|
|||
|
||||
## Unreleased
|
||||
|
||||
## v0.2.0 - 2025-01-01
|
||||
|
||||
### Changed
|
||||
|
||||
- **(breaking)** Updated `axum-core` dependency to `0.5.0`
|
||||
- Relaxed lower bound on `http` dependency to `1.0.0`
|
||||
|
||||
## v0.1.3 - 2024-12-21
|
||||
|
||||
### Added
|
||||
|
|
|
|||
20
Cargo.toml
20
Cargo.toml
|
|
@ -1,10 +1,10 @@
|
|||
[package]
|
||||
name = "el"
|
||||
version = "0.1.3"
|
||||
edition = "2021"
|
||||
version = "0.2.0"
|
||||
edition = "2024"
|
||||
authors = ["Garmelon <garmelon@plugh.de>"]
|
||||
description = "Write and manipulate HTML elements as data"
|
||||
repository = "https://github.com/Garmelon/el"
|
||||
repository = "https://git.plugh.de/Garmelon/el"
|
||||
license = "MIT OR Apache-2.0"
|
||||
keywords = ["html", "svg", "mathml", "hiccup"]
|
||||
categories = ["web-programming", "template-engine"]
|
||||
|
|
@ -13,16 +13,18 @@ categories = ["web-programming", "template-engine"]
|
|||
axum = ["dep:axum-core", "dep:http"]
|
||||
|
||||
[dependencies]
|
||||
axum-core = { version = "0.4.5", optional = true }
|
||||
http = { version = "1.1.0", optional = true }
|
||||
axum-core = { version = "0.5.0", optional = true }
|
||||
http = { version = "1.0.0", optional = true }
|
||||
|
||||
[lints]
|
||||
rust.unsafe_code = { level = "forbid", priority = 1 }
|
||||
# Lint groups
|
||||
rust.deprecated_safe = "warn"
|
||||
rust.future_incompatible = "warn"
|
||||
rust.keyword_idents = "warn"
|
||||
rust.rust_2018_idioms = "warn"
|
||||
rust.deprecated-safe = "warn"
|
||||
rust.future-incompatible = "warn"
|
||||
rust.keyword-idents = "warn"
|
||||
rust.nonstandard-style = "warn"
|
||||
rust.refining-impl-trait = "warn"
|
||||
rust.rust-2018-idioms = "warn"
|
||||
rust.unused = "warn"
|
||||
# Individual lints
|
||||
rust.let_underscore_drop = "warn"
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ See the top-level crate documentation for more info.
|
|||
|
||||
## But what about that small helper function?
|
||||
|
||||
Here it is in full, for posteriority:
|
||||
Here it is in full, for posterity:
|
||||
|
||||
```js
|
||||
function el(name, attributes, ...children) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use axum_core::response::IntoResponse;
|
||||
use http::{header, HeaderValue, StatusCode};
|
||||
use http::{HeaderValue, StatusCode, header};
|
||||
|
||||
use crate::{Document, Render};
|
||||
|
||||
|
|
|
|||
|
|
@ -58,10 +58,9 @@ pub fn is_valid_raw_text(tag_name: &str, text: &str) -> bool {
|
|||
// "[...] followed by characters that case-insensitively match the tag
|
||||
// name of the element [...]"
|
||||
//
|
||||
// Note: Since we know that tag names are ascii-only, we can convert
|
||||
// both to lowercase for a case-insensitive comparison without weird
|
||||
// unicode shenanigans.
|
||||
if potential_tag_name.to_ascii_lowercase() != tag_name.to_ascii_lowercase() {
|
||||
// Note: Since we know that tag names are ascii-only, we can use an
|
||||
// ASCII-based case insensitive comparison without unicode shenanigans.
|
||||
if !potential_tag_name.eq_ignore_ascii_case(tag_name) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use std::collections::{btree_map::Entry, BTreeMap, HashMap};
|
||||
use std::collections::{BTreeMap, HashMap, btree_map::Entry};
|
||||
|
||||
/// The kind of an element.
|
||||
///
|
||||
|
|
@ -501,8 +501,12 @@ element_component_tuple!(C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11);
|
|||
element_component_tuple!(C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12);
|
||||
element_component_tuple!(C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13);
|
||||
element_component_tuple!(C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14);
|
||||
element_component_tuple!(C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15);
|
||||
element_component_tuple!(C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15, C16);
|
||||
element_component_tuple!(
|
||||
C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15
|
||||
);
|
||||
element_component_tuple!(
|
||||
C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15, C16
|
||||
);
|
||||
|
||||
/// A full HTML document including doctype.
|
||||
///
|
||||
|
|
|
|||
10
src/lib.rs
10
src/lib.rs
|
|
@ -84,7 +84,7 @@ pub use self::{element::*, render::*};
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{html::*, Attr, Content, Element, Render};
|
||||
use crate::{Attr, Content, Element, Render, html::*};
|
||||
|
||||
#[test]
|
||||
fn simple_website() {
|
||||
|
|
@ -130,9 +130,11 @@ mod tests {
|
|||
|
||||
assert!(script("hello </script> world").render_to_string().is_err());
|
||||
|
||||
assert!(script("hello </ScRiPt ... world")
|
||||
.render_to_string()
|
||||
.is_err());
|
||||
assert!(
|
||||
script("hello </ScRiPt ... world")
|
||||
.render_to_string()
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
use std::{error, fmt};
|
||||
|
||||
use crate::{
|
||||
check,
|
||||
Document, check,
|
||||
element::{Content, Element, ElementKind},
|
||||
Document,
|
||||
};
|
||||
|
||||
/// The cause of an [`Error`].
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue