qiita-markdown 1.1.1 → 1.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43439f5ff035232b9d8b129e7abe200e430d5df4a3130db8e2c74e2b0cf8ddf2
4
- data.tar.gz: d92793576cb2fca8201049baeb4ca21f7caaa90e8e3b381325714d17b09463fe
3
+ metadata.gz: ee1e7e37115360196ad00fb3c77a2c5857c46e3e201214df367d39d6f122347c
4
+ data.tar.gz: 3225e9cc689488509a74fef7884bacd84a769ec8b0917c2680d09a47b82ee765
5
5
  SHA512:
6
- metadata.gz: 31288999c19624a922be45857a6c80248f7756e17f0fd45e7c734cadd2871fce408607dfcbda94d1797f23ce3f0d084ccf5bff387061daf69c82d8c95ab199a0
7
- data.tar.gz: 6793705bc13ef157cb4055c8696b1fda3f18c658e4866beeefa593f2b34becd333b3893d3a46159542de1991246a5652ad0d46f735a1e9acaf14ee6878f49d16
6
+ metadata.gz: c177b38026f17c092ac7c5896bfdf09392073a130528fa7a20917fbd859fe60bf7e68f310a1720a57d75a2e5cdf2674ed57d5d5edb23173ad0233fc15bd62115
7
+ data.tar.gz: 151b887bad5f642f217e710b24c0789035c4fce9c2e44e7bd99c0b34c46eea5d6c852c02a88031ec0f20877bc83a09d4ee39fd685bf5477585798eb058639c9a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 1.1.2
4
+
5
+ - Add test for code_block filter
6
+ - Upgrade github-linguist from 4.x to 7.x
7
+
3
8
  ## 1.1.1
4
9
 
5
10
  - Allow open attribute on details
@@ -86,7 +86,7 @@ module Qiita
86
86
  end
87
87
 
88
88
  def linguist_language
89
- @linguist_language ||= Linguist::Language.find_by_filename(filename).first
89
+ @linguist_language ||= Linguist::Language.find_by_extension(filename).first
90
90
  end
91
91
 
92
92
  def sections
@@ -1,5 +1,5 @@
1
1
  module Qiita
2
2
  module Markdown
3
- VERSION = "1.1.1"
3
+ VERSION = "1.1.2"
4
4
  end
5
5
  end
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.add_dependency "addressable"
21
21
  spec.add_dependency "gemoji"
22
- spec.add_dependency "github-linguist", "~> 4.0"
22
+ spec.add_dependency "github-linguist", "~> 7.0"
23
23
  spec.add_dependency "html-pipeline", "~> 2.0"
24
24
  spec.add_dependency "mem"
25
25
  spec.add_dependency "qiita_marker", "~> 0.23.9"
