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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd3f09d4c281dad806365ba6f07754fb4fc54726
4
- data.tar.gz: 07f9f38c16759a75fae17526c27aa1c6adf1e9d6
3
+ metadata.gz: c425b65463464503f25f1b70bd3dc05d002006f3
4
+ data.tar.gz: 13ac4271de0ab1ce93e6f69165c7b66e8e66b626
5
5
  SHA512:
6
- metadata.gz: e6c31b6e27e6a020f621305bac57b0a1a1098f529d510958f8aeaf794ba4bb7189c890dd94466b1300efbd63d1bdcafc483e23296f0e4123c987d4093a4c68cf
7
- data.tar.gz: 513ac74aee322a79078187a47f959694784c188845d4f372f5ccc01f6b0765f8b892a648e4523faa86e25758026567270ea4bbfc440174c39f6ea5dd37a69d02
6
+ metadata.gz: 4d5c054ac1de86c2362839be478ff94e3b20d88db0f3d1c96337d71c78e51b8556a66c9eead574560d3dc5cd59672293e2e08838584049ef8a8afed34c40801c
7
+ data.tar.gz: 562df2c7640a4deedacfd89ec2c098c6a8c2252fc2aa8fd853d3f0c0d2c4d03f4d3342e74468a7bcd77df4ea0f7f2bdb42cbeb111009d8afb767c27e041c9875
@@ -4,7 +4,7 @@ branches:
4
4
  only:
5
5
  - master
6
6
  script:
7
- - "bundle exec rake $TASK"
7
+ - "BACKTRACE=1 bundle exec rake $TASK"
8
8
  matrix:
9
9
  include:
10
10
  - rvm: 2.1.10
@@ -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
@@ -13,7 +13,7 @@ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.2')
13
13
  end
14
14
 
15
15
  gem 'benchmark-ips', '2.3.0'
16
- gem 'minitest-line'
16
+ gem 'm'
17
17
  gem 'pry-byebug'
18
18
 
19
19
  if RUBY_PLATFORM !~ /mswin|mingw|bccwin|wince/
@@ -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(&:last).join.strip
21
+ hash[key] = attr_tokens.map { |t| t[2] }.join.strip
22
22
  end
23
23
  hash
24
24
  rescue ParseSkip
@@ -34,6 +34,10 @@ module Hamlit
34
34
 
35
35
  Engine.new(options).call(template.source)
36
36
  end
37
+
38
+ def supports_streaming?
39
+ RailsTemplate.options[:streaming]
40
+ end
37
41
  end
38
42
  ActionView::Template.register_template_handler(:haml, RailsTemplate.new)
39
43
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Hamlit
3
- VERSION = '2.8.4'
3
+ VERSION = '2.8.5'
4
4
  end
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
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-23 00:00:00.000000000 Z
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.5.2
371
+ rubygems_version: 2.6.13
372
372
  signing_key:
373
373
  specification_version: 4
374
374
  summary: High Performance Haml Implementation