html-pipeline-negarmoji 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46edae81c4900008044d7ff883532cde0f6a35cd77bebdb59a902172ec7e1844
|
4
|
+
data.tar.gz: a8b0715ba49b667e32397d0682cc680b7a61e9a51804e1fba353202fb4f5b124
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0854ff1edddef1980d151489582236334deec0e025da2a205fca02b8d4ce5f90b34e0b3169a019a70a6f0319c1c36881aae4336f01e10c63826a2ce25e7b08e2'
|
7
|
+
data.tar.gz: 1788bc861cce092585d49c569bef4a52afb9fa2f1e78dad76ea3e18632c0de141bac8d097baeefabee60fceb5f2a0e12ef996d16ec60af13950e9278a354bf1b
|
@@ -88,16 +88,26 @@ module HTML
|
|
88
88
|
context[:extension] || "svg"
|
89
89
|
end
|
90
90
|
|
91
|
+
# Build a regexp that matches all valid :emoji: names.
|
92
|
+
def self.emoji_pattern
|
93
|
+
@emoji_pattern ||= %r!:(#{emoji_names.map { |name| Regexp.escape(name) }.join("|")}):!
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.emoji_names
|
97
|
+
Emoji.all.map(&:aliases).flatten.sort
|
98
|
+
end
|
99
|
+
|
91
100
|
private
|
92
101
|
|
93
102
|
# Build an emoji image tag
|
94
103
|
def emoji_image_tag(name)
|
95
104
|
require "active_support/core_ext/hash/indifferent_access"
|
96
|
-
html_attrs =
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
105
|
+
html_attrs = default_img_attrs(name)
|
106
|
+
.merge!((context[:img_attrs] || {}).with_indifferent_access)
|
107
|
+
.map do |attr, value|
|
108
|
+
!value.nil? && %(#{attr}="#{value.respond_to?(:call) && value.call(name) || value}")
|
109
|
+
end
|
110
|
+
.reject(&:blank?).join(" ")
|
101
111
|
|
102
112
|
"<img #{html_attrs}>"
|
103
113
|
end
|
@@ -137,17 +147,6 @@ module HTML
|
|
137
147
|
DEFAULT_IGNORED_ANCESTOR_TAGS
|
138
148
|
end
|
139
149
|
end
|
140
|
-
|
141
|
-
class << self
|
142
|
-
# Build a regexp that matches all valid :emoji: names.
|
143
|
-
def self.emoji_pattern
|
144
|
-
@emoji_pattern ||= %r!:(#{emoji_names.map { |name| Regexp.escape(name) }.join("|")}):!
|
145
|
-
end
|
146
|
-
|
147
|
-
def self.emoji_names
|
148
|
-
Emoji.all.map(&:aliases).flatten.sort
|
149
|
-
end
|
150
|
-
end
|
151
150
|
end
|
152
151
|
end
|
153
152
|
end
|