html_slice 0.2.5 → 0.2.6
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/lib/html_slice/rails.rb +25 -0
- data/lib/html_slice/version.rb +1 -1
- data/lib/html_slice.rb +6 -6
- metadata +4 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cc11400cb9377b56446b53449e22298145f8ae75f1815236f273c5cd48790350
|
|
4
|
+
data.tar.gz: ea3bdc2af9e052d6310e146da37f2653cbdeb13aee3859acf24f2a32366f632e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cc47edc7352f2224d0aea43d271e5ef453eceb4b0d74039562a20ec75714c93c03f4b20f62e4f349526975665257753348520879699bb650d6b6bc6bf58855a2
|
|
7
|
+
data.tar.gz: dc524fdfbca74a3efb70af174bd4860c7f4ee5df377e680dfd3cdbe2467a932183e2ab5faafc9498b95f7b94e4597fd138b3ba098b62cba58ffe44b9da62503d
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module HtmlSlice
|
|
4
|
+
module Rails
|
|
5
|
+
def self.included(base)
|
|
6
|
+
base.class_eval do
|
|
7
|
+
include ActionView::RecordIdentifier
|
|
8
|
+
include ActionView::Helpers::FormHelper
|
|
9
|
+
include ActionView::Helpers::FormOptionsHelper
|
|
10
|
+
include ActionView::Helpers::TranslationHelper
|
|
11
|
+
include ActionView::Helpers::UrlHelper
|
|
12
|
+
include ::Rails.application.routes.url_helpers
|
|
13
|
+
include HtmlSlice
|
|
14
|
+
|
|
15
|
+
def controller
|
|
16
|
+
nil
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def slice(slice_id = HtmlSlice::DEFAULT_SLICE, &block)
|
|
20
|
+
html_slice(slice_id, &block).html_safe
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
data/lib/html_slice/version.rb
CHANGED
data/lib/html_slice.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "html_slice/rails"
|
|
3
4
|
require_relative "html_slice/version"
|
|
4
5
|
require "cgi"
|
|
5
6
|
|
|
@@ -7,7 +8,7 @@ module HtmlSlice
|
|
|
7
8
|
class Error < StandardError; end
|
|
8
9
|
|
|
9
10
|
TAGS = %i[
|
|
10
|
-
div title embed meta br a em b i ul ol li img table tbody thead tr th td
|
|
11
|
+
div title embed meta br a em b i ul ol li img table tbody thead tr th td strong
|
|
11
12
|
form input button link h1 h2 h3 h4 h5 h6 hr span label iframe template main
|
|
12
13
|
footer aside source section small nav area
|
|
13
14
|
].freeze
|
|
@@ -100,11 +101,10 @@ module HtmlSlice
|
|
|
100
101
|
|
|
101
102
|
buffer << "<" << name_str
|
|
102
103
|
unless attributes.empty?
|
|
103
|
-
attributes_string = ATTRIBUTE_CACHE[attributes.dup] ||=
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
end
|
|
104
|
+
attributes_string = ATTRIBUTE_CACHE[attributes.dup] ||= attributes.map do |key, value|
|
|
105
|
+
" #{key.to_s.tr("_", "-")}='#{value}'"
|
|
106
|
+
end.join
|
|
107
|
+
|
|
108
108
|
buffer << attributes_string
|
|
109
109
|
end
|
|
110
110
|
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: html_slice
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- henrique-ft
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
12
|
description: Enable Ruby classes the ability to generate reusable pieces of html
|
|
14
13
|
email:
|
|
@@ -18,13 +17,12 @@ extensions: []
|
|
|
18
17
|
extra_rdoc_files: []
|
|
19
18
|
files:
|
|
20
19
|
- lib/html_slice.rb
|
|
20
|
+
- lib/html_slice/rails.rb
|
|
21
21
|
- lib/html_slice/version.rb
|
|
22
|
-
homepage:
|
|
23
22
|
licenses: []
|
|
24
23
|
metadata:
|
|
25
24
|
source_code_uri: https://github.com/henrique-ft/html_slice
|
|
26
25
|
changelog_uri: https://github.com/henrique-ft/html_slice/blob/master/CHANGELOG.md
|
|
27
|
-
post_install_message:
|
|
28
26
|
rdoc_options: []
|
|
29
27
|
require_paths:
|
|
30
28
|
- lib
|
|
@@ -39,8 +37,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
39
37
|
- !ruby/object:Gem::Version
|
|
40
38
|
version: '0'
|
|
41
39
|
requirements: []
|
|
42
|
-
rubygems_version:
|
|
43
|
-
signing_key:
|
|
40
|
+
rubygems_version: 4.0.6
|
|
44
41
|
specification_version: 4
|
|
45
42
|
summary: Enable Ruby classes the ability to generate reusable pieces of html
|
|
46
43
|
test_files: []
|