Skip to content

Commit

Permalink
test markdown: follow message format change
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Sep 12, 2024
1 parent 0b70eb3 commit 687e6db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/rabbit/parser/markdown/converter.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2012-2022 Sutou Kouhei <[email protected]>
# Copyright (C) 2012-2024 Sutou Kouhei <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -170,10 +170,10 @@ def convert_p(element)
_("multiple ![alt]{image}s in a paragraph isn't supported.")
end
if child_types.include?(:img)
message =
format =
_("![alt]{image} and other contents in a paragraph " \
"isn't supported: %{types}")
raise ParseError, message % {types: child_types}
raise ParseError, format % {types: child_types}
end
if element.options[:transparent] and child_types == [:text]
element.children.first.value.chomp!
Expand Down
5 changes: 3 additions & 2 deletions test/parser/test-markdown.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2014-2022 Sutou Kouhei <[email protected]>
# Copyright (C) 2014-2024 Sutou Kouhei <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -287,7 +287,8 @@ class InlineTest < self

def test_unsupported
image_path = fixture_path("image/png/lavie.png")
message = _("![alt]{image} and other contents in a paragraph isn't supported: [:text, :img]")
format = _("![alt]{image} and other contents in a paragraph isn't supported: %{types}")
message = format % {types: [:text, :img]}
assert_raise(Rabbit::ParseError.new(message)) do
parse(<<-MARKDOWN)
a ![](#{image_path})
Expand Down

0 comments on commit 687e6db

Please sign in to comment.