lib/mms2r/media.rb
def transform_text(type, text)
      return type, text if !config['transform'] || !(transforms = config['transform'][type])

      if RUBY_VERSION < "1.9"
        require 'iconv'
        ic = Iconv.new('UTF-8', 'ISO-8859-1')
        text = ic.iconv(text)
        text << ic.iconv(nil)
        ic.close
      end

      transforms.each do |transform|
        next unless transform.size == 2
        p = transform.first
        r = transform.last
        text = text.gsub(p, r) rescue text
      end

      return type, text
    end
def transform_text(type, text)
      return type, text if !config['transform'] || !(transforms = config['transform'][type])

      if RUBY_VERSION < "1.9"
        require 'iconv'
        ic = Iconv.new('UTF-8', 'ISO-8859-1')
        text = ic.iconv(text)
        text << ic.iconv(nil)
        ic.close
      end

      transforms.each do |transform|
        next unless transform.size == 2
        p = transform.first
        r = transform.last
        text = text.gsub(p, r) rescue text
      end

      return type, text
    end
def transform_text ( type , text ) return type , text if ! config [ 'transform' ] || ! ( transforms = config [ 'transform' ] [ type ] ) if RUBY_VERSION < "1.9" require 'iconv' ic = Iconv . new ( 'UTF-8' , 'ISO-8859-1' ) text = ic . iconv ( text ) text << ic . iconv ( nil ) ic . close end transforms . each do | transform | next unless transform . size == 2 p = transform . first r = transform . last text = text . gsub ( p , r ) rescue text end return type , text end
Helper for process_media template method to transform text.
 See the transform section in the discussion of the built-in
 configuration.
Helper for process_media template method to transform text . See the transform section in the discussion of the built - in configuration .