html-pipeline-mrkdwn 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/CHANGELOG.md +11 -0
- data/Gemfile +0 -4
- data/Rakefile +8 -10
- data/lib/html/pipeline/mrkdwn/mrkdwn_filter.rb +5 -6
- data/lib/html/pipeline/mrkdwn/version.rb +2 -2
- data/lib/html/pipeline/mrkdwn.rb +1 -0
- metadata +46 -4
- data/Gemfile.lock +0 -70
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ad6c12052b9c8061380dcf42787ee664e577f77429634aabe4ae61fa911273a
|
4
|
+
data.tar.gz: b93112abcd6b677bcf95163e9280571808b7f97c626e6edd8ccacf480b4e1613
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e3028d346895108b8ab924367ba21738d1c931d06654d669744f71580e2cc4a7d590637bff2e0c189358ccb7f364f65f87b3a74ce135e6424c478de71985117
|
7
|
+
data.tar.gz: accd551e6c889a17df9695d8bb8aca76b2bef5226d62d27e6e0c7bda41437e54eb15f9fc5ab21ef55ee86268da663a4beb5358eca7114f73b6d87988ce63710b
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.1.6] - 2023-01-19
|
4
|
+
|
5
|
+
- Add test_helper.rb
|
6
|
+
- Move all dev deps from Gemfile to gemspec
|
7
|
+
- Switch test filename convention to test_*
|
8
|
+
|
9
|
+
## [0.1.5] - 2023-01-17
|
10
|
+
|
11
|
+
- Add *.gem to .gitignore
|
12
|
+
- Switch from RSpec to Minitest
|
13
|
+
|
3
14
|
## [0.1.4] - 2022-12-28
|
4
15
|
|
5
16
|
- Move pipeline.rb into /helpers
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,18 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
RuboCop::RakeTask.new
|
8
|
-
|
9
|
-
require "minitest/test_task"
|
10
|
-
|
11
|
-
Minitest::TestTask.create(:test) do |t|
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
12
7
|
t.libs << "test"
|
13
8
|
t.libs << "lib"
|
14
|
-
t.
|
15
|
-
t.test_globs = ["test/**/*_test.rb"]
|
9
|
+
t.test_files = FileList["test/**/test_*.rb"]
|
16
10
|
end
|
17
11
|
|
18
|
-
|
12
|
+
require "rubocop/rake_task"
|
13
|
+
|
14
|
+
RuboCop::RakeTask.new
|
15
|
+
|
16
|
+
task default: %i[test rubocop]
|
@@ -1,12 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "html/pipeline"
|
4
3
|
require "gemoji"
|
5
4
|
|
6
5
|
module HTML
|
7
6
|
class Pipeline
|
8
7
|
# HTML Filter for converting Slack's `mrkdwn` markup language.
|
9
|
-
#https://api.slack.com/reference/surfaces/formatting#basics
|
8
|
+
# https://api.slack.com/reference/surfaces/formatting#basics
|
10
9
|
#
|
11
10
|
# Context options:
|
12
11
|
# :emoji_image_tag - a Proc that returns an `img` tag for custom Emoji
|
@@ -124,7 +123,7 @@ module HTML
|
|
124
123
|
content.gsub CODE_PATTERN do |match|
|
125
124
|
text = Regexp.last_match[1]
|
126
125
|
|
127
|
-
if text&.match(/\A
|
126
|
+
if text&.match(/\A`+\Z/) # ignore runs of backquotes
|
128
127
|
match
|
129
128
|
else
|
130
129
|
"<code>#{text}</code>"
|
@@ -148,10 +147,10 @@ module HTML
|
|
148
147
|
(text, klass, prefix) =
|
149
148
|
case mention
|
150
149
|
when /\A#(C.+)\Z/ # slack channels
|
151
|
-
[
|
150
|
+
[@slack_channels.dig(Regexp.last_match[1]) || Regexp.last_match[1], "channel", "#"]
|
152
151
|
|
153
152
|
when /\A@([UB].+)\Z/ # slack users or bots
|
154
|
-
[
|
153
|
+
[@slack_users.dig(Regexp.last_match[1]) || Regexp.last_match[1], "user", "@"]
|
155
154
|
|
156
155
|
when /\A!(here|channel|everyone)\Z/ # special mentions
|
157
156
|
[Regexp.last_match[1], "mention", "@"]
|
@@ -185,7 +184,7 @@ module HTML
|
|
185
184
|
emoji = Emoji.find_by_alias(Regexp.last_match[1])
|
186
185
|
|
187
186
|
if emoji
|
188
|
-
emoji.raw ||
|
187
|
+
emoji.raw || @emoji_image_tag.call(emoji) || match
|
189
188
|
else
|
190
189
|
match
|
191
190
|
end
|
data/lib/html/pipeline/mrkdwn.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Gorst
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: escape_utils
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 2.14.3
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.4.4
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.4.4
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: minitest
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +94,34 @@ dependencies:
|
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: 5.2.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 13.0.6
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 13.0.6
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.43.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.43.0
|
83
125
|
description: An HTML::Pipeline filter for Slack's mrkdwn markup language.
|
84
126
|
email: jason.gorst@me.com
|
85
127
|
executables:
|
@@ -91,7 +133,6 @@ files:
|
|
91
133
|
- CHANGELOG.md
|
92
134
|
- CODE_OF_CONDUCT.md
|
93
135
|
- Gemfile
|
94
|
-
- Gemfile.lock
|
95
136
|
- LICENSE.txt
|
96
137
|
- README.md
|
97
138
|
- Rakefile
|
@@ -107,6 +148,7 @@ metadata:
|
|
107
148
|
homepage_uri: https://github.com/jasongorst/html-pipeline-mrkdwn
|
108
149
|
source_code_uri: https://github.com/jasongorst/html-pipeline-mrkdwn.git
|
109
150
|
changelog_uri: https://github.com/jasongorst/html-pipeline-mrkdwn/blob/main/CHANGELOG.md
|
151
|
+
rubygems_mfa_required: 'true'
|
110
152
|
post_install_message:
|
111
153
|
rdoc_options: []
|
112
154
|
require_paths:
|
@@ -122,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
164
|
- !ruby/object:Gem::Version
|
123
165
|
version: '0'
|
124
166
|
requirements: []
|
125
|
-
rubygems_version: 3.4.
|
167
|
+
rubygems_version: 3.4.4
|
126
168
|
signing_key:
|
127
169
|
specification_version: 4
|
128
170
|
summary: An HTML::Pipeline filter for Slack's mrkdwn markup language.
|
data/Gemfile.lock
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
html-pipeline-mrkdwn (0.1.4)
|
5
|
-
escape_utils (~> 1.3.0)
|
6
|
-
gemoji (~> 4.0.1)
|
7
|
-
html-pipeline (~> 2.14.3)
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
activesupport (7.0.4)
|
13
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
-
i18n (>= 1.6, < 2)
|
15
|
-
minitest (>= 5.1)
|
16
|
-
tzinfo (~> 2.0)
|
17
|
-
ast (2.4.2)
|
18
|
-
concurrent-ruby (1.1.10)
|
19
|
-
escape_utils (1.3.0)
|
20
|
-
gemoji (4.0.1)
|
21
|
-
html-pipeline (2.14.3)
|
22
|
-
activesupport (>= 2)
|
23
|
-
nokogiri (>= 1.4)
|
24
|
-
i18n (1.12.0)
|
25
|
-
concurrent-ruby (~> 1.0)
|
26
|
-
json (2.6.3)
|
27
|
-
mini_portile2 (2.8.1)
|
28
|
-
minitest (5.17.0)
|
29
|
-
minitest-rg (5.2.0)
|
30
|
-
minitest (~> 5.0)
|
31
|
-
nokogiri (1.13.10)
|
32
|
-
mini_portile2 (~> 2.8.0)
|
33
|
-
racc (~> 1.4)
|
34
|
-
parallel (1.22.1)
|
35
|
-
parser (3.1.3.0)
|
36
|
-
ast (~> 2.4.1)
|
37
|
-
racc (1.6.2)
|
38
|
-
rainbow (3.1.1)
|
39
|
-
rake (13.0.6)
|
40
|
-
regexp_parser (2.6.1)
|
41
|
-
rexml (3.2.5)
|
42
|
-
rubocop (1.41.1)
|
43
|
-
json (~> 2.3)
|
44
|
-
parallel (~> 1.10)
|
45
|
-
parser (>= 3.1.2.1)
|
46
|
-
rainbow (>= 2.2.2, < 4.0)
|
47
|
-
regexp_parser (>= 1.8, < 3.0)
|
48
|
-
rexml (>= 3.2.5, < 4.0)
|
49
|
-
rubocop-ast (>= 1.23.0, < 2.0)
|
50
|
-
ruby-progressbar (~> 1.7)
|
51
|
-
unicode-display_width (>= 1.4.0, < 3.0)
|
52
|
-
rubocop-ast (1.24.0)
|
53
|
-
parser (>= 3.1.1.0)
|
54
|
-
ruby-progressbar (1.11.0)
|
55
|
-
tzinfo (2.0.5)
|
56
|
-
concurrent-ruby (~> 1.0)
|
57
|
-
unicode-display_width (2.3.0)
|
58
|
-
|
59
|
-
PLATFORMS
|
60
|
-
arm64-darwin-22
|
61
|
-
|
62
|
-
DEPENDENCIES
|
63
|
-
html-pipeline-mrkdwn!
|
64
|
-
minitest (~> 5.17.0)
|
65
|
-
minitest-rg (~> 5.2.0)
|
66
|
-
rake (~> 13.0)
|
67
|
-
rubocop (~> 1.21)
|
68
|
-
|
69
|
-
BUNDLED WITH
|
70
|
-
2.4.1
|