qiita-markdown 0.1.2 → 0.1.3

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: 9db1fc48a2269abdf15197fe9788192482c81ff6
4
- data.tar.gz: be640dc965f5a843820f6108dc48dc358b8af359
3
+ metadata.gz: db0c2afc4126606fe9f8cd83adec1766ea961c90
4
+ data.tar.gz: 0bda2be22b6eac2d228f544de6a47e3a9f0fafc0
5
5
  SHA512:
6
- metadata.gz: 1eb01b6be60563d456e66b546cd46f7025d5756272d61765897d8efdf1627e7499faae2017da23dc12e8241d7a3822fd58925328c679a01f897cccc31af468b5
7
- data.tar.gz: b09c362e213b892da27fe94e5c01e26e9d19bc82e00fe8f66cf71f814b41193bca24589f2844b8de20669dd315b31effe7b77a3aa776cf67fa231d28ee118fb0
6
+ metadata.gz: a038c4358d7378253d8c99d5a0c690b195ac244fde517de2ef1c7c32acb31bc75aa200cdea57a4f8a432dd54bed941dbfe5310ff3b95e10417835be9615cda0c
7
+ data.tar.gz: ca44843d557e3a0b4d57aa6142c114a4b6fa20eedf876f377dfdf5bd422a48fe9f7d3d6cad0e9582806c4d482ef5fdbd32a5276509bc0bf1c636fa1d1c4b3ad3
@@ -1,3 +1,6 @@
1
+ ## 0.1.3
2
+ * Support text-align syntax on table
3
+
1
4
  ## 0.1.2
2
5
  * Support rowspan attribute
3
6
 
@@ -9,8 +9,8 @@ module Qiita
9
9
  #
10
10
  class Checkbox < HTML::Pipeline::Filter
11
11
  def call
12
- doc.search("li").each_with_index do |li, index|
13
- list = List.new(index: index, node: li)
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(index: nil, node: nil)
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",
@@ -1,5 +1,5 @@
1
1
  module Qiita
2
2
  module Markdown
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
@@ -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" data-checkbox-index="0" disabled>a</li>
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" data-checkbox-index="1" checked disabled>b</li>
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" data-checkbox-index="0" disabled>a
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" data-checkbox-index="1" disabled>b</li>
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" data-checkbox-index="0" disabled>a</p></li>
455
- <li class="task-list-item"><p><input type="checkbox" class="task-list-item-checkbox" data-checkbox-index="1" checked disabled>b</p></li>
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.2
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-17 00:00:00.000000000 Z
11
+ date: 2014-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport