qiita-markdown 0.2.1 → 0.2.2
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/filters/footnote.rb +11 -4
- data/lib/qiita/markdown/version.rb +1 -1
- data/spec/qiita/markdown/processor_spec.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2246b9c7de465987d8096f8f06dff05874c31b1
|
4
|
+
data.tar.gz: 7f980024c9522ba903c7ffaa6da2964b4b78d907
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c83fa85dced0ec7c9dc7f4962073b5576b9dc6ef6b6c2616cb3fd6bcb033ae56e1f85a77553b9f8d350c030f5f711b57fd0d0a337bfa0eaf6671cd142675b2e3
|
7
|
+
data.tar.gz: ae5a0ccaf8a142815d3fefc1030f24bda3cfab000abc75af67c698df4771b7cae64348908e0e53a419e637bbdba153a952aae34a42b7bdbdf2a1e43cb4b1e467
|
data/CHANGELOG.md
CHANGED
@@ -4,13 +4,20 @@ module Qiita
|
|
4
4
|
class Footnote < HTML::Pipeline::Filter
|
5
5
|
def call
|
6
6
|
doc.search("sup > a").each do |a|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
7
|
+
footnote = find_footnote(a)
|
8
|
+
next unless footnote
|
9
|
+
a[:title] = footnote.text.gsub(/\A\n/, "").gsub(/ ↩\n\z/, "")
|
11
10
|
end
|
12
11
|
doc
|
13
12
|
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def find_footnote(a)
|
17
|
+
href = a["href"]
|
18
|
+
return nil if !href || href.match(/\A#fn\d+\z/).nil?
|
19
|
+
doc.search(href).first
|
20
|
+
end
|
14
21
|
end
|
15
22
|
end
|
16
23
|
end
|
@@ -561,5 +561,19 @@ describe Qiita::Markdown::Processor do
|
|
561
561
|
EOS
|
562
562
|
end
|
563
563
|
end
|
564
|
+
|
565
|
+
context 'with manually written <a> tag with strange href inside of <sup> tag' do
|
566
|
+
let(:markdown) do
|
567
|
+
<<-EOS.strip_heredoc
|
568
|
+
<sup><a href="#foo.1">Link</a></sup>
|
569
|
+
EOS
|
570
|
+
end
|
571
|
+
|
572
|
+
it "does not confuse the structure with automatically generated footnote reference" do
|
573
|
+
should eq <<-EOS.strip_heredoc
|
574
|
+
<p><sup><a href="#foo.1">Link</a></sup></p>
|
575
|
+
EOS
|
576
|
+
end
|
577
|
+
end
|
564
578
|
end
|
565
579
|
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.2.
|
4
|
+
version: 0.2.2
|
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-
|
11
|
+
date: 2015-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|