@@ -0,0 +1,126 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe Qiita::Markdown::Filters::CodeBlock do
4
+ subject(:filter) { described_class.new(input_html) }
5
+
6
+ let(:context) { nil }
7
+
8
+ context "without code" do
9
+ let(:input_html) do
10
+ <<~HTML
11
+ <pre>
12
+ </pre>
13
+ HTML
14
+ end
15
+
16
+ it "does not change" do
17
+ expect(filter.call.to_s).to eq(input_html)
18
+ end
19
+ end
20
+
21
+ context "with code" do
22
+ let(:input_html) do
23
+ <<~HTML
24
+ <pre><code>
25
+ </code></pre>
26
+ HTML
27
+ end
28
+
29
+ it "does not change" do
30
+ expect(filter.call.to_s).to eq(input_html)
31
+ end
32
+
33
+ context "with data-metadata" do
34
+ let(:input_html) do
35
+ <<~HTML
36
+ <pre><code data-metadata>
37
+ </code></pre>
38
+ HTML
39
+ end
40
+
41
+ it "does not change" do
42
+ expect(filter.call.to_s).to eq(input_html)
43
+ end
44
+
45
+ context "with data-metadata value" do
46
+ let(:input_html) do
47
+ <<~HTML
48
+ <pre><code data-metadata="ruby">
49
+ </code></pre>
50
+ HTML
51
+ end
52
+
53
+ let(:output_html) do
54
+ <<~HTML
55
+ <pre lang="ruby"><code data-metadata="ruby">
56
+ </code></pre>
57
+ HTML
58
+ end
59
+
60
+ it "adds lang on pre" do
61
+ expect(filter.call.to_s).to eq(output_html)
62
+ end
63
+
64
+ context "with value include filename" do
65
+ let(:input_html) do
66
+ <<~HTML
67
+ <pre><code data-metadata="ruby:abc.rb">
68
+ </code></pre>
69
+ HTML
70
+ end
71
+
72
+ let(:output_html) do
73
+ <<~HTML
74
+ <pre filename="abc.rb" lang="ruby"><code data-metadata="ruby:abc.rb">
75
+ </code></pre>
76
+ HTML
77
+ end
78
+
79
+ it "adds lang and filename on pre" do
80
+ expect(filter.call.to_s).to eq(output_html)
81
+ end
82
+ end
83
+ end
84
+
85
+ context "with data-metadata value like filename" do
86
+ let(:input_html) do
87
+ <<~HTML
88
+ <pre><code data-metadata="abc.rb">
89
+ </code></pre>
90
+ HTML
91
+ end
92
+
93
+ let(:output_html) do
94
+ <<~HTML
95
+ <pre filename="abc.rb" lang="ruby"><code data-metadata="abc.rb">
96
+ </code></pre>
97
+ HTML
98
+ end
99
+
100
+ it "adds lang and filename on pre" do
101
+ expect(filter.call.to_s).to eq(output_html)
102
+ end
103
+ end
104
+
105
+ context "with data-metadata value like filename without extension" do
106
+ let(:input_html) do
107
+ <<~HTML
108
+ <pre><code data-metadata="Dockerfile">
109
+ </code></pre>
110
+ HTML
111
+ end
112
+
113
+ let(:output_html) do
114
+ <<~HTML
115
+ <pre lang="Dockerfile"><code data-metadata="Dockerfile">
116
+ </code></pre>
117
+ HTML
118
+ end
119
+
120
+ it "adds lang and filename on pre" do
121
+ expect(filter.call.to_s).to eq(output_html)
122
+ end
123
+ end
124
+ end
125
+ end
126
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qiita-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-29 00:00:00.000000000 Z
11
+ date: 2024-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '4.0'
47
+ version: '7.0'
48
48
  type: :runtime
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: '4.0'
54
+ version: '7.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: html-pipeline
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -122,7 +122,7 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
- description:
125
+ description:
126
126
  email:
127
127
  - r7kamura@gmail.com
128
128
  executables: []
@@ -179,6 +179,7 @@ files:
179
179
  - lib/qiita/markdown/version.rb
180
180
  - qiita-markdown.gemspec
181
181
  - spec/qiita/markdown/filters/checkbox_spec.rb
182
+ - spec/qiita/markdown/filters/code_block_spec.rb
182
183
  - spec/qiita/markdown/filters/heading_anchor_spec.rb
183
184
  - spec/qiita/markdown/filters/html_toc_spec.rb
184
185
  - spec/qiita/markdown/filters/inline_code_color_spec.rb
@@ -191,7 +192,7 @@ licenses:
191
192
  - MIT
192
193
  metadata:
193
194
  rubygems_mfa_required: 'true'
194
- post_install_message:
195
+ post_install_message:
195
196
  rdoc_options: []
196
197
  require_paths:
197
198
  - lib
@@ -207,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
208
  version: '0'
208
209
  requirements: []
209
210
  rubygems_version: 3.2.33
210
- signing_key:
211
+ signing_key:
211
212
  specification_version: 4
212
213
  summary: Qiita-specified markdown processor.
213
214
  test_files: []