qiita-markdown 0.36.0 → 0.37.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/qiita/markdown/filters/custom_block.rb +3 -3
- data/lib/qiita/markdown/version.rb +1 -1
- data/spec/qiita/markdown/processor_spec.rb +14 -14
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a632599e029a2372e999818df8cf19474233cdafe5b0454b944d6fe93d4423ca
|
4
|
+
data.tar.gz: 6ee085f30d1b6008fe9ada38b62c91f6a7d5b68e0f656f20afdc69b5aa067c96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7d84a2dd88cd53380b8b7c5ec3264ae3cbcdf29c718031dfb9d22038d7349ffeaa2cba6e6a8654b3d357c4c7a28994fecdc51f8381cdbff276930a4238ab866
|
7
|
+
data.tar.gz: 78bcee81ab1f08a311e7bf73f9bcbe6c79234c0ed999da679c285f10d69d482bf9c6e3373b2eb39896e2b8cdcd0890631539adf9fe6bfe69250f84ddcd1f4df1
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,7 @@ module Qiita
|
|
2
2
|
module Markdown
|
3
3
|
module Filters
|
4
4
|
class CustomBlock < HTML::Pipeline::Filter
|
5
|
-
ALLOWED_TYPES = %
|
5
|
+
ALLOWED_TYPES = %w[note].freeze
|
6
6
|
|
7
7
|
def call
|
8
8
|
doc.search('div[data-type="customblock"]').each do |div|
|
@@ -24,7 +24,7 @@ module Qiita
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
class
|
27
|
+
class Note
|
28
28
|
attr_reader :node, :type
|
29
29
|
|
30
30
|
ALLOWED_TYPES = %w[info warn alert].freeze
|
@@ -39,7 +39,7 @@ module Qiita
|
|
39
39
|
|
40
40
|
def convert
|
41
41
|
node.inner_html = message
|
42
|
-
node["class"] = "
|
42
|
+
node["class"] = "note #{type}"
|
43
43
|
node.children.first.add_previous_sibling(icon) if icon
|
44
44
|
end
|
45
45
|
|
@@ -1710,23 +1710,23 @@ describe Qiita::Markdown::Processor do
|
|
1710
1710
|
end
|
1711
1711
|
end
|
1712
1712
|
|
1713
|
-
context "when type is
|
1714
|
-
let(:type) { "
|
1713
|
+
context "when type is note" do
|
1714
|
+
let(:type) { "note" }
|
1715
1715
|
|
1716
1716
|
context "when subtype is empty" do
|
1717
1717
|
if allowed
|
1718
|
-
it "returns info
|
1718
|
+
it "returns info note block with class including icon as default type" do
|
1719
1719
|
should eq <<-HTML.strip_heredoc
|
1720
|
-
<div data-type="customblock" data-metadata="
|
1720
|
+
<div data-type="customblock" data-metadata="note" class="note info">
|
1721
1721
|
<span class="fa fa-fw fa-check-circle"></span><p>Some kind of text is here.
|
1722
1722
|
</p>
|
1723
1723
|
</div>
|
1724
1724
|
HTML
|
1725
1725
|
end
|
1726
1726
|
else
|
1727
|
-
it "returns
|
1727
|
+
it "returns note block with class including icon" do
|
1728
1728
|
should eq <<-HTML.strip_heredoc
|
1729
|
-
<div class="
|
1729
|
+
<div class="note info">
|
1730
1730
|
<span class="fa fa-fw fa-check-circle"></span><p>Some kind of text is here.
|
1731
1731
|
</p>
|
1732
1732
|
</div>
|
@@ -1739,18 +1739,18 @@ describe Qiita::Markdown::Processor do
|
|
1739
1739
|
let(:subtype) { "warn" }
|
1740
1740
|
|
1741
1741
|
if allowed
|
1742
|
-
it "returns warning
|
1742
|
+
it "returns warning note block with class including icon" do
|
1743
1743
|
should eq <<-HTML.strip_heredoc
|
1744
|
-
<div data-type="customblock" data-metadata="
|
1744
|
+
<div data-type="customblock" data-metadata="note warn" class="note warn">
|
1745
1745
|
<span class="fa fa-fw fa-exclamation-circle"></span><p>Some kind of text is here.
|
1746
1746
|
</p>
|
1747
1747
|
</div>
|
1748
1748
|
HTML
|
1749
1749
|
end
|
1750
1750
|
else
|
1751
|
-
it "returns
|
1751
|
+
it "returns note block with class including icon" do
|
1752
1752
|
should eq <<-HTML.strip_heredoc
|
1753
|
-
<div class="
|
1753
|
+
<div class="note warn">
|
1754
1754
|
<span class="fa fa-fw fa-exclamation-circle"></span><p>Some kind of text is here.
|
1755
1755
|
</p>
|
1756
1756
|
</div>
|
@@ -1763,18 +1763,18 @@ describe Qiita::Markdown::Processor do
|
|
1763
1763
|
let(:subtype) { "alert" }
|
1764
1764
|
|
1765
1765
|
if allowed
|
1766
|
-
it "returns alerting
|
1766
|
+
it "returns alerting note block with class including icon" do
|
1767
1767
|
should eq <<-HTML.strip_heredoc
|
1768
|
-
<div data-type="customblock" data-metadata="
|
1768
|
+
<div data-type="customblock" data-metadata="note alert" class="note alert">
|
1769
1769
|
<span class="fa fa-fw fa-times-circle"></span><p>Some kind of text is here.
|
1770
1770
|
</p>
|
1771
1771
|
</div>
|
1772
1772
|
HTML
|
1773
1773
|
end
|
1774
1774
|
else
|
1775
|
-
it "returns
|
1775
|
+
it "returns note block with class including icon" do
|
1776
1776
|
should eq <<-HTML.strip_heredoc
|
1777
|
-
<div class="
|
1777
|
+
<div class="note alert">
|
1778
1778
|
<span class="fa fa-fw fa-times-circle"></span><p>Some kind of text is here.
|
1779
1779
|
</p>
|
1780
1780
|
</div>
|
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: 0.
|
4
|
+
version: 0.37.0
|
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: 2021-07-
|
11
|
+
date: 2021-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gemoji
|
@@ -234,7 +234,7 @@ dependencies:
|
|
234
234
|
- - '='
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: 0.49.1
|
237
|
-
description:
|
237
|
+
description:
|
238
238
|
email:
|
239
239
|
- r7kamura@gmail.com
|
240
240
|
executables: []
|
@@ -301,7 +301,7 @@ homepage: https://github.com/increments/qiita-markdown
|
|
301
301
|
licenses:
|
302
302
|
- MIT
|
303
303
|
metadata: {}
|
304
|
-
post_install_message:
|
304
|
+
post_install_message:
|
305
305
|
rdoc_options: []
|
306
306
|
require_paths:
|
307
307
|
- lib
|
@@ -316,8 +316,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
316
|
- !ruby/object:Gem::Version
|
317
317
|
version: '0'
|
318
318
|
requirements: []
|
319
|
-
rubygems_version: 3.
|
320
|
-
signing_key:
|
319
|
+
rubygems_version: 3.0.3
|
320
|
+
signing_key:
|
321
321
|
specification_version: 4
|
322
322
|
summary: Qiita-specified markdown processor.
|
323
323
|
test_files:
|