Skip to content

Commit

Permalink
small refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
g-plane committed Mar 1, 2024
1 parent 2fc96e7 commit 3ad3f58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion markup_fmt/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,8 @@ impl<'s> Parser<'s> {
{
body.push(JinjaTagOrChildren::Tag(next_tag));
break;
} else if (tag_name == "if" || tag_name == "for")
}
if (tag_name == "if" || tag_name == "for")
&& matches!(next_tag_name, "elif" | "elseif" | "else")
{
body.push(JinjaTagOrChildren::Tag(next_tag));
Expand Down
6 changes: 4 additions & 2 deletions markup_fmt/src/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,14 @@ impl<'s> DocGen<'s> for Element<'s> {
docs.push(Doc::text(">"));
}
return Doc::list(docs).group();
} else if self_closing && self.children.is_empty() {
}
if self_closing && self.children.is_empty() {
docs.push(attrs);
docs.push(Doc::line_or_space());
docs.push(Doc::text("/>"));
return Doc::list(docs).group();
} else if ctx.options.closing_bracket_same_line {
}
if ctx.options.closing_bracket_same_line {
docs.push(attrs.append(Doc::text(">")).group());
} else {
docs.push(
Expand Down

0 comments on commit 3ad3f58

Please sign in to comment.