qiita-markdown 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of qiita-markdown might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ea2737f0b350077c58fafa4dbb0bdb9db2ac7c6
4
- data.tar.gz: eb6510f3a063f5e8ce32afeeb97db5cf031363cb
3
+ metadata.gz: 3e13f1a43a06fefe010339cbcb13b352e0b3fdd3
4
+ data.tar.gz: d505ff7889f69ed21e558df0445eba647b78d696
5
5
  SHA512:
6
- metadata.gz: 52eddcb1d1c6a25d332a4185614a7a37dc73649caa1780b2d3d0f9c65e8b62ab9313a7bac3b670cbb5e1d648df24829df6bc248f18f67c05e43fe40cb888bcce
7
- data.tar.gz: 7d6df1522d3bf2836853e68d15b500a3e4505924f2290f15873180d2fbcbc6f98cd6243a0f32b13497ce94b10d7843e6eb5f6f90fda967f20537b1c5973e1f24
6
+ metadata.gz: c8e41b7ef2af0eb564dc9c281b493eb7d00d7257ef36128498ebdaf1d62942c765771436f8631a08c9728cb78205be66a8fc7e441194a397719284832f399008
7
+ data.tar.gz: aa8c80dea0d04bf3ca2534d9ce49d300567c0e23f15c7606b2ad01953c416bc2cbe1a67c5e7797190c734d5ca27c2475781a292f72d040ade51547e6016532bf
@@ -1,3 +1,6 @@
1
+ ## 0.10.0
2
+ - Add LinkImage filter
3
+
1
4
  ## 0.9.0
2
5
  - Support html-pipeline v2
3
6
 
@@ -12,6 +12,7 @@ require "qiita/markdown/filters/checkbox"
12
12
  require "qiita/markdown/filters/code"
13
13
  require "qiita/markdown/filters/footnote"
14
14
  require "qiita/markdown/filters/greenmat"
15
+ require "qiita/markdown/filters/image_link"
15
16
  require "qiita/markdown/filters/mention"
16
17
  require "qiita/markdown/filters/sanitize"
17
18
  require "qiita/markdown/filters/simplify"
@@ -0,0 +1,19 @@
1
+ module Qiita
2
+ module Markdown
3
+ module Filters
4
+ class ImageLink < HTML::Pipeline::Filter
5
+ def call
6
+ doc.search("img").each do |img|
7
+ unless img.ancestors.any? { |ancestor| ancestor.name == "a" }
8
+ outer = Nokogiri::HTML.fragment(%(<a href="#{img['src']}" target="_blank"></a>))
9
+ inner = img.clone
10
+ outer.at("a").add_child(inner)
11
+ img.replace(outer)
12
+ end
13
+ end
14
+ doc
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -7,6 +7,7 @@ module Qiita
7
7
 
8
8
  DEFAULT_FILTERS = [
9
9
  Filters::Greenmat,
10
+ Filters::ImageLink,
10
11
  Filters::Footnote,
11
12
  Filters::Code,
12
13
  Filters::Checkbox,
@@ -1,5 +1,5 @@
1
1
  module Qiita
2
2
  module Markdown
3
- VERSION = "0.9.0"
3
+ VERSION = "0.10.0"
4
4
  end
5
5
  end
@@ -456,6 +456,17 @@ describe Qiita::Markdown::Processor do
456
456
  end
457
457
  end
458
458
 
459
+ context "with image notation" do
460
+ let(:markdown) do
461
+ "![a](http://example.com/b.png)"
462
+ end
463
+
464
+ it "wraps it in a element" do
465
+ should eq '<p><a href="http://example.com/b.png" target="_blank">' +
466
+ %(<img src="http://example.com/b.png" alt="a"></a></p>\n)
467
+ end
468
+ end
469
+
459
470
  context "with colon-only label" do
460
471
  let(:markdown) do
461
472
  <<-EOS.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.9.0
4
+ version: 0.10.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-07-22 00:00:00.000000000 Z
11
+ date: 2015-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -266,6 +266,7 @@ files:
266
266
  - lib/qiita/markdown/filters/code.rb
267
267
  - lib/qiita/markdown/filters/footnote.rb
268
268
  - lib/qiita/markdown/filters/greenmat.rb
269
+ - lib/qiita/markdown/filters/image_link.rb
269
270
  - lib/qiita/markdown/filters/mention.rb
270
271
  - lib/qiita/markdown/filters/sanitize.rb
271
272
  - lib/qiita/markdown/filters/simplify.rb
@@ -303,7 +304,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
303
304
  version: '0'
304
305
  requirements: []
305
306
  rubyforge_project:
306
- rubygems_version: 2.2.2
307
+ rubygems_version: 2.4.5
307
308
  signing_key:
308
309
  specification_version: 4
309
310
  summary: Qiita-specified markdown processor.