handlebars-helpers 0.0.65 → 0.0.70

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
  SHA256:
3
- metadata.gz: c662284c8c52e28de8f381e5dd2c4ee11bedee4034a2b701c0838075a7cead98
4
- data.tar.gz: 1af1502591258fefec9225591ad2bbbc1b7521d67ca17f777626a845f91328b4
3
+ metadata.gz: a34182c470d12ecf98184d74c9827ff4dd55a513b434cf4ba5c7879d79bdf870
4
+ data.tar.gz: 7778766cdae462020b6972cbb518a7e9ab16e9c4bc3f2e69f6cab7012ebafef9
5
5
  SHA512:
6
- metadata.gz: 30ba4275b1b9d8e7e9081ee45fd030b3dc0722e2800fcd6bbe75e855ee8d48345965fdd221b84b849acca670b89b2ad9abeaef1b47ba7f2bf65a5883624f012d
7
- data.tar.gz: 1a0a23d9573b925dc90f5defc122151870bf76504bc242807784509bc2219efb4f15d8c41868788926ca722a025fceec303b1e36ad6d6f946ee24d9b1bd2cb5b
6
+ metadata.gz: 89e7384b433468acbd725780d0cc7031b66d086f2a27fd7b3ca334869114001dc080a4cfc0b6b83bf780e2649240eababefae39cc0c05db89a3c2bdba0e22284
7
+ data.tar.gz: 6ff46fde0b72fd6edacd5a47d9074ca591ddee60efae059beab607ca354fb55f98e7dc6d6100c181f1ecb017134a4b23d47c2ad26fb76e9277874350fdf3f9d1
@@ -19,7 +19,6 @@ jobs:
19
19
  # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
20
20
  # change this to (see https://github.com/ruby/setup-ruby#versioning):
21
21
  uses: ruby/setup-ruby@v1
22
- # uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
23
22
  with:
24
23
  ruby-version: 2.6
25
24
  # bundler-cache: true # runs 'bundle install' and caches installed gems automatically
@@ -353,6 +353,61 @@
353
353
  }
354
354
  ]
355
355
  },
