hamlit 2.3.1 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f87b5f8e6806165838193859ece7aae9c3cc853
4
- data.tar.gz: d1e391154cd95f4a287ad802fe33e06076bebfef
3
+ metadata.gz: 6b12c8ee8fbc97d9eda90e24db50496038942663
4
+ data.tar.gz: 1260b4dfc2f4db62b82d384bfd42fc47ca75469a
5
5
  SHA512:
6
- metadata.gz: b4a909943b059a7382f73eaafbb827f30ab97103d0abdaf811552abe9d7f44bff637c8e6875150b0c74bb773a9fbfc9e1cb5a054d0f7536b3e322ca3aa5e281c
7
- data.tar.gz: 9496a8dc72a52606a7bfb9e9e10748d88a5be4e39130277debea48ad6be7a10ee9f122c0228613822f7df1166b93c8c980ee26e08dc45b15d4385717de777867
6
+ metadata.gz: db8f07ad47026134dcf60aefd9cd27c31f22ab7f7027c3605c3e2f4243bac921f54374a22bb672a04ebf3119d251ec64b970910137f8544a76a75f8c5755aef9
7
+ data.tar.gz: 7d7f92c8050832f24e3e951fd4eddfea5e42863b00daaa808fb9fe69f9094300b5cf5a5c19f1a77adf15eb5c86e05809cb2c823d47fce4a443bb2ce2ce513435
data/.travis.yml CHANGED
@@ -7,25 +7,25 @@ script:
7
7
  - "bundle exec rake $TASK"
8
8
  matrix:
9
9
  include:
10
- - rvm: 2.1
10
+ - rvm: 2.1.10
11
11
  env: TASK=test
12
- - rvm: 2.2
12
+ - rvm: 2.2.5
13
13
  env: TASK=test
14
- - rvm: 2.3.0
14
+ - rvm: 2.3.1
15
15
  env: TASK=test
16
- - rvm: 2.3.0
16
+ - rvm: 2.3.1
17
17
  env: TASK=bench TEMPLATE=benchmark/boolean_attribute.haml,benchmark/class_attribute.haml,benchmark/id_attribute.haml,benchmark/data_attribute.haml,benchmark/common_attribute.haml
18
- - rvm: 2.3.0
18
+ - rvm: 2.3.1
19
19
  env: TASK=bench TEMPLATE=benchmark/dynamic_attributes/boolean_attribute.haml,benchmark/dynamic_attributes/class_attribute.haml,benchmark/dynamic_attributes/id_attribute.haml,benchmark/dynamic_attributes/data_attribute.haml,benchmark/dynamic_attributes/common_attribute.haml
20
- - rvm: 2.3.0
20
+ - rvm: 2.3.1
21
21
  env: TASK=bench SLIM_BENCH=1
22
- - rvm: 2.3.0
22
+ - rvm: 2.3.1
23
23
  env: TASK=bench TEMPLATE=benchmark/etc/attribute_builder.haml
24
- - rvm: 2.3.0
24
+ - rvm: 2.3.1
25
25
  env: TASK=bench TEMPLATE=benchmark/etc/static_analyzer.haml
26
- - rvm: 2.3.0
26
+ - rvm: 2.3.1
27
27
  env: TASK=bench TEMPLATE=benchmark/etc/string_interpolation.haml
28
- - rvm: 2.3.0
28
+ - rvm: 2.3.1
29
29
  env: TASK=bench TEMPLATE=test/haml/templates/standard.haml COMPILE=1
30
30
  allow_failures:
