html-pipeline-mrkdwn 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/html/pipeline/mrkdwn/mrkdwn_filter.rb +17 -14
- data/lib/html/pipeline/mrkdwn/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 865e7c4e26f60927fe0ee325097aead119cffa7ae67bb8c607ec515516a81484
|
4
|
+
data.tar.gz: 899c386db5debf2898fe4e7a42aebe1332a09456bb6dde00a9b64f15fa659dbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72a042625fb8173c6b645ad0d1620b18a928ef36849f7e62593a52a1ce728ae033d137c89c4858da6d69da8acdb208966163385d463222d481b602c373d71ebc
|
7
|
+
data.tar.gz: 1c00cc52f3bfed425c2aecc6363ccdeb94e7bbf4062382f7b940fa16e20b48deb91543f82451da2c0ef57d16798cc5c1f82e5919bf3dd90c3be907f319d47dc6
|
@@ -14,6 +14,10 @@ module HTML
|
|
14
14
|
class Mrkdwn < Filter
|
15
15
|
attr_reader :large_emoji
|
16
16
|
|
17
|
+
EMOJI_AND_WHITESPACE_PATTERN = /(?::[\w+-_]+?:|\s)+/.freeze
|
18
|
+
|
19
|
+
NON_CAPTURING_EMOJI_PATTERN = /:[\w+-_]+?:/.freeze
|
20
|
+
|
17
21
|
MULTILINE_CODE_PATTERN = /```(.+?)```/m.freeze
|
18
22
|
|
19
23
|
CODE_PATTERN = /`(?=\S)(.+?)(?<=\S)`/.freeze
|
@@ -37,10 +41,6 @@ module HTML
|
|
37
41
|
|
38
42
|
EMOJI_PATTERN = /:([\w+-_]+?):/.freeze
|
39
43
|
|
40
|
-
EMOJI_AND_WHITESPACE_PATTERN = /(?::[\w+-_]+?:|\s)+/.freeze
|
41
|
-
|
42
|
-
NON_CAPTURING_EMOJI_PATTERN = /:[\w+-_]+?:/.freeze
|
43
|
-
|
44
44
|
STYLE_PATTERN = /
|
45
45
|
([`*_~])
|
46
46
|
(?=\S)(.+?)(?<=\S)
|
@@ -57,7 +57,8 @@ module HTML
|
|
57
57
|
link: %w[<],
|
58
58
|
line_break: %W[\n \r\n],
|
59
59
|
emoji: %w[:],
|
60
|
-
style: %w[* _ ~]
|
60
|
+
style: %w[* _ ~],
|
61
|
+
unescape: %w[&lowbar;]
|
61
62
|
}.freeze
|
62
63
|
|
63
64
|
def initialize(doc, context = nil, result = nil)
|
@@ -201,18 +202,16 @@ module HTML
|
|
201
202
|
content.gsub(EMOJI_PATTERN) do |match|
|
202
203
|
emoji = Emoji.find_by_alias(Regexp.last_match[1])
|
203
204
|
|
204
|
-
if emoji
|
205
|
-
if
|
206
|
-
|
207
|
-
@large_emoji_image_tag.call(emoji)
|
208
|
-
else
|
209
|
-
@emoji_image_tag.call(emoji)
|
210
|
-
end
|
205
|
+
if emoji&.custom?
|
206
|
+
if @large_emoji
|
207
|
+
@large_emoji_image_tag.call(emoji)
|
211
208
|
else
|
212
|
-
emoji
|
209
|
+
@emoji_image_tag.call(emoji)
|
213
210
|
end
|
211
|
+
elsif emoji
|
212
|
+
emoji.raw
|
214
213
|
else
|
215
|
-
match
|
214
|
+
match.gsub(/_/, "_")
|
216
215
|
end
|
217
216
|
end
|
218
217
|
end
|
@@ -239,6 +238,10 @@ module HTML
|
|
239
238
|
end
|
240
239
|
end
|
241
240
|
|
241
|
+
def unescape_filter(content)
|
242
|
+
content.gsub("&lowbar;", "_")
|
243
|
+
end
|
244
|
+
|
242
245
|
private
|
243
246
|
|
244
247
|
def only_emoji_and_whitespace?(string)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html-pipeline-mrkdwn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Gorst
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: escape_utils
|