hamlit 2.8.4 → 2.8.5
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 +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/REFERENCE.md +47 -0
- data/lib/hamlit/attribute_parser.rb +1 -1
- data/lib/hamlit/rails_template.rb +4 -0
- data/lib/hamlit/version.rb +1 -1
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: c425b65463464503f25f1b70bd3dc05d002006f3
         | 
| 4 | 
            +
              data.tar.gz: 13ac4271de0ab1ce93e6f69165c7b66e8e66b626
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4d5c054ac1de86c2362839be478ff94e3b20d88db0f3d1c96337d71c78e51b8556a66c9eead574560d3dc5cd59672293e2e08838584049ef8a8afed34c40801c
         | 
| 7 | 
            +
              data.tar.gz: 562df2c7640a4deedacfd89ec2c098c6a8c2252fc2aa8fd853d3f0c0d2c4d03f4d3342e74468a7bcd77df4ea0f7f2bdb42cbeb111009d8afb767c27e041c9875
         | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -4,6 +4,12 @@ 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.8.5](https://github.com/k0kubun/hamlit/compare/v2.8.4...v2.8.5) - 2017-11-06
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ### Fixed
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            - Fix lexer to work with Ripper of Ruby 2.5
         | 
| 12 | 
            +
             | 
| 7 13 | 
             
            ## [2.8.4](https://github.com/k0kubun/hamlit/compare/v2.8.3...v2.8.4) - 2017-06-23
         | 
| 8 14 |  | 
| 9 15 | 
             
            ### Added
         | 
    
        data/Gemfile
    CHANGED
    
    
    
        data/REFERENCE.md
    CHANGED
    
    | @@ -215,3 +215,50 @@ Hamlit::RailsTemplate.set_options attr_quote: '"' | |
| 215 215 | 
             
            ```rb
         | 
| 216 216 | 
             
            set :haml, { attr_quote: '"' }
         | 
| 217 217 | 
             
            ```
         | 
| 218 | 
            +
             | 
| 219 | 
            +
            ## Creating a custom filter
         | 
| 220 | 
            +
             | 
| 221 | 
            +
            Currently it doesn't have filter registering interface compatible with Haml.
         | 
| 222 | 
            +
            But you can easily define and register a filter using Tilt like this.
         | 
| 223 | 
            +
             | 
| 224 | 
            +
            ```rb
         | 
| 225 | 
            +
            module Hamlit
         | 
| 226 | 
            +
              class Filters
         | 
| 227 | 
            +
                class Es6 < TiltBase
         | 
| 228 | 
            +
                  def compile(node)
         | 
| 229 | 
            +
                    # branch with `@format` here if you want
         | 
| 230 | 
            +
                    compile_html(node)
         | 
| 231 | 
            +
                  end
         | 
| 232 | 
            +
             | 
| 233 | 
            +
                  private
         | 
| 234 | 
            +
             | 
| 235 | 
            +
                  def compile_html(node)
         | 
| 236 | 
            +
                    temple = [:multi]
         | 
| 237 | 
            +
                    temple << [:static, "<script>\n"]
         | 
| 238 | 
            +
                    temple << compile_with_tilt(node, 'es6', indent_width: 2)
         | 
| 239 | 
            +
                    temple << [:static, "\n</script>"]
         | 
| 240 | 
            +
                    temple
         | 
| 241 | 
            +
                  end
         | 
| 242 | 
            +
                end
         | 
| 243 | 
            +
             | 
| 244 | 
            +
                register :es6, Es6
         | 
| 245 | 
            +
              end
         | 
| 246 | 
            +
            end
         | 
| 247 | 
            +
            ```
         | 
| 248 | 
            +
             | 
| 249 | 
            +
            After requiring the script, you can do:
         | 
| 250 | 
            +
             | 
| 251 | 
            +
            ```haml
         | 
| 252 | 
            +
            :es6
         | 
| 253 | 
            +
              const a = 1;
         | 
| 254 | 
            +
            ```
         | 
| 255 | 
            +
             | 
| 256 | 
            +
            and it's rendered as:
         | 
| 257 | 
            +
             | 
| 258 | 
            +
            ```html
         | 
| 259 | 
            +
            <script>
         | 
| 260 | 
            +
              "use strict";
         | 
| 261 | 
            +
             | 
| 262 | 
            +
              var a = 1;
         | 
| 263 | 
            +
            </script>
         | 
| 264 | 
            +
            ```
         | 
| @@ -18,7 +18,7 @@ module Hamlit | |
| 18 18 | 
             
                  tokens = Ripper.lex(exp)[1..-2] || []
         | 
| 19 19 | 
             
                  each_attr(tokens) do |attr_tokens|
         | 
| 20 20 | 
             
                    key = parse_key!(attr_tokens)
         | 
| 21 | 
            -
                    hash[key] = attr_tokens.map | 
| 21 | 
            +
                    hash[key] = attr_tokens.map { |t| t[2] }.join.strip
         | 
| 22 22 | 
             
                  end
         | 
| 23 23 | 
             
                  hash
         | 
| 24 24 | 
             
                rescue ParseSkip
         | 
    
        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.8. | 
| 4 | 
            +
              version: 2.8.5
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Takashi Kokubun
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017-06 | 
| 11 | 
            +
            date: 2017-11-06 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: temple
         | 
| @@ -368,7 +368,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 368 368 | 
             
                  version: '0'
         | 
| 369 369 | 
             
            requirements: []
         | 
| 370 370 | 
             
            rubyforge_project: 
         | 
| 371 | 
            -
            rubygems_version: 2. | 
| 371 | 
            +
            rubygems_version: 2.6.13
         | 
| 372 372 | 
             
            signing_key: 
         | 
| 373 373 | 
             
            specification_version: 4
         | 
| 374 374 | 
             
            summary: High Performance Haml Implementation
         |