hamlit 2.2.1 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +0 -2
- data/CHANGELOG.md +12 -1
- data/Gemfile +1 -2
- data/benchmark/utils/benchmark_ips_extension.rb +1 -1
- data/bin/test +0 -1
- data/lib/hamlit/filters/plain.rb +19 -8
- data/lib/hamlit/parser/haml_util.rb +6 -1
- data/lib/hamlit/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: bdbcd9855ceed711ca31e228ae8d9eb034868259
         | 
| 4 | 
            +
              data.tar.gz: 7b0e66130cefe424a2463a283c6a930ad6ae2e60
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: da1b2dc6acad532b7983ad4fe19ff39a4dc3fe94869c7a90b68f0fb8f3d1689d1168edbcf8ba0eeae4ec43d1ad6ad9ee88394b604eaa723c371f01e3520e404c
         | 
| 7 | 
            +
              data.tar.gz: 099914dd8eb91a102613b42290f5aa87bd0332c87f83fef8f74c88d0d0ac9848f2ad1644744f817d29efd5cd93da1940c5a33b43385bd4fa53433526aa4290a7
         | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -4,7 +4,18 @@ All notable changes to this project will be documented in this file. This | |
| 4 4 | 
             
            project adheres to [Semantic Versioning](http://semver.org/). This change log is based upon
         | 
| 5 5 | 
             
            [keep-a-changelog](https://github.com/olivierlacan/keep-a-changelog).
         | 
| 6 6 |  | 
| 7 | 
            -
            ## [2.2. | 
| 7 | 
            +
            ## [2.2.2](https://github.com/k0kubun/hamlit/compare/v2.2.1...v2.2.2) - 2016-02-21
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ### Added
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            - Optimize performance of plain filter
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            ### Fixed
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            - Escape only interpolated text for plain filter
         | 
| 16 | 
            +
              [#58](https://github.com/k0kubun/hamlit/issues/58). *Thanks to @shaneog*
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            ## [2.2.1](https://github.com/k0kubun/hamlit/compare/v2.2.0...v2.2.1) - 2016-02-06
         | 
| 8 19 |  | 
| 9 20 | 
             
            ### Added
         | 
| 10 21 |  | 
    
        data/Gemfile
    CHANGED
    
    | @@ -7,8 +7,7 @@ gem 'benchmark-ips', '2.3.0' | |
| 7 7 | 
             
            gem 'minitest-line'
         | 
| 8 8 | 
             
            gem 'pry-byebug'
         | 
| 9 9 |  | 
| 10 | 
            -
             | 
| 11 | 
            -
            if RUBY_VERSION >= '2.1.0' && !is_windows
         | 
| 10 | 
            +
            if RUBY_PLATFORM !~ /mswin|mingw|bccwin|wince/
         | 
| 12 11 | 
             
              gem 'faml'
         | 
| 13 12 | 
             
              gem 'lineprof'
         | 
| 14 13 | 
             
              gem 'stackprof'
         | 
    
        data/bin/test
    CHANGED
    
    
    
        data/lib/hamlit/filters/plain.rb
    CHANGED
    
    | @@ -1,15 +1,26 @@ | |
| 1 | 
            +
            require 'hamlit/string_splitter'
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            module Hamlit
         | 
| 2 4 | 
             
              class Filters
         | 
| 3 5 | 
             
                class Plain < Base
         | 
| 4 6 | 
             
                  def compile(node)
         | 
| 5 | 
            -
                    text = node.value[:text] | 
| 6 | 
            -
                     | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 7 | 
            +
                    text = node.value[:text]
         | 
| 8 | 
            +
                    text = text.rstrip unless ::Hamlit::HamlUtil.contains_interpolation?(text) # for compatibility
         | 
| 9 | 
            +
                    [:multi, *compile_plain(text)]
         | 
| 10 | 
            +
                  end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                  private
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                  def compile_plain(text)
         | 
| 15 | 
            +
                    string_literal = ::Hamlit::HamlUtil.unescape_interpolation(text)
         | 
| 16 | 
            +
                    StringSplitter.compile(string_literal).map do |temple|
         | 
| 17 | 
            +
                      type, str = temple
         | 
| 18 | 
            +
                      case type
         | 
| 19 | 
            +
                      when :dynamic
         | 
| 20 | 
            +
                        [:escape, true, [:dynamic, str]]
         | 
| 21 | 
            +
                      else
         | 
| 22 | 
            +
                        temple
         | 
| 23 | 
            +
                      end
         | 
| 13 24 | 
             
                    end
         | 
| 14 25 | 
             
                  end
         | 
| 15 26 | 
             
                end
         | 
| @@ -199,6 +199,8 @@ MSG | |
| 199 199 | 
             
                end
         | 
| 200 200 |  | 
| 201 201 | 
             
                # Original Haml::Util.unescape_interpolation
         | 
| 202 | 
            +
                # ex) slow_unescape_interpolation('foo#{bar}baz"', escape_html: true)
         | 
| 203 | 
            +
                #   #=> "\"foo\#{::Hamlit::HamlHelpers.html_escape((bar))}baz\\\"\""
         | 
| 202 204 | 
             
                def slow_unescape_interpolation(str, escape_html = nil)
         | 
| 203 205 | 
             
                  res = ''
         | 
| 204 206 | 
             
                  rest = ::Hamlit::HamlUtil.handle_interpolation str.dump do |scan|
         | 
| @@ -223,7 +225,10 @@ MSG | |
| 223 225 | 
             
                  res + rest
         | 
| 224 226 | 
             
                end
         | 
| 225 227 |  | 
| 226 | 
            -
                # Customized Haml::Util.unescape_interpolation to handle escape by Hamlit
         | 
| 228 | 
            +
                # Customized Haml::Util.unescape_interpolation to handle escape by Hamlit.
         | 
| 229 | 
            +
                # It wraps double quotes to given `str` with escaping `"`.
         | 
| 230 | 
            +
                #
         | 
| 231 | 
            +
                # ex) unescape_interpolation('foo#{bar}baz"') #=> "\"foo\#{bar}baz\\\"\""
         | 
| 227 232 | 
             
                def unescape_interpolation(str)
         | 
| 228 233 | 
             
                  res = ''
         | 
| 229 234 | 
             
                  rest = ::Hamlit::HamlUtil.handle_interpolation str.dump do |scan|
         | 
    
        data/lib/hamlit/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: hamlit
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.2. | 
| 4 | 
            +
              version: 2.2.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Takashi Kokubun
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2016-02- | 
| 11 | 
            +
            date: 2016-02-21 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: temple
         |