Sha256: d1e04b0bfa83b8616c667150ff8db33847cae77eb0b1345eaa9ac33fee9081fd

Contents?: true

Size: 457 Bytes

Versions: 2

Compression:

Stored size: 457 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

# * George Moschovitis <gm@navel.gr>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nitro-0.30.0 lib/nitro/compiler/squeeze.rb
nitro-0.31.0 lib/nitro/compiler/squeeze.rb