qiita-markdown 0.42.0 → 0.43.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0430156d41ed0b17c5ba246e32ca78024e9d3fb834d8a003924a7e3526d9b278
4
- data.tar.gz: cb4ea8e9542c5aaeffed2f8d359c06e3e72c3ff08e90f9c97cf3c6bc9c3f7f63
3
+ metadata.gz: 925ca9666fc91e263d0b8fb4d704900d52b92964d6d53d63730d84403304df3b
4
+ data.tar.gz: 47a27d59b58ced30484eadfc1dd59bfb94f96673a6e5e20fafc76f19c10065ea
5
5
  SHA512:
6
- metadata.gz: 9488a97467616a4ca6e64a2483a4ba9789f3d69f1025aee5f5350a6baa6ada4e215de77af3dbb98f9ecb3a99c94680e6fc1dd7535a2acfccf70d82b1abd685db
7
- data.tar.gz: 414798bddd8fc8d76e9f77d8165cb96907969c77b0e8c2e2678cbfeb5e44f1d43e2d888447005a1c9b7195f56e2757aa99f4ac6712933cdf5ea986ba0511d813
6
+ metadata.gz: d0613208602c957acd488a6050095a5ba79cc085fa08a8c18aa6ea98711e3ca61313cd68a9d166308b4d1cdd6efabe98e8a364c92635c82084374d765b069759
7
+ data.tar.gz: 9ac8835a36b9871c02981d64ee335fd8e7a1a390825e81f5536e57af0b4d5be5d5004236d40f45409294a73a739aa01d0a814d9a30d5e20643b3c6a725682faf
@@ -11,6 +11,27 @@ permissions:
11
11
  contents: read
12
12
 
13
13
  jobs:
14
+ codeclimate:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - name: Get branch names
18
+ id: branch-name
19
+ uses: tj-actions/branch-names@v4.9
20
+ - uses: actions/checkout@v3
21
+ - uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: '2.6'
24
+ bundler-cache: true
25
+ - name: Test & publish code coverage
26
+ if: "${{ env.CC_TEST_REPORTER_ID != '' }}"
27
+ uses: paambaati/codeclimate-action@v2.7.5
28
+ env:
29
+ CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
30
+ GIT_BRANCH: ${{ steps.branch-name.outputs.current_branch }}
31
+ GIT_COMMIT_SHA: ${{ github.sha }}
32
+ with:
33
+ coverageCommand: bundle exec rake
34
+
14
35
  test:
15
36
  strategy:
16
37
  fail-fast: false
@@ -25,19 +46,10 @@ jobs:
25
46
  runs-on: ${{ matrix.os }}
26
47
  continue-on-error: ${{ matrix.experimental }}
27
48
  steps:
28
- - name: Get branch names
29
- id: branch-name
30
- uses: tj-actions/branch-names@v4.9
31
- - uses: actions/checkout@v2
49
+ - uses: actions/checkout@v3
32
50
  - uses: ruby/setup-ruby@v1
33
51
  with:
34
52
  ruby-version: ${{ matrix.ruby }}
35
53
  bundler-cache: true
36
- - name: Test & publish code coverage
37
- uses: paambaati/codeclimate-action@v2.7.5
38
- env:
39
- CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
40
- GIT_BRANCH: ${{ steps.branch-name.outputs.current_branch }}
41
- GIT_COMMIT_SHA: ${{ github.sha }}
42
- with:
43
- coverageCommand: bundle exec rake
54
+ - name: Test
55
+ run: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 0.43.0
4
+
5
+ - Fix GitHub Actions can't be executed when public fork
6
+ - Support new embed scripts and iframes
7
+ - Docswell
8
+
3
9
  ## 0.42.0
4
10
 
5
11
  - Add for Ruby 3.0, 3.1 support
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Qiita
4
+ module Markdown
5
+ module Embed
6
+ module Docswell
7
+ SCRIPT_HOSTS = [
8
+ "docswell.com",
9
+ "www.docswell.com",
10
+ ].freeze
11
+ SCRIPT_URLS = [
12
+ "https://www.docswell.com/assets/libs/docswell-embed/docswell-embed.min.js",
13
+ "//www.docswell.com/assets/libs/docswell-embed/docswell-embed.min.js",
14
+ ].freeze
15
+ CLASS_NAME = %w[docswell-embed].freeze
16
+ DATA_ATTRIBUTES = %w[
17
+ data-src data-aspect data-height-offset data-width-offset
18
+ ].freeze
19
+ ATTRIBUTES = %w[class] + DATA_ATTRIBUTES
20
+ end
21
+ end
22
+ end
23
+ end
@@ -49,6 +49,7 @@ module Qiita
49
49
  "type",
50
50
  ].concat(
51
51
  Embed::SpeekerDeck::ATTRIBUTES,
52
+ Embed::Docswell::ATTRIBUTES,
52
53
  ),