31
31
  - env: TASK=bench TEMPLATE=benchmark/boolean_attribute.haml,benchmark/class_attribute.haml,benchmark/id_attribute.haml,benchmark/data_attribute.haml,benchmark/common_attribute.haml
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.4.0](https://github.com/k0kubun/hamlit/compare/v2.3.1...v2.4.0) - 2016-05-13
8
+
9
+ ### Added
10
+
11
+ - Add `Hamlit::Helpers.preserve` method for Tilt templates
12
+
7
13
  ## [2.3.1](https://github.com/k0kubun/hamlit/compare/v2.3.0...v2.3.1) - 2016-05-09
8
14
 
9
15
  ### Fixed
data/README.md CHANGED
@@ -47,7 +47,7 @@ with C extension.
47
47
 
48
48
  ## Usage
49
49
 
50
- See [REFERENCE.md](REFERENCE.md) for detail features of Hamlit.
50
+ Hamlit currently supports Ruby 2.1 and higher. See [REFERENCE.md](REFERENCE.md) for detail features of Hamlit.
51
51
 
52
52
  ### Rails
53
53
 
data/REFERENCE.md CHANGED
@@ -62,6 +62,7 @@ for full features in original implementation.
62
62
  - [ ] :textile
63
63
  - [ ] Custom Filters
64
64
  - [ ] Helper Methods
65
+ - [x] preserve
65
66
  - [x] surround
66
67
  - [x] precede
67
68
  - [x] succeed
data/bin/test CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/bin/bash
2
2
 
3
3
  VERSIONS=(
4
- 2.1.7
5
- 2.2.3
6
- 2.3.0
4
+ 2.1.10
5
+ 2.2.5
6
+ 2.3.1
7
7
  )
8
8
 
9
9
  set -e
@@ -16,7 +16,7 @@ function test_with() {
16
16
  bundle install
17
17
  fi
18
18
  ruby -v
19
- rake test
19
+ bundle exec rake test
20
20
  }
21
21
 
22
22
  for version in ${VERSIONS[@]}; do
@@ -0,0 +1,14 @@
1
+ module Hamlit
2
+ module Helpers
3
+ extend self
4
+
5
+ # The same as original Haml::Helpers#preserve without block support.
6
+ def preserve(input)
7
+ # https://github.com/haml/haml/blob/4.1.0.beta.1/lib/haml/helpers.rb#L130-L133
8
+ s = input.to_s.chomp("\n")
9
+ s.gsub!(/\n/, '
')
10
+ s.delete!("\r")
11
+ s
12
+ end
13
+ end
14
+ end
@@ -1,7 +1,10 @@
1
+ require 'hamlit/helpers'
2
+
1
3
  # Currently this Hamlit::Helpers depends on
2
4
  # ActionView internal implementation. (not desired)
3
5
  module Hamlit
4
6
  module RailsHelpers
7
+ include Helpers
5
8
  extend self
6
9
 
7
10
  DEFAULT_PRESERVE_TAGS = %w[textarea pre code].freeze
@@ -23,10 +26,7 @@ module Hamlit
23
26
 
24
27
  def preserve(input = nil, &block)
25
28
  return preserve(capture_haml(&block)) if block
26
- s = input.to_s.chomp("\n")
27
- s.gsub!(/\n/, '
')
28
- s.delete!("\r")
29
- s
29
+ super
30
30
  end
31
31
 
32
32
  def surround(front, back = front, &block)
@@ -1,5 +1,6 @@
1
1
  require 'temple'
2
2
  require 'hamlit/engine'
3
+ require 'hamlit/helpers'
3
4
 
4
5
  # Load tilt/haml first to override if available
5
6
  begin
@@ -14,4 +15,13 @@ module Hamlit
14
15
  Hamlit::Engine,
15
16
  register_as: :haml,
16
17
  )
18
+
19
+ module TemplateExtension
20
+ # Activate Hamlit::Helpers for tilt templates.
21
+ # https://github.com/judofyr/temple/blob/v0.7.6/lib/temple/mixins/template.rb#L7-L11
22
+ def compile(*)
23
+ "extend Hamlit::Helpers; #{super}"
24
+ end
25
+ end
26
+ Template.send(:extend, TemplateExtension)
17
27
  end
@@ -1,3 +1,3 @@
1
1
  module Hamlit
2
- VERSION = '2.3.1'
2
+ VERSION = '2.4.0'
3
3
  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.3.1
4
+ version: 2.4.0
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-05-08 00:00:00.000000000 Z
11
+ date: 2016-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: temple
@@ -342,6 +342,7 @@ files:
342
342
  - lib/hamlit/filters/scss.rb
343
343
  - lib/hamlit/filters/text_base.rb
344
344
  - lib/hamlit/filters/tilt_base.rb
345
+ - lib/hamlit/helpers.rb
345
346
  - lib/hamlit/html.rb
346
347
  - lib/hamlit/identity.rb
347
348
  - lib/hamlit/object_ref.rb
@@ -390,3 +391,4 @@ signing_key:
390
391
  specification_version: 4
391
392
  summary: High Performance Haml Implementation
392
393
  test_files: []
394
+ has_rdoc: