hiccdown 1.2.1 → 1.2.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hiccdown.rb +10 -12
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f176ea8bf71818e2dcf2e3c6c011639e68fcae488c0b9c488e19900a7739957c
4
- data.tar.gz: c54d3c82e6425a03d2579d864f7d857dd21084b6d72119b57fffe9dd941fe027
3
+ metadata.gz: 511a111c1a785fbf4e2bed70428763c957c864e2dfcb266aadd96df96cc11a01
4
+ data.tar.gz: 05bdf9c2dcc2e6ac2ca576b9b3e275301c33dff7724754dabd3aeacf919c7abe
5
5
  SHA512:
6
- metadata.gz: 4b163285641c753cb155824b7673fd3e6d4da312c20dfe4743e68523bfab54a54e46c95215ba0667659538ba552f593c1fd07f6bd6c672e80232d418251b75c3
7
- data.tar.gz: 378ce99f489b180130c2fc0b076d603f06cd1370763082f0252c78b6ea8bb63547ca4c58ce8172ed598b8502f2abd01b8951aa4b7b18433653dd58ac6075a31c
6
+ metadata.gz: 686991790952e22669ee7f050571744d62c8ea9191e9f623f5e4d9e63aeaf437f96fdaff2e19e82b4e9c103a7e40c758e0452000086b77e23061e7fbae2a3eb5
7
+ data.tar.gz: 55b1aa42edf4b366a0c7b1d543eaf8c9886c7794a5b536020a6cd68c436fb82697a2ad50639af016b7945cbda1d8b295cde03efc0e6c209eb5cdc475f6d65e39
data/lib/hiccdown.rb CHANGED
@@ -14,19 +14,17 @@ module Hiccdown
14
14
 
15
15
  module MethodOverrides
16
16
  def self.prepended(base)
17
- # button_to and link_to use content_tag internally so need no explicit mention.
18
- # TODO: form_for and form_with use `tag` (https://apidock.com/rails/ActionView/Helpers/TagHelper/tag)
19
- # Any way to override that instead?
20
- [:content_tag, :form_for, :form_with].each do |method_name|
21
- define_method(method_name) do |*args, **kwargs, &block|
22
- if block
23
- super(*args, **kwargs) do |*brgs, **jwargs|
24
- result = block.call(*brgs, *jwargs)
25
- result.is_a?(Array) ? Hiccdown::to_html(result).html_safe : result
26
- end
27
- else
28
- super(*args, **kwargs)
17
+ # `capture` is at the root of seemingly all Rails methods tasked with
18
+ # rendering content, including `content_tag` and `tag`, which in turn
19
+ # are used for `link_to`, `form_for`, etc.
20
+ define_method(:capture) do |*args, **kwargs, &block|
21
+ if block
22
+ super(*args, **kwargs) do |*brgs, **jwargs|
23
+ result = block.call(*brgs, *jwargs)
24
+ result.is_a?(Array) ? Hiccdown::to_html(result).html_safe : result
29
25
  end
26
+ else
27
+ super(*args, **kwargs)
30
28
  end
31
29
  end
32
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiccdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dennis Hackethal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-24 00:00:00.000000000 Z
11
+ date: 2024-07-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Generates an HTML string from a Hiccup structure and improves Rails views.
14
14
  email: engineering@dennishackethal.com