Sha256: 68c65094f913dfa4e025f5be0989215038ffa203d47e735dcfd1abbf2644ff8a

Contents?: true

Size: 419 Bytes

Versions: 2

Compression:

Stored size: 419 Bytes

Contents

module Nitro

# A compiler transformation pipeline stage that compresses
# the generated xhtml code.   
 
class Squeeze
  
  # Compresses the inline xhtml. Does not touch the ruby code.
   
  def self.transform(text, compiler = nil)
    return text.gsub(/\@out \<\< \%\^(.*?)\^/m) do |match|
      c = $1.gsub(/^(\s*)/m, '').squeeze(" \t").tr("\n", '').tr("\t", ' ')
      "@out << %{#{c}}"
    end
  end
  
end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nitro-0.41.0 lib/nitro/compiler/squeeze.rb
nitro-0.40.0 lib/nitro/compiler/squeeze.rb