flavour_saver 0.3.8 → 0.3.9

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: 0965ce577ba5f5e0e84097ff444c306b053ba899
4
- data.tar.gz: f92b0741008a767ef778841404397eabf41620f6
3
+ metadata.gz: 54b7344a636871a83f045d46103bfc0bcb8fa1e6
4
+ data.tar.gz: 2755904a1a108cd04a2fd626521a2b1eae819185
5
5
  SHA512:
6
- metadata.gz: 11472cf0bc62d973eb98cf1e1c6c1275aa1c37b55ac52f43776104cb5629308ad5d2676887fc760657fa794a560e0f2bd8e826ddb338557772254fca4e6ef10a
7
- data.tar.gz: 6e238d05a52deafb8309454977ca86d4a6c2f09171baff67a814bac81a005cfb97511e95bd8b0feec0ea0e47c47e9c1a15fee75d68966ddc902946d9de00ba19
6
+ metadata.gz: 3b378381e8e40ee8d14848d50a2e4896c3ec940205420f225aefa7067da076877120d4e7d7f7ff70415d4dc56b2cd073b766c44939545daa24d0cbf919ac8d95
7
+ data.tar.gz: e4b3befa9a7584f4497451331a2d9251ff1281cbfb290303a44f022bf6c79cf31187f4e3a535708ba7fefb0d2f86074cd2b295f487bed088d80c51288f19bef0
@@ -1,10 +1,14 @@
1
1
  language: ruby
2
+ before_install:
3
+ - gem install bundler
2
4
  rvm:
3
5
  - 1.9.3
4
6
  - 2.0.0
5
7
  - 2.1.5
6
8
  - 2.2.1
7
9
  - 2.2.2
10
+ - 2.3.4
11
+ - 2.4.1
8
12
  - jruby-19mode
9
13
  - rbx-19mode
10
14
  script: 'bundle exec rspec'
data/README.md CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  [Handlebars.js](http://handlebarsjs.com) without the `.js`
4
4
 
5
- [![Build Status](https://travis-ci.org/jamesotron/FlavourSaver.png)](https://travis-ci.org/jamesotron/FlavourSaver)
6
- [![Dependency Status](https://gemnasium.com/jamesotron/FlavourSaver.png)](https://gemnasium.com/jamesotron/FlavourSaver)
7
- [![Code Climate](https://codeclimate.com/github/jamesotron/FlavourSaver.png)](https://codeclimate.com/github/jamesotron/FlavourSaver)
5
+ [![Build Status](https://travis-ci.org/jamesotron/FlavourSaver.svg)](https://travis-ci.org/jamesotron/FlavourSaver)
6
+ [![Dependency Status](https://gemnasium.com/jamesotron/FlavourSaver.svg)](https://gemnasium.com/jamesotron/FlavourSaver)
7
+ [![Code Climate](https://codeclimate.com/github/jamesotron/FlavourSaver.svg)](https://codeclimate.com/github/jamesotron/FlavourSaver)
8
8
 
9
9
  ## WAT?
10
10
 
11
- FlavourSaver is a ruby-based implementation of the [Handlebars.js](http://handlebars.js)
11
+ FlavourSaver is a ruby-based implementation of the [Handlebars.js](http://handlebarsjs.com)
12
12
  templating language. FlavourSaver supports Handlebars template rendering natively on
13
13
  Rails and on other frameworks (such as Sinatra) via Tilt.
14
14
 
@@ -78,7 +78,7 @@ module FlavourSaver
78
78
  :ELSE
79
79
  end
80
80
 
81
- rule /([A-Za-z]\w*)/, :expression do |name|
81
+ rule /([A-Za-z_]\w*)/, :expression do |name|
82
82
  [ :IDENT, name ]
83
83
  end
84
84
 
@@ -122,10 +122,15 @@ module FlavourSaver
122
122
  pop_state
123
123
  end
124
124
 
125
- # Handlebars allows methods with hyphens in them. Ruby doesn't, so
126
- # we'll assume you're trying to index the context with the identifier
127
- # and call the result.
128
- rule /([A-Za-z][a-z0-9_-]*[a-z0-9])/, :expression do |str|
125
+ # Handlebars allows identifiers with characters in them which Ruby does not.
126
+ # These are mapped to the literal notation and accessed in this way.
127
+ #
128
+ # As per the http://handlebarsjs.com/expressions.html:
129
+ #
130
+ # Identifiers may be any unicode character except for the following:
131
+ # Whitespace ! " # % & ' ( ) * + , . / ; < = > @ [ \ ] ^ ` { | } ~
132
+ #
133
+ rule /([^\s!-#%-,.\/;->@\[-^`{-~]+)/, :expression do |str|
129
134
  [ :LITERAL, str ]
130
135
  end
131
136
 
@@ -95,7 +95,7 @@ module FlavourSaver
95
95
  end
96
96
 
97
97
  class ParentCallNode < CallNode
98
- value :depth, Fixnum
98
+ value :depth, Integer
99
99
 
100
100
  def to_callnode
101
101
  CallNode.new(name,arguments)
@@ -1,3 +1,3 @@
1
1
  module FlavourSaver
2
- VERSION = "0.3.8"
2
+ VERSION = "0.3.9"
3
3
  end
@@ -766,7 +766,7 @@ describe FlavourSaver do
766
766
  let(:template) { "Message: {{hello \"world\" 12 true false}}" }
767
767
  before do
768
768
  FS.register_helper(:hello) do |param,times,bool1,bool2|
769
- times = "NaN" unless times.is_a? Fixnum
769
+ times = "NaN" unless times.is_a? Integer
770
770
  bool1 = "NaB" unless bool1 == true
771
771
  bool2 = "NaB" unless bool2 == false
772
772
  "Hello #{param} #{times} times: #{bool1} #{bool2}"
@@ -75,6 +75,27 @@ describe FlavourSaver::Lexer do
75
75
  end
76
76
  end
77
77
 
78
+ describe 'Identities' do
79
+
80
+ it 'supports as ruby methods' do
81
+ ids = %w( _ __ __123__ __ABC__ ABC123 Abc134def )
82
+ ids.each do |id|
83
+ subject = FlavourSaver::Lexer.lex "{{#{id}}}"
84
+ subject[1].type.should == :IDENT
85
+ subject[1].value.should == id
86
+ end
87
+ end
88
+
89
+ it 'maps non-ruby identities to literals' do
90
+ ids = %w( A-B 12_Mine - :example 0A test? )
91
+ ids.each do |id|
92
+ subject = FlavourSaver::Lexer.lex "{{#{id}}}"
93
+ subject[1].type.should == :LITERAL
94
+ subject[1].value.should == id
95
+ end
96
+ end
97
+ end
98
+
78
99
  describe '{{foo bar=(baz qux)}}' do
79
100
  subject { FlavourSaver::Lexer.lex '{{foo bar=(baz qux)}}' }
80
101
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flavour_saver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Harton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-18 00:00:00.000000000 Z
11
+ date: 2017-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -212,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
212
  version: '0'
213
213
  requirements: []
214
214
  rubyforge_project:
215
- rubygems_version: 2.4.5.1
215
+ rubygems_version: 2.6.11
216
216
  signing_key:
217
217
  specification_version: 4
218
218
  summary: Handlebars.js without the .js