qiita-markdown 0.1.2 → 0.1.3
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db0c2afc4126606fe9f8cd83adec1766ea961c90
|
4
|
+
data.tar.gz: 0bda2be22b6eac2d228f544de6a47e3a9f0fafc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a038c4358d7378253d8c99d5a0c690b195ac244fde517de2ef1c7c32acb31bc75aa200cdea57a4f8a432dd54bed941dbfe5310ff3b95e10417835be9615cda0c
|
7
|
+
data.tar.gz: ca44843d557e3a0b4d57aa6142c114a4b6fa20eedf876f377dfdf5bd422a48fe9f7d3d6cad0e9582806c4d482ef5fdbd32a5276509bc0bf1c636fa1d1c4b3ad3
|
data/CHANGELOG.md
CHANGED
@@ -9,8 +9,8 @@ module Qiita
|
|
9
9
|
#
|
10
10
|
class Checkbox < HTML::Pipeline::Filter
|
11
11
|
def call
|
12
|
-
doc.search("li").
|
13
|
-
list = List.new(
|
12
|
+
doc.search("li").each do |li|
|
13
|
+
list = List.new(li)
|
14
14
|
list.convert if list.has_checkbox?
|
15
15
|
end
|
16
16
|
doc
|
@@ -22,8 +22,7 @@ module Qiita
|
|
22
22
|
CHECKBOX_CLOSE_MARK = "[x] "
|
23
23
|
CHECKBOX_OPEN_MARK = "[ ] "
|
24
24
|
|
25
|
-
def initialize(
|
26
|
-
@index = index
|
25
|
+
def initialize(node)
|
27
26
|
@node = node
|
28
27
|
end
|
29
28
|
|
@@ -50,7 +49,6 @@ module Qiita
|
|
50
49
|
|
51
50
|
def checkbox_node
|
52
51
|
node = Nokogiri::HTML.fragment('<input type="checkbox" class="task-list-item-checkbox">')
|
53
|
-
node.children.first["data-checkbox-index"] = @index
|
54
52
|
node.children.first["checked"] = true if has_close_checkbox?
|
55
53
|
node.children.first["disabled"] = true
|
56
54
|
node
|
@@ -70,6 +70,9 @@ module Qiita
|
|
70
70
|
"async",
|
71
71
|
"src",
|
72
72
|
],
|
73
|
+
"td" => [
|
74
|
+
"style",
|
75
|
+
],
|
73
76
|
all: [
|
74
77
|
"abbr",
|
75
78
|
"align",
|
@@ -97,6 +100,11 @@ module Qiita
|
|
97
100
|
:data,
|
98
101
|
],
|
99
102
|
},
|
103
|
+
css: {
|
104
|
+
properties: [
|
105
|
+
"text-align",
|
106
|
+
],
|
107
|
+
},
|
100
108
|
elements: [
|
101
109
|
"a",
|
102
110
|
"b",
|
@@ -388,9 +388,9 @@ describe Qiita::Markdown::Processor do
|
|
388
388
|
should eq <<-EOS.strip_heredoc
|
389
389
|
<ul>
|
390
390
|
<li class="task-list-item">
|
391
|
-
<input type="checkbox" class="task-list-item-checkbox"
|
391
|
+
<input type="checkbox" class="task-list-item-checkbox" disabled>a</li>
|
392
392
|
<li class="task-list-item">
|
393
|
-
<input type="checkbox" class="task-list-item-checkbox"
|
393
|
+
<input type="checkbox" class="task-list-item-checkbox" checked disabled>b</li>
|
394
394
|
</ul>
|
395
395
|
EOS
|
396
396
|
end
|
@@ -408,11 +408,11 @@ describe Qiita::Markdown::Processor do
|
|
408
408
|
should eq <<-EOS.strip_heredoc
|
409
409
|
<ul>
|
410
410
|
<li class="task-list-item">
|
411
|
-
<input type="checkbox" class="task-list-item-checkbox"
|
411
|
+
<input type="checkbox" class="task-list-item-checkbox" disabled>a
|
412
412
|
|
413
413
|
<ul>
|
414
414
|
<li class="task-list-item">
|
415
|
-
<input type="checkbox" class="task-list-item-checkbox"
|
415
|
+
<input type="checkbox" class="task-list-item-checkbox" disabled>b</li>
|
416
416
|
</ul>
|
417
417
|
</li>
|
418
418
|
</ul>
|
@@ -451,8 +451,8 @@ describe Qiita::Markdown::Processor do
|
|
451
451
|
it "inserts checkbox" do
|
452
452
|
should eq <<-EOS.strip_heredoc
|
453
453
|
<ul>
|
454
|
-
<li class="task-list-item"><p><input type="checkbox" class="task-list-item-checkbox"
|
455
|
-
<li class="task-list-item"><p><input type="checkbox" class="task-list-item-checkbox"
|
454
|
+
<li class="task-list-item"><p><input type="checkbox" class="task-list-item-checkbox" disabled>a</p></li>
|
455
|
+
<li class="task-list-item"><p><input type="checkbox" class="task-list-item-checkbox" checked disabled>b</p></li>
|
456
456
|
</ul>
|
457
457
|
EOS
|
458
458
|
end
|
@@ -471,5 +471,36 @@ describe Qiita::Markdown::Processor do
|
|
471
471
|
EOS
|
472
472
|
end
|
473
473
|
end
|
474
|
+
|
475
|
+
context 'with text-aligned table' do
|
476
|
+
let(:markdown) do
|
477
|
+
<<-EOS.strip_heredoc
|
478
|
+
| a | b | c |
|
479
|
+
|:---|---:|:---:|
|
480
|
+
| a | b | c |
|
481
|
+
EOS
|
482
|
+
end
|
483
|
+
|
484
|
+
it "creates table element with text-align style" do
|
485
|
+
should eq <<-EOS.strip_heredoc
|
486
|
+
<table>
|
487
|
+
<thead>
|
488
|
+
<tr>
|
489
|
+
<th>a</th>
|
490
|
+
<th>b</th>
|
491
|
+
<th>c</th>
|
492
|
+
</tr>
|
493
|
+
</thead>
|
494
|
+
<tbody>
|
495
|
+
<tr>
|
496
|
+
<td style="text-align: left">a</td>
|
497
|
+
<td style="text-align: right">b</td>
|
498
|
+
<td style="text-align: center">c</td>
|
499
|
+
</tr>
|
500
|
+
</tbody>
|
501
|
+
</table>
|
502
|
+
EOS
|
503
|
+
end
|
504
|
+
end
|
474
505
|
end
|
475
506
|
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.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|