rubygem-wikicloth/Fix-rubygem-expression_parser-test-failure.patch
cherry530 223721ad22 Fix rubygem-expression_parser test failure caused by ruby upgrade to 3.2.2
Signed-off-by: cherry530 <707078654@qq.com>
(cherry picked from commit 4795b9ebdc5448681cb28e7398496636fd89eec7)
2023-08-14 09:04:56 +08:00

49 lines
2.3 KiB
Diff

diff --git a/examples/info.rb b/examples/info.rb
index 2a97bfd..b676d25 100644
--- a/examples/info.rb
+++ b/examples/info.rb
@@ -1,5 +1,5 @@
require File.join(File.dirname(__FILE__),'../init.rb')
-if ARGV[0] && File.exists?(ARGV[0])
+if ARGV[0] && File.exist?(ARGV[0])
data = File.read(ARGV[0])
else
data = "[[ this ]] is a [[ link ]] and another [http://www.google.com Google]. This is a <ref>reference</ref>, but this is a [[Category:Test]]. This is in another [[de:Sprache]]"
diff --git a/examples/print.rb b/examples/print.rb
index acf74f5..5f69571 100644
--- a/examples/print.rb
+++ b/examples/print.rb
@@ -1,5 +1,5 @@
require File.join(File.dirname(__FILE__),'../init.rb')
-if ARGV[0] && File.exists?(ARGV[0])
+if ARGV[0] && File.exist?(ARGV[0])
data = File.read(ARGV[0])
else
data = "[[ this ]] is a [[ link ]] and another [http://www.google.com Google] but they should be disabled"
diff --git a/lib/wikicloth/extensions/math.rb b/lib/wikicloth/extensions/math.rb
index 7543e29..7448b25 100644
--- a/lib/wikicloth/extensions/math.rb
+++ b/lib/wikicloth/extensions/math.rb
@@ -9,7 +9,7 @@ module WikiCloth
blahtex_png_path = @options[:blahtex_png_path] || '/tmp'
blahtex_options = @options[:blahtex_options] || '--texvc-compatible-commands --mathml-version-1-fonts --disallow-plane-1 --spacing strict'
- if File.exists?(blahtex_path) && @options[:math_formatter] != :google
+ if File.exist?(blahtex_path) && @options[:math_formatter] != :google
begin
# pass tex markup to blahtex
response = `echo '#{buffer.element_content}' | #{blahtex_path} #{blahtex_options} --png --mathml --png-directory #{blahtex_png_path}`
diff --git a/lib/wikicloth/extensions/source.rb b/lib/wikicloth/extensions/source.rb
index 5d05585..b092de7 100644
--- a/lib/wikicloth/extensions/source.rb
+++ b/lib/wikicloth/extensions/source.rb
@@ -19,7 +19,7 @@ module WikiCloth
content = $1 if content =~ /^\s*\n(.*)$/m
error = nil
- if File.exists?(highlight_path)
+ if File.exist?(highlight_path)
begin
raise I18n.t("lang attribute is required") unless buffer.element_attributes.has_key?('lang')
raise I18n.t("unknown lang", :lang => buffer.element_attributes['lang'].downcase) unless LuaExtension::VALID_LANGUAGES.include?(buffer.element_attributes['lang'].downcase)