module Automatic::OPML

Public Class Methods

unnormalize(text) click to toggle source
# File lib/automatic/opml.rb, line 6
def self::unnormalize(text)
  text.gsub(/&(\w+);/) {
    x = $1
    case x
    when 'lt'
      '<'
    when 'gt'
      '>'
    when 'quot'
      '"'
    when 'amp'
      '&'
    when 'apos'
      "'"
    when /^\#(\d+)$/
      [$1.to_i].pack("U")
    when /^\#x([0-9a-f]+)$/i
      [$1.hex].pack("U")
    else
      raise "unnormalize error '#{x}'"
    end
  }
end