Skip to content

Commit

Permalink
Support frozen string literals (#105)
Browse files Browse the repository at this point in the history
This is to avoid deprecation warnings with the forthcoming change in
Ruby 3.4 where modifying a string literal will cause a deprecation
warning by default.
ruby/ruby@12be40a

Co-authored-by: Johannes Opper <[email protected]>
  • Loading branch information
pat and xijo authored Oct 29, 2024
1 parent 999ecf7 commit 14d53d5
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/reverse_markdown/converters/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module ReverseMarkdown
module Converters
class Base
def treat_children(node, state)
node.children.inject('') do |memo, child|
node.children.inject(+'') do |memo, child|
memo << treat(child, state)
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/reverse_markdown/converters/blockquote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Blockquote < Base
def convert(node, state = {})
content = treat_children(node, state).strip
content = ReverseMarkdown.cleaner.remove_newlines(content)
"\n\n> " << content.lines.to_a.join('> ') << "\n\n"
+"\n\n> " << content.lines.to_a.join('> ') << "\n\n"
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/reverse_markdown/converters/div.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module ReverseMarkdown
module Converters
class Div < Base
def convert(node, state = {})
"\n" << treat_children(node, state) << "\n"
+"\n" << treat_children(node, state) << "\n"
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/reverse_markdown/converters/figcaption.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def convert(node, state = {})
if node.text.strip.empty?
""
else
"\n" << "_#{node.text.strip}_" << "\n"
+"\n" << "_#{node.text.strip}_" << "\n"
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/reverse_markdown/converters/ol.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Converters
class Ol < Base
def convert(node, state = {})
ol_count = state.fetch(:ol_count, 0) + 1
"\n" << treat_children(node, state.merge(ol_count: ol_count)) << "\n"
+"\n" << treat_children(node, state.merge(ol_count: ol_count)) << "\n"
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/reverse_markdown/converters/p.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module ReverseMarkdown
module Converters
class P < Base
def convert(node, state = {})
"\n\n" << treat_children(node, state).strip << "\n\n"
+"\n\n" << treat_children(node, state).strip << "\n\n"
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/reverse_markdown/converters/pre.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ class Pre < Base
def convert(node, state = {})
content = treat_children(node, state)
if ReverseMarkdown.config.github_flavored
"\n```#{language(node)}\n" << content.strip << "\n```\n"
+"\n```#{language(node)}\n" << content.strip << "\n```\n"
else
"\n\n " << content.lines.to_a.join(" ") << "\n\n"
+"\n\n " << content.lines.to_a.join(" ") << "\n\n"
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/reverse_markdown/converters/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module ReverseMarkdown
module Converters
class Table < Base
def convert(node, state = {})
"\n\n" << treat_children(node, state) << "\n"
+"\n\n" << treat_children(node, state) << "\n"
end
end

Expand Down

0 comments on commit 14d53d5

Please sign in to comment.