Skip to content

Commit

Permalink
Support html tags without content or block (#1377)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewmcgarvey committed Dec 31, 2020
1 parent c31bcd3 commit 8314f50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions spec/lucky/base_tags_spec.cr
Expand Up @@ -25,6 +25,7 @@ describe Lucky::BaseTags do
view(&.para(42)).should contain "<p>42</p>"
view(&.para(MySpecialClass.new)).should contain "<p>it works</p>"
view(&.para(1_i64)).should contain "<p>1</p>"
view(&.para({"class" => "empty-content"})).should contain "<p class=\"empty-content\"></p>"
view(&.hr).should contain "<hr>"
end

Expand Down
4 changes: 4 additions & 0 deletions src/lucky/tags/base_tags.cr
Expand Up @@ -27,6 +27,10 @@ module Lucky::BaseTags
end
end

def {{method_name.id}}(options = EMPTY_HTML_ATTRS, **other_options) : Nil
{{ method_name.id }}("", options, **other_options)
end

def {{method_name.id}}(content : String | Lucky::AllowedInTags) : Nil
{{method_name.id}}(EMPTY_HTML_ATTRS) do
text content
Expand Down

0 comments on commit 8314f50

Please sign in to comment.