From: Andrea Zagli Date: Sat, 7 Oct 2023 12:25:26 +0000 (+0200) Subject: c2rs: missing semicolons in generated code. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=0a763d252292eca758597f627d908c93460edb9b;p=rust%2Fzakform c2rs: missing semicolons in generated code. --- diff --git a/src/bin/c2rs.rs b/src/bin/c2rs.rs index 9f2f3fa..5d05356 100644 --- a/src/bin/c2rs.rs +++ b/src/bin/c2rs.rs @@ -6,7 +6,6 @@ use std::{ }; use quick_xml::de::from_str; -use serde::Deserialize; use serde_derive::Deserialize; use clap::Parser; @@ -56,7 +55,6 @@ pub struct ZakFormElement { #[serde(rename = "to-save")] pub to_save: String, pub accept: String, - pub inline: String, #[serde(rename = "option")] pub options: Vec, @@ -168,15 +166,19 @@ fn main() { if let Some(l) = e.label { if l != "" { - writeln!(output, r#"fi.set_label("{}")"#, l); + writeln!(output, r#"fi.set_label("{}");"#, l); } } + if e.default_value != "" { + writeln!(output, r#"fi.set_value("{}");"#, e.default_value); + } + if e.max_length > 0 { - writeln!(output, "fi.set_maxlen({})", e.max_length); + writeln!(output, "fi.set_maxlen({});", e.max_length); } if e.rows > 0 { - writeln!(output, "fi.set_rows({})", e.rows); + writeln!(output, "fi.set_rows({});", e.rows); } match e.format { @@ -187,10 +189,10 @@ fn main() { }; if e.placeholder != "" { - writeln!(output, r#"fi.set_placeholder("{}")"#, e.placeholder); + writeln!(output, r#"fi.set_placeholder("{}");"#, e.placeholder); } if e.class != "" { - writeln!(output, r#"fi.set_class("{}")"#, e.class); + writeln!(output, r#"fi.set_class("{}");"#, e.class); } for option in e.options { @@ -207,22 +209,22 @@ fn main() { } if e.editable == "FALSE" { - writeln!(output, "fi.set_disabled(true)"); + writeln!(output, "fi.set_disabled(true);"); } if e.to_load == "FALSE" { - writeln!(output, "fi.set_to_load(false)"); + writeln!(output, "fi.set_to_load(false);"); } if e.to_save == "FALSE" { - writeln!(output, "fi.set_to_save(false)"); + writeln!(output, "fi.set_to_save(false);"); } - if e.inline == "TRUE" { - writeln!(output, "fi.set_inline(true)"); + if e.zakcgi_inline == "TRUE" { + writeln!(output, "fi.set_inline(true);"); } if e.accept != "" { - writeln!(output, r#"fi.set_accept("{}")"#, e.accept); + writeln!(output, r#"fi.set_accept("{}");"#, e.accept); } for filter in e.filters { @@ -236,7 +238,8 @@ fn main() { _ => { }, }; }, - } + _ => { }, + }; } for validator in e.validators {