356
+ {
357
+ "active": true,
358
+ "name": "misc",
359
+ "base_require": "handlebars/helpers/misc",
360
+ "base_namespace": "Handlebars::Helpers::Misc",
361
+ "description": "Miscellaneous handling routines",
362
+ "examples": [
363
+ "https://github.com/helpers/handlebars-helpers/blob/master/lib/misc.js",
364
+ "https://github.com/helpers/handlebars-helpers/blob/master/test/misc.js"
365
+ ],
366
+ "helpers": [
367
+ {
368
+ "name": "safe",
369
+ "description": "value in safe string format",
370
+ "test_in": null,
371
+ "test_out": null,
372
+ "tests": [
373
+ {
374
+ "alias": "safe",
375
+ "expected_value": "\"hello\"",
376
+ "params": [{ "name": "value", "value": "\"hello\"" }],
377
+ "template": "{{safe value}}"
378
+ }
379
+ ],
380
+ "aliases": ["safe"],
381
+ "require_path": "handlebars/helpers/misc/safe",
382
+ "class_namespace": "Handlebars::Helpers::Misc::Safe",
383
+ "is_string_formatter": null
384
+ },
385
+ {
386
+ "name": "noop",
387
+ "description": "NoOp is a wrapper for blocks that does nothing, it is useful with the raw output operator",
388
+ "test_in": null,
389
+ "test_out": null,
390
+ "tests": [
391
+ {
392
+ "alias": "noop",
393
+ "expected_value": "{{no_parse}}",
394
+ "params": [],
395
+ "template": "{{{{noop}}}}{{no_parse}}{{{{/noop}}}}"
396
+ },
397
+ {
398
+ "alias": "raw",
399
+ "expected_value": "{{no_parse}}",
400
+ "params": [],
401
+ "template": "{{{{raw}}}}{{no_parse}}{{{{/raw}}}}"
402
+ }
403
+ ],
404
+ "aliases": ["noop", "raw"],
405
+ "require_path": "handlebars/helpers/misc/noop",
406
+ "class_namespace": "Handlebars::Helpers::Misc::Noop",
407
+ "is_string_formatter": null
408
+ }
409
+ ]
410
+ },
356
411
  {
357
412
  "active": true,
358
413
  "name": "code_ruby",
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Handlebars Helpers
2
2
 
3
- > Handlebars Helpers is a library that provides (x) handlebars helpers across (y) categories, it was built to complement [cowboyd/handlebars.rb](https://github.com/cowboyd/handlebars.rb) with Ruby helpers commonly found in the Javascript community
3
+ > Handlebars Helpers is a library that provides <b>$HELPER_COUNT$</b> handlebars helpers across <b>$HELPER_CATEGORY_COUNT$</b> categories, it was built to complement [cowboyd/handlebars.rb](https://github.com/cowboyd/handlebars.rb) with Ruby helpers commonly found in the Javascript community
4
+
5
+ This GEM is inspired by the Javascript Library [handlebars-helpers](https://github.com/helpers/handlebars-helpers).
6
+
7
+ I am following a lot of the categories found there, but this GEM is not a one for one match to the existing JS library as I feel it is a bit dated and could use some new helpers and categories may be relevant today.
4
8
 
5
9
  ## Installation
6
10
 
@@ -46,7 +50,24 @@ class SomeRuby; end
46
50
 
47
51
  ## Development
48
52
 
49
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
53
+ Checkout the repo
54
+
55
+ ```bash
56
+ git clone klueless-io/handlebars-helpers
57
+ ```
58
+
59
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
60
+
61
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
62
+
63
+ ```bash
64
+ bin/console
65
+
66
+ irb(main):001:0> Handlebars::Helpers::Template.render('{{camel .}}', 'david was here')
67
+ # => "DavidWasHere"
68
+ irb(main):001:0> Handlebars::Helpers::Template.render('{{dasherize .}}', 'david was here')
69
+ # => "david-was-here"
70
+ ```
50
71
 
51
72
  `handlebars-helpers` is setup with Guard, run `guard`, this will watch development file changes and run tests automatically, if successful, it will then run rubocop for style quality.
52
73
 
data/STORIES.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Handlebars Helpers
2
2
 
3
- > Handlebars Helpers is a library that provides (x) handlebars helpers across (y) categories, it was built to complement [cowboyd/handlebars.rb](https://github.com/cowboyd/handlebars.rb) with Ruby helpers commonly found in the Javascript community
3
+ > Handlebars Helpers is a library that provides <b>5</b> handlebars helpers across <b>42</b> categories, it was built to complement [cowboyd/handlebars.rb](https://github.com/cowboyd/handlebars.rb) with Ruby helpers commonly found in the Javascript community
4
4
 
5
5
  As a Ruby Developer, I want to use HandlebarsJS with useful helpers, so that I have a rich templating experience
6
6
 
@@ -16,6 +16,7 @@ As a Documentor, I can create usage examples for this GEM, so that I can documen
16
16
 
17
17
  As a Developer, I can release a new version of the GEM, so that the updated Gem appears on rubygems and rubydoc
18
18
 
19
+ - gem release
19
20
  - research automated solution, eg. rake
20
21
  - implement the solution
21
22
 
@@ -26,12 +27,11 @@ As a Developer, I have flexible and modular formatters, so that I can format dat
26
27
 
27
28
  ### Tasks next on list
28
29
 
29
- add support for misc helper category
30
+ add support for string_formatter usage via STRING_FORMATTER.md
30
31
 
31
- - add noop/raw helper
32
- - add safe helper
32
+ add gem release rake task
33
33
 
34
- add support for category count, helper count and formatter count to readme.md
34
+ add support for category and helper count to readme.md
35
35
 
36
36
  ## Stories and tasks
37
37
 
@@ -53,6 +53,16 @@ As a Developer, I can load specific groups of helpers, so that memory consumptio
53
53
 
54
54
  ### Tasks - completed
55
55
 
56
+ check camel P02E04 has correct formatting
57
+
58
+ - tested alpha-numeric coded value with word separation (p02_ef4 &gt; P02Ef4)
59
+ - tested alpha-numeric coded value without word separation (p02ef4 &gt; P02ef4)
60
+
61
+ add support for misc helper category
62
+
63
+ - add noop/raw helper
64
+ - add safe helper
65
+
56
66
  refactor inflections namespace
57
67
 
58
68
  - Move pluralize and singularize to inflections
data/USAGE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Handlebars Helpers
2
2
 
3
- > Handlebars Helpers is a library that provides (x) handlebars helpers across (y) categories, it was built to complement [cowboyd/handlebars.rb](https://github.com/cowboyd/handlebars.rb) with Ruby helpers commonly found in the Javascript community
3
+ > Handlebars Helpers is a library that provides <b>5</b> handlebars helpers across <b>42</b> categories, it was built to complement [cowboyd/handlebars.rb](https://github.com/cowboyd/handlebars.rb) with Ruby helpers commonly found in the Javascript community
4
4
 
5
5
  As a Ruby Developer, I want to use HandlebarsJS with useful helpers, so that I have a rich templating experience
6
6
 
data/bin/console CHANGED
@@ -3,7 +3,7 @@
3
3
  # frozen_string_literal: true
4
4
 
5
5
  require 'bundler/setup'
6
- require 'handlebars_helpers'
6
+ require 'handlebars/helpers'
7
7
 
8
8
  # You can add fixtures and/or initialization code here to make experimenting
9
9
  # with your gem easier. You can also use a different console, if you like.
@@ -38,6 +38,13 @@ Gem::Specification.new do |spec|
38
38
  spec.require_paths = ['lib']
39
39
  # spec.extensions = ['ext/handlebars_helpers/extconf.rb']
40
40
 
41
+ spec.extra_rdoc_files = ['README.md', 'STORIES.md', 'USAGE.md']
42
+ spec.rdoc_options += [
43
+ '--title', 'handlebars-helpers by appydave.com',
44
+ '--main', 'README.md',
45
+ '--files STORIES.MD USAGE.MD'
46
+ ]
47
+
41
48
  # spec.add_dependency 'tty-box', '~> 0.5.0'
42
49
  spec.add_dependency 'activesupport'
43
50
  spec.add_dependency 'handlebars'
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ # reference: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/inflector/methods.rb
4
+ require 'active_support/core_ext/string'
5
+
6
+ require 'handlebars/helpers/base_helper'
7
+
8
+ module Handlebars
9
+ module Helpers
10
+ # Miscellaneous handling routines
11
+ module Misc
12
+ # NoOp is a wrapper for blocks, it does no additional processing.
13
+ # It is useful for embedding blocks into the output when using raw operators {{{{noop}}}}
14
+ class Noop < Handlebars::Helpers::BaseHelper
15
+ # # Parse will do nothing and return.
16
+ # # It is useful for embedding blocks into the output when using raw operators {{{{noop}}}}
17
+ # #
18
+ # # @example
19
+ # #
20
+ # # puts Noop.new.parse()
21
+ # #
22
+ # # @return does nothing, but will allow inner blocks to be processed
23
+ # def parse()
24
+ # end
25
+
26
+ def handlebars_helper
27
+ proc do |context, block|
28
+ # Handlebars::SafeString.new('<div class="bold">' + block.fn(context) + "</div>");
29
+
30
+ block.fn(context)
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # reference: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/inflector/methods.rb
4
+ require 'active_support/core_ext/string'
5
+
6
+ require 'handlebars/helpers/base_safe_string_helper'
7
+
8
+ module Handlebars
9
+ module Helpers
10
+ # Miscellaneous handling routines
11
+ module Misc
12
+ # Safe will return the value with <> and single and double quotes left as is
13
+ class Safe < Handlebars::Helpers::BaseSafeStringHelper
14
+ # Parse will return the value with <> and single and double quotes left as is
15
+ #
16
+ # @example
17
+ #
18
+ # puts Safe.new.parse('<hello>')
19
+ #
20
+ # <hello>
21
+ #
22
+ # @param [String] value that is considered a safe string
23
+ # @return [String] value in safe string format
24
+ def parse(value)
25
+ value = '' if value.nil?
26
+ value
27
+ end
28
+
29
+ def handlebars_helper
30
+ proc do |_context, value|
31
+ wrapper(parse(value))
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Handlebars
4
4
  module Helpers
5
- VERSION = '0.0.65'
5
+ VERSION = '0.0.70'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handlebars-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.65
4
+ version: 0.0.70
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-22 00:00:00.000000000 Z
11
+ date: 2021-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -44,7 +44,10 @@ email:
44
44
  - david@ideasmen.com.au
45
45
  executables: []
46
46
  extensions: []
47
- extra_rdoc_files: []
47
+ extra_rdoc_files:
48
+ - README.md
49
+ - STORIES.md
50
+ - USAGE.md
48
51
  files:
49
52
  - ".github/workflows/ruby.yml"
50
53
  - ".gitignore"
@@ -93,6 +96,8 @@ files:
93
96
  - lib/handlebars/helpers/inflection/pluralize.rb
94
97
  - lib/handlebars/helpers/inflection/pluralize_by_number.rb
95
98
  - lib/handlebars/helpers/inflection/singularize.rb
99
+ - lib/handlebars/helpers/misc/noop.rb
100
+ - lib/handlebars/helpers/misc/safe.rb
96
101
  - lib/handlebars/helpers/register_helpers.rb
97
102
  - lib/handlebars/helpers/string_formatting/append_if.rb
98
103
  - lib/handlebars/helpers/string_formatting/back_slash.rb
@@ -128,7 +133,12 @@ metadata:
128
133
  source_code_uri: https://github.com/klueless-io/handlebars-helpers
129
134
  changelog_uri: https://github.com/klueless-io/handlebars-helpers/commits/master
130
135
  post_install_message:
131
- rdoc_options: []
136
+ rdoc_options:
137
+ - "--title"
138
+ - handlebars-helpers by appydave.com
139
+ - "--main"
140
+ - README.md
141
+ - "--files STORIES.MD USAGE.MD"
132
142
  require_paths:
133
143
  - lib
134
144
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -142,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
152
  - !ruby/object:Gem::Version
143
153
  version: '0'
144
154
  requirements: []
145
- rubygems_version: 3.2.5
155
+ rubygems_version: 3.2.7
146
156
  signing_key:
147
157
  specification_version: 4
148
158
  summary: Handlebars Helpers provides (Nx) handlebars helpers across (Ny) categories