插件脚本 【原创】【21.1】中文文本处理(1.3.7)

LQWU

冠军
2023/07/12
45
2
18
1,896
因本人懒惰导致未在v20.1上进行测试,所以在v20.1中使用会报错,紧急修正方法为在Tools.rb文件中插入以下代码
Ruby:
def fmtReplaceEscapes(text)
  text.gsub!(/&lt;/, "<")
  text.gsub!(/&gt;/, ">")
  text.gsub!(/&apos;/, "'")
  text.gsub!(/&quot;/, "\"")
  text.gsub!(/&amp;/, "&")
  text.gsub!(/&m;/, "♂")
  text.gsub!(/&f;/, "♀")
end

class Color
  def self.new_from_rgb(param)
    return Font.default_color if !param
    base_int = param.to_i(16)
    case param.length
    when 8   # 32-bit hex
      return Color.new(
        (base_int >> 24) & 0xFF,
        (base_int >> 16) & 0xFF,
        (base_int >> 8) & 0xFF,
        (base_int) & 0xFF
      )
    when 6   # 24-bit hex
      return Color.new(
        (base_int >> 16) & 0xFF,
        (base_int >> 8) & 0xFF,
        (base_int) & 0xFF
      )
    when 4   # 15-bit hex
      return Color.new(
        ((base_int) & 0x1F) << 3,
        ((base_int >> 5) & 0x1F) << 3,
        ((base_int >> 10) & 0x1F) << 3
      )
    when 1, 2   # Color number
      case base_int
      when 0 then return Color.white
      when 1 then return Color.blue
      when 2 then return Color.red
      when 3 then return Color.green
      when 4 then return Color.cyan
      when 5 then return Color.pink
      when 6 then return Color.yellow
      when 7 then return Color.gray
      else        return Font.default_color
      end
    end
    return Font.default_color
  end
end

过几天我会尽快修复,给大家造成的不便敬请谅解
大佬,辛苦了
 

在线成员

论坛统计

主题
474
消息
2,137
成员
2,909
最新成员
小灵喵~