jekyll-html-pipeline 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +1 -1
- data/Gemfile +2 -0
- data/Rakefile +2 -0
- data/jekyll-html-pipeline.gemspec +11 -10
- data/lib/jekyll-html-pipeline.rb +31 -28
- data/test/support/new_pipeline.rb +4 -3
- data/test/test_helper.rb +2 -0
- data/test/test_jekyll_html_pipeline.rb +9 -2
- metadata +20 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2b68c087d6c971116151b9cc080cd3601f2e70717927013111bd749a534b6b9e
|
4
|
+
data.tar.gz: 65358ecaa2a0405aec653b30ed1cb926571608a3a3b1dedcc1db1adc354bbbdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49deee485bdd1655b9b65c15ee923232b110b65526c4f47295a726b40a01d098ab286c302f1546785de24490323516485ab520d2289b3b96b1ccf03920e79dfe
|
7
|
+
data.tar.gz: 29850947f93e911a98b974c89f31d312343937d967d004de6b3889683f1c61acbe1abba761bb4d1ff2128fae5defd2dac4cdb2a65ae6eea611d8979b1d6abe09
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,14 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
Gem::Specification.new do |spec|
|
2
4
|
spec.name = 'jekyll-html-pipeline'
|
3
|
-
spec.version = '1.1.
|
5
|
+
spec.version = '1.1.1'
|
4
6
|
spec.authors = ['Garen Torikian']
|
5
7
|
spec.email = ['gjtorikian@gmail.com']
|
6
|
-
spec.summary =
|
7
|
-
spec.description =
|
8
|
+
spec.summary = "Use GitHub's HTML::Pipeline, in Jekyll!"
|
9
|
+
spec.description = "This is a custom Markdown processor for Jekyll 2.0 and above. It allows you to use GitHub's HTML::Pipeline in your Jekyll projects. "
|
8
10
|
spec.homepage = 'https://github.com/gjtorikian/jekyll-html-pipeline'
|
9
11
|
spec.license = 'MIT'
|
10
12
|
|
11
|
-
spec.files = `git ls-files`.split(
|
13
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
12
14
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
13
15
|
spec.test_files = spec.files.grep(%r{^(test)/})
|
14
16
|
spec.require_paths = ['lib']
|
@@ -16,12 +18,11 @@ Gem::Specification.new do |spec|
|
|
16
18
|
spec.add_runtime_dependency 'jekyll', '~> 3.0'
|
17
19
|
spec.add_dependency 'html-pipeline', '~> 2.8'
|
18
20
|
|
19
|
-
spec.add_development_dependency 'bundler', '~> 1.4'
|
20
|
-
spec.add_development_dependency 'rake'
|
21
|
-
spec.add_development_dependency 'minitest', '~> 5.0'
|
22
21
|
spec.add_development_dependency 'commonmarker', '~> 0.17'
|
23
|
-
spec.add_development_dependency 'sanitize', '~> 2.0.6'
|
24
|
-
spec.add_development_dependency 'rubocop'
|
25
|
-
spec.add_development_dependency 'rubocop-github'
|
26
22
|
spec.add_development_dependency 'gemoji', '~> 2.0'
|
23
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
24
|
+
spec.add_development_dependency 'rake'
|
25
|
+
spec.add_development_dependency 'rubocop'
|
26
|
+
spec.add_development_dependency 'rubocop-standard'
|
27
|
+
spec.add_development_dependency 'sanitize', '~> 2.0.6'
|
27
28
|
end
|
data/lib/jekyll-html-pipeline.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Jekyll
|
2
4
|
module Converters
|
3
5
|
class Markdown::HTMLPipeline
|
@@ -5,66 +7,67 @@ module Jekyll
|
|
5
7
|
require 'html/pipeline'
|
6
8
|
@config = config
|
7
9
|
@errors = []
|
10
|
+
@setup = false
|
8
11
|
end
|
9
12
|
|
10
|
-
def filter_key(
|
11
|
-
|
13
|
+
def filter_key(key)
|
14
|
+
key.to_s.downcase.to_sym
|
12
15
|
end
|
13
16
|
|
14
|
-
def
|
15
|
-
|
17
|
+
def filter?(filter)
|
18
|
+
filter < HTML::Pipeline::Filter
|
16
19
|
rescue LoadError, ArgumentError
|
17
20
|
false
|
18
21
|
end
|
19
22
|
|
20
23
|
def symbolize_keys(hash)
|
21
|
-
hash.
|
24
|
+
hash.each_with_object({}) do |(key, value), result|
|
22
25
|
new_key = case key
|
23
26
|
when String then key.to_sym
|
24
27
|
else key
|
25
28
|
end
|
26
29
|
new_value = case value
|
27
30
|
when Hash then symbolize_keys(value)
|
31
|
+
when Array then value.map(&:to_sym)
|
28
32
|
else value
|
29
33
|
end
|
30
34
|
result[new_key] = new_value
|
31
|
-
|
32
|
-
}
|
35
|
+
end
|
33
36
|
end
|
34
37
|
|
35
38
|
def ensure_default_opts
|
36
39
|
@config['html_pipeline']['filters'] ||= ['markdownfilter']
|
37
|
-
@config['html_pipeline']['context'] ||= {'gfm' => true}
|
40
|
+
@config['html_pipeline']['context'] ||= { 'gfm' => true }
|
38
41
|
# symbolize strings as keys, which is what HTML::Pipeline wants
|
39
42
|
@config['html_pipeline']['context'] = symbolize_keys(@config['html_pipeline']['context'])
|
40
43
|
end
|
41
44
|
|
42
45
|
def setup
|
43
|
-
|
44
|
-
|
46
|
+
return if @setup
|
47
|
+
|
48
|
+
ensure_default_opts
|
45
49
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
59
|
-
rescue StandardError => e
|
60
|
-
raise LoadError.new(e)
|
50
|
+
filters = @config['html_pipeline']['filters'].map do |filter|
|
51
|
+
if filter?(filter)
|
52
|
+
filter
|
53
|
+
else
|
54
|
+
key = filter_key(filter)
|
55
|
+
begin
|
56
|
+
const_filter = HTML::Pipeline.constants.find { |c| c.downcase == key }
|
57
|
+
# probably a custom filter
|
58
|
+
if const_filter.nil?
|
59
|
+
Jekyll::Converters.const_get(filter)
|
60
|
+
else
|
61
|
+
HTML::Pipeline.const_get(const_filter)
|
61
62
|
end
|
63
|
+
rescue StandardError => e
|
64
|
+
raise LoadError, e
|
62
65
|
end
|
63
66
|
end
|
64
|
-
|
65
|
-
@parser = HTML::Pipeline.new(filters, @config['html_pipeline']['context'])
|
66
|
-
@setup = true
|
67
67
|
end
|
68
|
+
|
69
|
+
@parser = HTML::Pipeline.new(filters, @config['html_pipeline']['context'])
|
70
|
+
@setup = true
|
68
71
|
end
|
69
72
|
|
70
73
|
def convert(content)
|
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'html/pipeline'
|
2
4
|
|
3
5
|
class HelpMarkdownFilter < HTML::Pipeline::MarkdownFilter
|
4
|
-
|
5
6
|
def call
|
6
7
|
html = super
|
7
8
|
|
@@ -9,7 +10,7 @@ class HelpMarkdownFilter < HTML::Pipeline::MarkdownFilter
|
|
9
10
|
end
|
10
11
|
|
11
12
|
def format_callout!(html)
|
12
|
-
html.gsub!(
|
13
|
-
html.gsub!(
|
13
|
+
html.gsub!(%r{(?:<p>)?{{#(tip|warning|error)}}(?:</p>)?}, '<div class="alert \1">')
|
14
|
+
html.gsub!(%r{(?:<p>)?{{/(tip|warning|error)}}(?:</p>)?}, '</div>')
|
14
15
|
end
|
15
16
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,11 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test_helper'
|
2
4
|
|
3
5
|
class HTMLPipelineTest < Converter::HTMLPipelineTestCase
|
4
6
|
def setup
|
5
7
|
@config = {
|
6
8
|
'html_pipeline' => {
|
7
|
-
'filters' => [
|
8
|
-
'context' => {
|
9
|
+
'filters' => %w[markdownfilter sanitizationfilter emojifilter mentionfilter],
|
10
|
+
'context' => {
|
11
|
+
'asset_root' => 'http://foo.com/icons',
|
12
|
+
'base_url' => 'https://github.com/',
|
13
|
+
'commonmarker_extensions' => %w[table strikethrough tagfilter autolink]
|
14
|
+
}
|
15
|
+
},
|
9
16
|
'markdown' => 'HTMLPipeline'
|
10
17
|
}
|
11
18
|
@markdown = Jekyll::Converters::Markdown.new @config
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-html-pipeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -39,33 +39,33 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.8'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: commonmarker
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0.17'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0.17'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: gemoji
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
61
|
+
version: '2.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
68
|
+
version: '2.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: minitest
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,33 +81,19 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '5.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0.17'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0.17'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: sanitize
|
84
|
+
name: rake
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
|
-
- - "
|
87
|
+
- - ">="
|
102
88
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
89
|
+
version: '0'
|
104
90
|
type: :development
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
|
-
- - "
|
94
|
+
- - ">="
|
109
95
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
96
|
+
version: '0'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: rubocop
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,7 +109,7 @@ dependencies:
|
|
123
109
|
- !ruby/object:Gem::Version
|
124
110
|
version: '0'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
|
-
name: rubocop-
|
112
|
+
name: rubocop-standard
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
115
|
- - ">="
|
@@ -137,19 +123,19 @@ dependencies:
|
|
137
123
|
- !ruby/object:Gem::Version
|
138
124
|
version: '0'
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
126
|
+
name: sanitize
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
142
128
|
requirements:
|
143
129
|
- - "~>"
|
144
130
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
131
|
+
version: 2.0.6
|
146
132
|
type: :development
|
147
133
|
prerelease: false
|
148
134
|
version_requirements: !ruby/object:Gem::Requirement
|
149
135
|
requirements:
|
150
136
|
- - "~>"
|
151
137
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
138
|
+
version: 2.0.6
|
153
139
|
description: 'This is a custom Markdown processor for Jekyll 2.0 and above. It allows
|
154
140
|
you to use GitHub''s HTML::Pipeline in your Jekyll projects. '
|
155
141
|
email:
|
@@ -189,8 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
175
|
- !ruby/object:Gem::Version
|
190
176
|
version: '0'
|
191
177
|
requirements: []
|
192
|
-
|
193
|
-
rubygems_version: 2.6.12
|
178
|
+
rubygems_version: 3.1.2
|
194
179
|
signing_key:
|
195
180
|
specification_version: 4
|
196
181
|
summary: Use GitHub's HTML::Pipeline, in Jekyll!
|