From 54a79fab657c09fd0ee0224639aa5822ee281456 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Jun 2025 05:28:28 +0000 Subject: [PATCH 1/4] Initial plan for issue From 9fa119204e8a146fb726d6af701f8a9780e531ce Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Jun 2025 05:32:17 +0000 Subject: [PATCH 2/4] Initial analysis and setup for fixing empty lines issue Co-authored-by: JonasLoos <33965649+JonasLoos@users.noreply.github.com> --- nicehtml_transpiler/Cargo.lock | 34 ++++++++++++++++++++++------------ nicehtml_transpiler/Cargo.toml | 2 +- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/nicehtml_transpiler/Cargo.lock b/nicehtml_transpiler/Cargo.lock index 676b9f9..fe538d7 100644 --- a/nicehtml_transpiler/Cargo.lock +++ b/nicehtml_transpiler/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "block-buffer" @@ -173,6 +173,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rustversion" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" + [[package]] name = "sha2" version = "0.10.7" @@ -241,23 +247,24 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", + "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", "syn", @@ -266,9 +273,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -276,9 +283,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", @@ -289,9 +296,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] name = "web-sys" diff --git a/nicehtml_transpiler/Cargo.toml b/nicehtml_transpiler/Cargo.toml index 816274e..5931fe8 100644 --- a/nicehtml_transpiler/Cargo.toml +++ b/nicehtml_transpiler/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2" +wasm-bindgen = "0.2.88" js-sys = "0.3" console_error_panic_hook = "0.1.6" pest = "2.7" From b22708116d216cf41d0ba3b3424047bb9e33006e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Jun 2025 05:41:07 +0000 Subject: [PATCH 3/4] Fix empty lines issue in grammar Co-authored-by: JonasLoos <33965649+JonasLoos@users.noreply.github.com> --- nicehtml_transpiler/src/grammar.pest | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nicehtml_transpiler/src/grammar.pest b/nicehtml_transpiler/src/grammar.pest index 97fb4da..ddc9f3e 100644 --- a/nicehtml_transpiler/src/grammar.pest +++ b/nicehtml_transpiler/src/grammar.pest @@ -22,7 +22,8 @@ variable = { "$" ~ identifier ~ ("(" ~ w ~ parameter ~ (w ~ "," ~ w ~ parameter) content = _{ definition | element | variable | multiline_string | string_line | comment | (" " | "\t")* } first_line = _{ content } -later_line = _{ PEEK_ALL ~ content } +empty_line = _{ !(!("\n") ~ ANY) } +later_line = _{ PEEK_ALL ~ content | empty_line } lines = _{ first_line ~ ("\n" ~ later_line)* } indentation = _{ (" " | "\t")+ } From 8c0ca0322d3c071b5839ab8280dd48ff94f6bd28 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Jun 2025 06:15:03 +0000 Subject: [PATCH 4/4] Revert Cargo.toml changes and improve empty line handling in grammar Co-authored-by: JonasLoos <33965649+JonasLoos@users.noreply.github.com> --- nicehtml_transpiler/Cargo.lock | 34 ++++++++++------------------ nicehtml_transpiler/Cargo.toml | 2 +- nicehtml_transpiler/src/grammar.pest | 2 +- 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/nicehtml_transpiler/Cargo.lock b/nicehtml_transpiler/Cargo.lock index fe538d7..676b9f9 100644 --- a/nicehtml_transpiler/Cargo.lock +++ b/nicehtml_transpiler/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 4 +version = 3 [[package]] name = "block-buffer" @@ -173,12 +173,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rustversion" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" - [[package]] name = "sha2" version = "0.10.7" @@ -247,24 +241,23 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "wasm-bindgen" -version = "0.2.100" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", - "once_cell", - "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.100" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", + "once_cell", "proc-macro2", "quote", "syn", @@ -273,9 +266,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.100" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -283,9 +276,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.100" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", @@ -296,12 +289,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.100" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" -dependencies = [ - "unicode-ident", -] +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "web-sys" diff --git a/nicehtml_transpiler/Cargo.toml b/nicehtml_transpiler/Cargo.toml index 5931fe8..816274e 100644 --- a/nicehtml_transpiler/Cargo.toml +++ b/nicehtml_transpiler/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -wasm-bindgen = "0.2.88" +wasm-bindgen = "0.2" js-sys = "0.3" console_error_panic_hook = "0.1.6" pest = "2.7" diff --git a/nicehtml_transpiler/src/grammar.pest b/nicehtml_transpiler/src/grammar.pest index ddc9f3e..cfb8723 100644 --- a/nicehtml_transpiler/src/grammar.pest +++ b/nicehtml_transpiler/src/grammar.pest @@ -22,7 +22,7 @@ variable = { "$" ~ identifier ~ ("(" ~ w ~ parameter ~ (w ~ "," ~ w ~ parameter) content = _{ definition | element | variable | multiline_string | string_line | comment | (" " | "\t")* } first_line = _{ content } -empty_line = _{ !(!("\n") ~ ANY) } +empty_line = _{ (" " | "\t")* } later_line = _{ PEEK_ALL ~ content | empty_line } lines = _{ first_line ~ ("\n" ~ later_line)* }