Skip to content

Commit

Permalink
Fix failing specs (#695)
Browse files Browse the repository at this point in the history
This commit make all specs pass initially.

This commit:
* In last line of `Markdown#to_html`, change `lines.join("\n")` to `lines.join`. Because html format in specs does not contains `'\n'`
* In second condition of `Markdown#parse_list`, fix it to detect html format instead of original markdown format. Because when checking previous line, it had already changed into html format

[no important files changed]
ls1955 authored Sep 15, 2024
1 parent f6b78fd commit 2b22764
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions exercises/practice/markdown/src/markdown.cr
Original file line number Diff line number Diff line change
@@ -20,14 +20,14 @@ class Markdown
end
i += 1
end
lines.join("\n")
lines.join
end

private def parse_list(line : String, previous_line : Bool | String, next_line : Nil | String) : String
result = ""
if previous_line.is_a?(Bool)
result += "<ul>"
elsif !previous_line.starts_with?('*')
elsif !previous_line.starts_with?(/<(ul|li)>/)
result += "<ul>"
end

0 comments on commit 2b22764

Please sign in to comment.