on master help sign in
Add padding-top, padding-bottom, padding-left, padding-right attributes
commit48c90a761e0ea06fea4b0fc18db7687c39ef3a1f authoriko <mail@iko.soy> dateSat 25 Apr 2026, 16:20 (5 months ago) parentc3d40c1
3 files changed+53−4
crates/htmlang-core/src/codegen.rs+20 crates/htmlang-core/src/parser.rs+8 src/main.rs+25−4
crates/htmlang-core/src/codegen.rs+20
@@ -2661,6 +2661,26 @@ fn attrs_to_css(
26612661 push_css(&mut css, "padding-block", &css_px(v));
26622662 }
26632663 }
2664+ "padding-top" => {
2665+ if let Some(v) = val {
2666+ push_css(&mut css, "padding-top", &css_px(v));
2667+ }
2668+ }
2669+ "padding-bottom" => {
2670+ if let Some(v) = val {
2671+ push_css(&mut css, "padding-bottom", &css_px(v));
2672+ }
2673+ }
2674+ "padding-left" => {
2675+ if let Some(v) = val {
2676+ push_css(&mut css, "padding-left", &css_px(v));
2677+ }
2678+ }
2679+ "padding-right" => {
2680+ if let Some(v) = val {
2681+ push_css(&mut css, "padding-right", &css_px(v));
2682+ }
2683+ }
26642684
26652685 // Sizing
26662686 "width" => {
crates/htmlang-core/src/parser.rs+8
@@ -3688,6 +3688,10 @@ const KNOWN_ATTRS: &[&str] = &[
36883688 "padding",
36893689 "padding-x",
36903690 "padding-y",
3691+ "padding-top",
3692+ "padding-bottom",
3693+ "padding-left",
3694+ "padding-right",
36913695 "width",
36923696 "height",
36933697 "min-width",
@@ -4017,6 +4021,10 @@ const NUMERIC_ATTRS: &[&str] = &[
40174021 "padding",
40184022 "padding-x",
40194023 "padding-y",
4024+ "padding-top",
4025+ "padding-bottom",
4026+ "padding-left",
4027+ "padding-right",
40204028 "min-width",
40214029 "max-width",
40224030 "min-height",
src/main.rs+25−4
@@ -290,15 +290,29 @@ fn base64_encode(data: &[u8]) -> String {
290290}
291291
292292fn copy_non_hl_files(src_dir: &Path, out_dir: &Path) {
293− copy_non_hl_recursive(src_dir, src_dir, out_dir);
293+ let skip = out_dir.canonicalize().ok();
294+ copy_non_hl_recursive(src_dir, src_dir, out_dir, skip.as_deref());
294295}
295296
296−fn copy_non_hl_recursive(base: &Path, dir: &Path, out_dir: &Path) {
297+fn copy_non_hl_recursive(base: &Path, dir: &Path, out_dir: &Path, skip_canonical: Option<&Path>) {
297298 if let Ok(entries) = fs::read_dir(dir) {
298299 for entry in entries.flatten() {
299300 let path = entry.path();
300301 if path.is_dir() {
301− copy_non_hl_recursive(base, &path, out_dir);
302+ // Skip hidden directories (.htmlang-cache, .git, etc.)
303+ if path
304+ .file_name()
305+ .is_some_and(|n| n.to_str().is_some_and(|s| s.starts_with('.')))
306+ {
307+ continue;
308+ }
309+ // Skip the output directory to avoid copying it into itself
310+ if let Some(skip) = skip_canonical {
311+ if path.canonicalize().ok().as_deref() == Some(skip) {
312+ continue;
313+ }
314+ }
315+ copy_non_hl_recursive(base, &path, out_dir, skip_canonical);
302316 } else if path.is_file() && path.extension().is_none_or(|e| e != "hl") {
303317 let rel = path.strip_prefix(base).unwrap_or(&path);
304318 let dest = out_dir.join(rel);
@@ -518,6 +532,13 @@ fn collect_hl_recursive_inner(dir: &Path, files: &mut Vec<PathBuf>) {
518532 for entry in entries.flatten() {
519533 let path = entry.path();
520534 if path.is_dir() {
535+ // Skip hidden directories (.htmlang-cache, .git, etc.)
536+ if path
537+ .file_name()
538+ .is_some_and(|n| n.to_str().is_some_and(|s| s.starts_with('.')))
539+ {
540+ continue;
541+ }
521542 collect_hl_recursive_inner(&path, files);
522543 } else if path.is_file() && path.extension().is_some_and(|e| e == "hl") {
523544 files.push(path);
@@ -1220,7 +1241,7 @@ fn main() {
12201241 let build_minify = build_minify || config.minify.unwrap_or(false);
12211242 let build_compat = build_compat || config.compat.unwrap_or(false);
12221243 let build_strict = build_strict || config.strict.unwrap_or(false);
1223− let out_dir = out_dir.or(config.output.as_deref());
1244+ let out_dir = out_dir.or(config.output.as_deref()).or(Some("out"));
12241245 let hl_files = collect_hl_files_recursive(dir);
12251246 if hl_files.is_empty() {
12261247 eprintln!("no .hl files found in {}", src);