lib/sinew/response.rb
# Like body, but tries to cleanup whitespace around HTML for easier parsing.
Like body, but tries to cleanup whitespace around HTML for easier parsing.
Like body but tries to cleanup whitespace around HTML for easier parsing .
def html
      @html ||= body.dup.tap do
        if _1.encoding == Encoding::UTF_8
          _1.encode!('UTF-8', invalid: :replace, undef: :replace, replace: '?')
        end
        _1.strip!
        _1.gsub!(/\s+/, ' ')
        _1.gsub!(/ ?<([^>]+)> ?/, '<\\1>')
      end
    end
def html @html ||= body . dup . tap do if _1 . encoding == Encoding :: UTF_8 _1 . encode! ( 'UTF-8' , invalid : :replace , undef : :replace , replace : '?' ) end _1 . strip! _1 . gsub! ( / \s + / , ' ' ) _1 . gsub! ( /  ?<([^>]+)> ? / , '<\\1>' ) end end
Like body, but tries to cleanup whitespace around HTML for easier parsing.
Like body but tries to cleanup whitespace around HTML for easier parsing .
# fix invalid utf8 # squish # kill whitespace around tags