rubygem-wikicloth/Fix-build-error.patch

37 lines
1.5 KiB
Diff
Raw Normal View History

From 39d75899dceb37a2a9d4bcd8beec980b60e248f0 Mon Sep 17 00:00:00 2001
From: Andreas Schwarz <andreas@andreas-s.net>
Date: Sat, 23 Jan 2021 23:17:53 +0100
Subject: [PATCH] Remove URI.escape (deprecated in Ruby 3.0)
---
lib/wikicloth/extensions/math.rb | 2 +-
lib/wikicloth/wiki_buffer/var.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/wikicloth/extensions/math.rb b/lib/wikicloth/extensions/math.rb
index 41dfef7..15a4c25 100644
--- a/lib/wikicloth/extensions/math.rb
+++ b/lib/wikicloth/extensions/math.rb
@@ -34,7 +34,7 @@ class MathExtension < Extension
end
else
# if blahtex does not exist fallback to google charts api
- encoded_string = URI.escape(buffer.element_content, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
+ encoded_string = URI.encode_www_form_component(buffer.element_content)
"<img src=\"https://chart.googleapis.com/chart?cht=tx&chl=#{encoded_string}\" />"
end
end
diff --git a/lib/wikicloth/wiki_buffer/var.rb b/lib/wikicloth/wiki_buffer/var.rb
index 7a39527..1b392b8 100644
--- a/lib/wikicloth/wiki_buffer/var.rb
+++ b/lib/wikicloth/wiki_buffer/var.rb
@@ -167,7 +167,7 @@ def default_functions(name,params)
@options[:params][params.first] = params[1]
""
when "urlencode"
- URI.escape(params.first, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
+ URI.encode_www_form_component(params.first)
when "lc"
params.first.downcase
when "uc"