diff --git a/lib/markd/src/markd/options.cr b/lib/markd/src/markd/options.cr index 7605a261e939..10e87c29d031 100644 --- a/lib/markd/src/markd/options.cr +++ b/lib/markd/src/markd/options.cr @@ -50,7 +50,7 @@ module Markd @source_pos = false, @safe = false, @prettyprint = false, - @base_url = nil + @base_url = nil, ) end end diff --git a/lib/markd/src/markd/renderers/html_renderer.cr b/lib/markd/src/markd/renderers/html_renderer.cr index f1149fe58217..e91b44bad54b 100644 --- a/lib/markd/src/markd/renderers/html_renderer.cr +++ b/lib/markd/src/markd/renderers/html_renderer.cr @@ -222,7 +222,7 @@ module Markd @last_output = ">" end - private def tag(name : String, attrs = nil) + private def tag(name : String, attrs = nil, &) tag(name, attrs) yield tag(name, end_tag: true) diff --git a/lib/markd/src/markd/utils.cr b/lib/markd/src/markd/utils.cr index deb40668610e..b1871e08d8d7 100644 --- a/lib/markd/src/markd/utils.cr +++ b/lib/markd/src/markd/utils.cr @@ -2,7 +2,7 @@ require "json" module Markd module Utils - def self.timer(label : String, measure_time? : Bool) + def self.timer(label : String, measure_time? : Bool, &) return yield unless measure_time? start_time = Time.utc diff --git a/spec/compiler/formatter/formatter_spec.cr b/spec/compiler/formatter/formatter_spec.cr index 0a7695f4ead6..92c568f088b7 100644 --- a/spec/compiler/formatter/formatter_spec.cr +++ b/spec/compiler/formatter/formatter_spec.cr @@ -1116,6 +1116,9 @@ describe Crystal::Formatter do assert_format "a = # foo\n bar(1)" assert_format "a = \\\n # foo\n bar(1)" assert_format "a = \\\n # foo\n nil" + assert_format "a : String = if 1\n\"One\"\nelse\"Zero\"\nend", "a : String = if 1\n \"One\"\n else\n \"Zero\"\n end" + assert_format "a : String = case 1\nwhen 2\n3\nend", "a : String = case 1\n when 2\n 3\n end" + assert_format "a : String = \nif 1\n1\nelse\n2\nend", "a : String =\n if 1\n 1\n else\n 2\n end" assert_format %(require "foo"), %(require "foo") diff --git a/src/compiler/crystal/tools/formatter.cr b/src/compiler/crystal/tools/formatter.cr index 7ea32627078e..d6955c43e6e5 100644 --- a/src/compiler/crystal/tools/formatter.cr +++ b/src/compiler/crystal/tools/formatter.cr @@ -3649,9 +3649,9 @@ module Crystal if value = node.value skip_space check :OP_EQ - next_token_skip_space_or_newline - write " = " - accept value + next_token_skip_space + write " =" + accept_assign_value_after_equals value end false end