qiita-markdown 0.7.1 → 0.8.0

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
  SHA1:
3
- metadata.gz: 6b66602727857672deb15686f30a84459ca8abc8
4
- data.tar.gz: 42d96b87ea9bd7ab22e26b6fcbecccad751f2bf3
3
+ metadata.gz: ef101af1f76d71dea59fe6ea077b5ba69e21f2f7
4
+ data.tar.gz: 669da8457ddc379eee5e5a6fcbc4fab9d6176bc1
5
5
  SHA512:
6
- metadata.gz: 76e646fabb486443f85395a54821e2b64b6f241ecb4da4ef2bccd4f364b4e33cdc77a457a7523b798bfe90dfe9c4b90472e50e17bed58d4c885bb5a1fb242eb4
7
- data.tar.gz: 8548756ff8d170d01abb8476af73bc4521b0b37e5c811cadab45cda9b79f7ba5a25f22af334bca7f643bcba8a5040a875e43f4089ccbbf6210f137c2259179bb
6
+ metadata.gz: 10a4aa30b42713f76af7481c237720eef4d57e628be172747e3e5edb8fe7a35999e88d35f0c62afae144c41a70c5ebe416d5ecc6aeae603c5cbcb0e59df0e41d
7
+ data.tar.gz: fc88f07dc2fbd3ee5683fdbc6b632391be4ba3472cec81e220fa9393134ea65808e57b0e90c7093307134e13285f2f272e8bd84c6582655fce6f1f94e9971c00
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.8.0
2
+ - Sanitize data-attributes
3
+
1
4
  ## 0.7.1
2
5
  - Support mentions to 2-character usernames
3
6
 
@@ -94,6 +94,7 @@ module Qiita
94
94
  "color",
95
95
  "cols",
96
96
  "colspan",
97
+ "data-lang",
97
98
  "datetime",
98
99
  "height",
99
100
  "hreflang",
@@ -106,7 +107,6 @@ module Qiita
106
107
  "target",
107
108
  "title",
108
109
  "width",
109
- :data,
110
110
  ],
111
111
  },
112
112
  css: {
@@ -190,6 +190,8 @@ module Qiita
190
190
  }
191
191
 
192
192
  SCRIPTABLE_RULE = RULE.dup.tap do |rule|
193
+ rule[:attributes] = RULE[:attributes].dup
194
+ rule[:attributes][:all] = rule[:attributes][:all] + [:data]
193
195
  rule[:elements] = RULE[:elements] + ["iframe", "script"]
194
196
  rule[:remove_contents] = []
195
197
  end
@@ -1,5 +1,5 @@
1
1
  module Qiita
2
2
  module Markdown
3
- VERSION = "0.7.1"
3
+ VERSION = "0.8.0"
4
4
  end
5
5
  end
@@ -668,5 +668,37 @@ describe Qiita::Markdown::Processor do
668
668
  EOS
669
669
  end
670
670
  end
671
+
672
+ context "with data-attributes" do
673
+ let(:markdown) do
674
+ <<-EOS.strip_heredoc
675
+ <div data-a="b"></div>
676
+ EOS
677
+ end
678
+
679
+ it "sanitizes data-attributes" do
680
+ should eq <<-EOS.strip_heredoc
681
+ <div></div>
682
+ EOS
683
+ end
684
+ end
685
+
686
+ context "with data-attributes and :script option" do
687
+ before do
688
+ context[:script] = true
689
+ end
690
+
691
+ let(:markdown) do
692
+ <<-EOS.strip_heredoc
693
+ <div data-a="b"></div>
694
+ EOS
695
+ end
696
+
697
+ it "does not sanitize data-attributes" do
698
+ should eq <<-EOS.strip_heredoc
699
+ <div data-a="b"></div>
700
+ EOS
701
+ end
702
+ end
671
703
  end
672
704
  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: 0.7.1
4
+ version: 0.8.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: 2015-04-22 00:00:00.000000000 Z
11
+ date: 2015-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -313,3 +313,4 @@ test_files:
313
313
  - spec/qiita/markdown/processor_spec.rb
314
314
  - spec/qiita/markdown/summary_processor_spec.rb
315
315
  - spec/spec_helper.rb
316
+ has_rdoc: