qiita-markdown 0.9.0 → 0.10.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.
Potentially problematic release.
This version of qiita-markdown might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/qiita/markdown.rb +1 -0
- data/lib/qiita/markdown/filters/image_link.rb +19 -0
- data/lib/qiita/markdown/processor.rb +1 -0
- data/lib/qiita/markdown/version.rb +1 -1
- data/spec/qiita/markdown/processor_spec.rb +11 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e13f1a43a06fefe010339cbcb13b352e0b3fdd3
|
4
|
+
data.tar.gz: d505ff7889f69ed21e558df0445eba647b78d696
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8e41b7ef2af0eb564dc9c281b493eb7d00d7257ef36128498ebdaf1d62942c765771436f8631a08c9728cb78205be66a8fc7e441194a397719284832f399008
|
7
|
+
data.tar.gz: aa8c80dea0d04bf3ca2534d9ce49d300567c0e23f15c7606b2ad01953c416bc2cbe1a67c5e7797190c734d5ca27c2475781a292f72d040ade51547e6016532bf
|
data/CHANGELOG.md
CHANGED
data/lib/qiita/markdown.rb
CHANGED
@@ -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
|
@@ -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
|
+
""
|
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.
|
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-
|
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.
|
307
|
+
rubygems_version: 2.4.5
|
307
308
|
signing_key:
|
308
309
|
specification_version: 4
|
309
310
|
summary: Qiita-specified markdown processor.
|