53
54
  "span" => [
54
55
  "style",
@@ -26,7 +26,7 @@ module Qiita
26
26
  "li" => %w[id],
27
27
  "p" => Embed::CodePen::ATTRIBUTES,
28
28
  "q" => %w[cite],
29
- "script" => %w[async src id].concat(Embed::SpeekerDeck::ATTRIBUTES),
29
+ "script" => %w[async src id].concat(Embed::SpeekerDeck::ATTRIBUTES, Embed::Docswell::ATTRIBUTES),
30
30
  "iframe" => %w[
31
31
  allowfullscreen
32
32
  frameborder
@@ -9,6 +9,7 @@ module Qiita
9
9
  Embed::Youtube::SCRIPT_HOSTS,
10
10
  Embed::SlideShare::SCRIPT_HOST,
11
11
  Embed::GoogleSlide::SCRIPT_HOST,
12
+ Embed::Docswell::SCRIPT_HOSTS,
12
13
  ].flatten.freeze
13
14
 
14
15
  def self.call(**args)
@@ -6,6 +6,7 @@ module Qiita
6
6
  Embed::CodePen::SCRIPT_URLS,
7
7
  Embed::Tweet::SCRIPT_URL,
8
8
  Embed::SpeekerDeck::SCRIPT_URLS,
9
+ Embed::Docswell::SCRIPT_URLS,
9
10
  ].flatten.freeze
10
11
 
11
12
  HOST_WHITE_LIST = [
@@ -1,5 +1,5 @@
1
1
  module Qiita
2
2
  module Markdown
3
- VERSION = "0.42.0"
3
+ VERSION = "0.43.0"
4
4
  end
5
5
  end
@@ -14,6 +14,7 @@ require "qiita/markdown/embed/youtube"
14
14
  require "qiita/markdown/embed/slide_share"
15
15
  require "qiita/markdown/embed/google_slide"
16
16
  require "qiita/markdown/embed/speeker_deck"
17
+ require "qiita/markdown/embed/docswell"
17
18
  require "qiita/markdown/transformers/filter_attributes"
18
19
  require "qiita/markdown/transformers/filter_script"
19
20
  require "qiita/markdown/transformers/filter_iframe"
@@ -1642,6 +1642,63 @@ describe Qiita::Markdown::Processor do
1642
1642
  end
1643
1643
  end
1644
1644
 
1645
+ context "with HTML embed code for Docswell" do
1646
+ let(:markdown) do
1647
+ <<-MARKDOWN.strip_heredoc
1648
+ <script async class="docswell-embed" src="https://www.docswell.com/assets/libs/docswell-embed/docswell-embed.min.js" data-src="https://www.docswell.com/slide/example/embed" data-aspect="0.5625"></script>
1649
+ MARKDOWN
1650
+ end
1651
+
1652
+ if allowed
1653
+ it "does not sanitize embed code" do
1654
+ should eq <<-HTML.strip_heredoc
1655
+ <script async class="docswell-embed" src="https://www.docswell.com/assets/libs/docswell-embed/docswell-embed.min.js" data-src="https://www.docswell.com/slide/example/embed" data-aspect="0.5625"></script>
1656
+ HTML
1657
+ end
1658
+ else
1659
+ it "forces async attribute on script" do
1660
+ should eq <<-HTML.strip_heredoc
1661
+ <script async class="docswell-embed" src="https://www.docswell.com/assets/libs/docswell-embed/docswell-embed.min.js" data-src="https://www.docswell.com/slide/example/embed" data-aspect="0.5625"></script>
1662
+ HTML
1663
+ end
1664
+ end
1665
+
1666
+ shared_examples "iframe code docswell example" do
1667
+ let(:markdown) do
1668
+ <<-MARKDOWN.strip_heredoc
1669
+ <iframe src="#{url}" allowfullscreen="true" width="620" height="405" style="width:100%"></iframe>
1670
+ MARKDOWN
1671
+ end
1672
+ let(:url) { "#{scheme}//www.docswell.com/slide/example/embed" }
1673
+
1674
+ if allowed
1675
+ it "does not sanitize embed code" do
1676
+ should eq <<-HTML.strip_heredoc
1677
+ <iframe src="#{url}" allowfullscreen="true" width="620" height="405"></iframe>
1678
+ HTML
1679
+ end
1680
+ else
1681
+ it "forces width attribute on iframe" do
1682
+ should eq <<-HTML.strip_heredoc
1683
+ <iframe src="#{url}" allowfullscreen="true" width="100%" height="405"></iframe>
1684
+ HTML
1685
+ end
1686
+ end
1687
+ end
1688
+
1689
+ context "with scheme" do
1690
+ let(:scheme) { "https:" }
1691
+
1692
+ include_examples "iframe code docswell example"
1693
+ end
1694
+
1695
+ context "without scheme" do
1696
+ let(:scheme) { "" }
1697
+
1698
+ include_examples "iframe code docswell example"
1699
+ end
1700
+ end
1701
+
1645
1702
  context "with embed code for Tweet" do
1646
1703
  let(:markdown) do
1647
1704
  <<-MARKDOWN.strip_heredoc
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.42.0
4
+ version: 0.43.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-22 00:00:00.000000000 Z
11
+ date: 2022-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gemoji
@@ -314,6 +314,7 @@ files:
314
314
  - lib/qiita/markdown/base_processor.rb
315
315
  - lib/qiita/markdown/embed/asciinema.rb
316
316
  - lib/qiita/markdown/embed/code_pen.rb
317
+ - lib/qiita/markdown/embed/docswell.rb
317
318
  - lib/qiita/markdown/embed/google_slide.rb
318
319
  - lib/qiita/markdown/embed/slide_share.rb
319
320
  - lib/qiita/markdown/embed/speeker_deck.rb
@@ -372,7 +373,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
372
373
  - !ruby/object:Gem::Version
373
374
  version: '0'
374
375
  requirements: []
375
- rubygems_version: 3.1.6
376
+ rubygems_version: 3.1.4
376
377
  signing_key:
377
378
  specification_version: 4
378
379
  summary: Qiita-specified markdown processor.