Skip to content

Commit

Permalink
[#43] Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Orchaldir committed Oct 28, 2023
1 parent 5325c64 commit 10648ee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions macro_ui/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ pub fn parse_struct_field(field: &Field) -> TokenStream2 {
} else if is_option(field) {
let option_type = &get_option_type(field);
quote! {
#field_name: if parser.parse_bool(&format!("{}.{}.available", path, stringify!(#field_name))) {
Some(#option_type::parse(parser, &format!("{}.{}.value", path, stringify!(#field_name)), &format!(" {}", spaces)))
#field_name: if parser.get_str(&format!("{}.{}", path, stringify!(#field_name))).is_some() {
Some(#option_type::parse(parser, &format!("{}.{}", path, stringify!(#field_name)), &format!(" {}", spaces)))
} else {
Option::None
},
Expand Down
4 changes: 1 addition & 3 deletions rpg_tools_core/src/ui/viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,14 @@ impl UiVisitor for ViewerVisitor {
self.lines
.push(format!("{}<b>{}</b>", self.spaces, self.get_name(),));
self.lines.push(format!(
"{}{{% if {}.available %}}",
"{}{{% if {} %}}",
self.spaces,
self.get_path(),
));
self.enter_list();
self.enter_child("value");
}

fn leave_option(&mut self) {
self.leave_child();
self.leave_list();
self.lines.push(format!("{}{{% endif %}}", self.spaces));
}
Expand Down

0 comments on commit 10648ee

Please sign in to comment.