Skip to content

Commit

Permalink
fmt: cargo
Browse files Browse the repository at this point in the history
  • Loading branch information
LastLeaf committed Nov 5, 2024
1 parent b6b92f9 commit 390a5cb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
17 changes: 13 additions & 4 deletions glass-easel-template-compiler/src/parse/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2075,7 +2075,7 @@ impl Element {
};
list.push((tag_location.clone(), path.0.clone(), path.1.clone()));
}
_ => {},
_ => {}
}

// write script module
Expand Down Expand Up @@ -2117,7 +2117,9 @@ impl Element {
{
ps.add_warning(ParseErrorKind::DuplicatedName, name.location());
} else {
globals.sub_templates.push((tag_location.clone(), loc, name.clone(), new_children));
globals
.sub_templates
.push((tag_location.clone(), loc, name.clone(), new_children));
}
} else {
let wrap_children = |mut element: Element| -> Vec<Node> {
Expand Down Expand Up @@ -3173,13 +3175,20 @@ impl Script {

pub fn module_location(&self) -> Range<Position> {
match self {
Self::Inline { module_location, .. } | Self::GlobalRef { module_location, .. } => module_location.clone(),
Self::Inline {
module_location, ..
}
| Self::GlobalRef {
module_location, ..
} => module_location.clone(),
}
}

pub fn tag_location(&self) -> TagLocation {
match self {
Self::Inline { tag_location, .. } | Self::GlobalRef { tag_location, .. } => tag_location.clone(),
Self::Inline { tag_location, .. } | Self::GlobalRef { tag_location, .. } => {
tag_location.clone()
}
}
}
}
Expand Down
24 changes: 20 additions & 4 deletions glass-easel-template-compiler/src/stringify/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,18 @@ impl Stringify for Template {
None,
content_location,
)?;
stringifier.write_token(r#"<"#, None, &tag_location.end.as_ref().unwrap_or(&tag_location.start).0)?;
stringifier.write_token(
r#"<"#,
None,
&tag_location.end.as_ref().unwrap_or(&tag_location.start).0,
)?;
stringifier.write_token("/", None, &tag_location.close)?;
stringifier.write_str(r#"wxs"#)?;
stringifier.write_token(r#">"#, None, &tag_location.end.as_ref().unwrap_or(&tag_location.start).1)?;
stringifier.write_token(
r#">"#,
None,
&tag_location.end.as_ref().unwrap_or(&tag_location.start).1,
)?;
} else {
stringifier.write_token("/", None, &tag_location.close)?;
stringifier.write_token(">", None, &tag_location.start.1)?;
Expand Down Expand Up @@ -92,10 +100,18 @@ impl Stringify for Template {
for node in nodes {
node.stringify_write(stringifier)?;
}
stringifier.write_token(r#"<"#, None, &tag_location.end.as_ref().unwrap_or(&tag_location.start).0)?;
stringifier.write_token(
r#"<"#,
None,
&tag_location.end.as_ref().unwrap_or(&tag_location.start).0,
)?;
stringifier.write_token("/", None, &tag_location.close)?;
stringifier.write_str(r#"template"#)?;
stringifier.write_token(r#">"#, None, &tag_location.end.as_ref().unwrap_or(&tag_location.start).1)?;
stringifier.write_token(
r#">"#,
None,
&tag_location.end.as_ref().unwrap_or(&tag_location.start).1,
)?;
} else {
stringifier.write_token("/", None, &tag_location.close)?;
stringifier.write_token(">", None, &tag_location.start.1)?;
Expand Down

0 comments on commit 390a5cb

Please sign in to comment.