handlebarsjs 0.5.2 → 0.5.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/CHANGELOG.md +22 -0
- data/lib/_.rb +2 -1
- data/lib/handlebarsjs/configuration.rb +32 -0
- data/lib/handlebarsjs/handlebars.rb +7 -2
- data/lib/handlebarsjs/helpers/inflection/pluralize_number.rb +17 -0
- data/lib/handlebarsjs/helpers/inflection/pluralize_number_word.rb +17 -0
- data/lib/handlebarsjs/version.rb +1 -1
- data/lib/handlebarsjs.rb +1 -0
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +4 -3
- data/lib/handlebarsjs/api.rb +0 -7
- data/lib/handlebarsjs/helpers/inflection/pluralize_by_number.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54e7659dac2a8cf398062a6d60ab21cb9532fd1f5bdac94d8b1ba203b0f69718
|
4
|
+
data.tar.gz: 2af427025be5ca3b734be0bb3d184d9bdc17d7fe56e6a6ef2bcd7cdc6d59750e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d180450d15b7d6a700189d147e850466e78d8252fe0d4bed01e335cd294a2cda3f2bd206bc8bc34cfd334c2f102c28e50862d10846f55e47d9d4fcca2019827
|
7
|
+
data.tar.gz: 51d88ab43e2a2c5c3bc80a453dcf9178d1c39859bdb5540d86bb667032f2ec197d0eb64a6cdf6861464296591e570df64cd7a13eb458d1cdafa274cd90acb557
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
## [0.5.4](https://github.com/klueless-io/handlebarsjs/compare/v0.5.3...v0.5.4) (2022-07-12)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* add inflection: pluralize_number and pluralize_number_word ([33ba59a](https://github.com/klueless-io/handlebarsjs/commit/33ba59a7b0ec86e29ed8ddd5bfd3bb5e91d18123))
|
7
|
+
|
8
|
+
## [0.5.3](https://github.com/klueless-io/handlebarsjs/compare/v0.5.2...v0.5.3) (2022-07-12)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* add inflection: pluralize_number and pluralize_number_word ([2f5d6e1](https://github.com/klueless-io/handlebarsjs/commit/2f5d6e11b8cc6cd052496ec3f648423fbacececf))
|
14
|
+
* add inflection: pluralize_number and pluralize_number_word ([6590859](https://github.com/klueless-io/handlebarsjs/commit/6590859ddfb3d3402677939d887e70e611d18a97))
|
15
|
+
|
16
|
+
## [0.5.2](https://github.com/klueless-io/handlebarsjs/compare/v0.5.1...v0.5.2) (2022-07-12)
|
17
|
+
|
18
|
+
|
19
|
+
### Bug Fixes
|
20
|
+
|
21
|
+
* add helper - case: * ([08dcad2](https://github.com/klueless-io/handlebarsjs/commit/08dcad20601bf578a17ae703d273a7081486df8e))
|
22
|
+
|
1
23
|
## [0.5.1](https://github.com/klueless-io/handlebarsjs/compare/v0.5.0...v0.5.1) (2022-07-06)
|
2
24
|
|
3
25
|
|
data/lib/_.rb
CHANGED
@@ -28,5 +28,6 @@ require_relative 'handlebarsjs/helpers/comparison/or'
|
|
28
28
|
require_relative 'handlebarsjs/helpers/inflection/ordinal'
|
29
29
|
require_relative 'handlebarsjs/helpers/inflection/ordinalize'
|
30
30
|
require_relative 'handlebarsjs/helpers/inflection/pluralize'
|
31
|
-
require_relative 'handlebarsjs/helpers/inflection/
|
31
|
+
require_relative 'handlebarsjs/helpers/inflection/pluralize_number'
|
32
|
+
require_relative 'handlebarsjs/helpers/inflection/pluralize_number_word'
|
32
33
|
require_relative 'handlebarsjs/helpers/inflection/singularize'
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Handlebarsjs
|
4
|
+
# Register this configuration access extension for Handlebars configuration
|
5
|
+
module HandlebarsConfigurationExtension
|
6
|
+
def handlebars
|
7
|
+
return @handlebars if defined? @handlebars
|
8
|
+
|
9
|
+
@handlebars = HandlebarsConfiguration.new
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# handlebars.handlebars_snapshot.add_helper(helper_name, helper)
|
14
|
+
# Structure for storing Cmdlet configuration
|
15
|
+
class HandlebarsConfiguration
|
16
|
+
include KLog::Logging
|
17
|
+
|
18
|
+
attr_accessor :helpers
|
19
|
+
|
20
|
+
def initialize
|
21
|
+
@helpers = []
|
22
|
+
end
|
23
|
+
|
24
|
+
HelperConfig = Struct.new(:name, :helper)
|
25
|
+
|
26
|
+
def helper(name, helper)
|
27
|
+
@helpers << HelperConfig.new(name, helper)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
KConfig::Configuration.register(:handlebars, Handlebarsjs::HandlebarsConfigurationExtension)
|
@@ -6,10 +6,15 @@ module Handlebarsjs
|
|
6
6
|
def initialize
|
7
7
|
super
|
8
8
|
# Handlebars 4.7.7
|
9
|
-
|
9
|
+
gem_path = Gem.loaded_specs['handlebarsjs'].full_gem_path
|
10
|
+
|
11
|
+
handlebars_lib_path = File.join(gem_path, Handlebarsjs::HANDLEBARS_LIBRARY_PATH)
|
12
|
+
handlebars_api_path = File.join(gem_path, Handlebarsjs::HANDLEBARS_API_PATH)
|
13
|
+
|
14
|
+
handlebars_snapshot.add_library('handlebars', path: handlebars_lib_path)
|
10
15
|
|
11
16
|
# Support functions for working with
|
12
|
-
handlebars_snapshot.add_library('handlebars-api', path:
|
17
|
+
handlebars_snapshot.add_library('handlebars-api', path: handlebars_api_path)
|
13
18
|
end
|
14
19
|
|
15
20
|
def process_template(template, options = {})
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Handlebarsjs
|
4
|
+
module Helpers
|
5
|
+
# Inflection handling routines, eg. pluralize, singular, ordinalize
|
6
|
+
module Inflection
|
7
|
+
# PluralizeNumber: Returns the plural form of the word based on a count in the format "categories"
|
8
|
+
class PluralizeNumber < Handlebarsjs::BaseHelper
|
9
|
+
register_cmdlet(Cmdlet::Inflection::PluralizeNumber)
|
10
|
+
|
11
|
+
def to_proc
|
12
|
+
->(value, count, _opts) { wrapper(cmdlet.call(value, count)) }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Handlebarsjs
|
4
|
+
module Helpers
|
5
|
+
# Inflection handling routines, eg. pluralize, singular, ordinalize
|
6
|
+
module Inflection
|
7
|
+
# PluralizeNumberWord: Returns the plural form of the word based on a count with the count prefixed in the format "3 categories"
|
8
|
+
class PluralizeNumberWord < Handlebarsjs::BaseHelper
|
9
|
+
register_cmdlet(Cmdlet::Inflection::PluralizeNumberWord)
|
10
|
+
|
11
|
+
def to_proc
|
12
|
+
->(value, count, _opts) { wrapper(cmdlet.call(value, count)) }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/handlebarsjs/version.rb
CHANGED
data/lib/handlebarsjs.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'mini_racer'
|
4
4
|
require 'cmdlet'
|
5
5
|
require_relative 'handlebarsjs/version'
|
6
|
+
require_relative 'handlebarsjs/configuration'
|
6
7
|
require_relative 'handlebarsjs/javascript'
|
7
8
|
require_relative 'handlebarsjs/handlebars_snapshot'
|
8
9
|
require_relative 'handlebarsjs/handlebars'
|
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "handlebarsjs",
|
3
|
-
"version": "0.5.
|
3
|
+
"version": "0.5.5",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "handlebarsjs",
|
9
|
-
"version": "0.5.
|
9
|
+
"version": "0.5.5",
|
10
10
|
"devDependencies": {
|
11
11
|
"@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
|
12
12
|
"@semantic-release/changelog": "^6.0.1",
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: handlebarsjs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
@@ -91,8 +91,8 @@ files:
|
|
91
91
|
- docs/project-plan/project_in_progress.svg
|
92
92
|
- lib/_.rb
|
93
93
|
- lib/handlebarsjs.rb
|
94
|
-
- lib/handlebarsjs/api.rb
|
95
94
|
- lib/handlebarsjs/base_helper.rb
|
95
|
+
- lib/handlebarsjs/configuration.rb
|
96
96
|
- lib/handlebarsjs/handlebars.rb
|
97
97
|
- lib/handlebarsjs/handlebars_snapshot.rb
|
98
98
|
- lib/handlebarsjs/helpers/array/join.rb
|
@@ -123,7 +123,8 @@ files:
|
|
123
123
|
- lib/handlebarsjs/helpers/inflection/ordinal.rb
|
124
124
|
- lib/handlebarsjs/helpers/inflection/ordinalize.rb
|
125
125
|
- lib/handlebarsjs/helpers/inflection/pluralize.rb
|
126
|
-
- lib/handlebarsjs/helpers/inflection/
|
126
|
+
- lib/handlebarsjs/helpers/inflection/pluralize_number.rb
|
127
|
+
- lib/handlebarsjs/helpers/inflection/pluralize_number_word.rb
|
127
128
|
- lib/handlebarsjs/helpers/inflection/singularize.rb
|
128
129
|
- lib/handlebarsjs/javascript.rb
|
129
130
|
- lib/handlebarsjs/javascript/handlebars-4.7.7.js
|
data/lib/handlebarsjs/api.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Handlebarsjs
|
4
|
-
module Helpers
|
5
|
-
# Inflection handling routines, eg. pluralize, singular, ordinalize
|
6
|
-
module Inflection
|
7
|
-
# PluralizeByNumber: Returns the plural form of the word based on a count
|
8
|
-
class PluralizeByNumber < Handlebarsjs::BaseHelper
|
9
|
-
register_cmdlet(Cmdlet::Inflection::PluralizeByNumber)
|
10
|
-
|
11
|
-
def to_proc
|
12
|
-
->(value, count, format, _opts) { wrapper(cmdlet.call(value, count, format)) }
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|