qiita-markdown 0.0.9 → 0.1.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: 21636db188a28479b34b60fad6c75356d8f010ec
4
- data.tar.gz: 7bd8df4cfebd9c817df09535406b5d27836363fa
3
+ metadata.gz: e9017a4c3b8f333bbd46769e73282dc5ade827b3
4
+ data.tar.gz: b12d3ec85b24c2e19e727e187f74b4b471bf4078
5
5
  SHA512:
6
- metadata.gz: 542225d4238907e068fe08f9367e315cb7b450ea74dcb5a6c9c60ce8cee493d70ba3ff754232c7ed895b14161274135b806cc17892c859b04bc5550c153ec7ed
7
- data.tar.gz: b567c29e0bb4321e78d6e124897c5abb0f2ce643373d021e305f2a743b7e8b2592d2bf0c8ee1466cf244b70cf9ede6fa5495884106193cac8ac1a076d396aee6
6
+ metadata.gz: a7f9b5e259c48094d8fc84c117cfc18d8be58f75bb33ec720f082424615c5817ebb98a30d966e8ff4f12b63111e9eae9298c4675b71806df71393f664658ad25
7
+ data.tar.gz: 7b36281b31d80ae7b2e01a8d4c4c9376720bc3857eebcefdcf79a63d042351495dfa26e70c24f4103628a671835d933b8a724855c6e65617dbfe85e198d0b9f9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.1.0
2
+ * Default to add diabled attribute to checkbox
3
+
1
4
  ## 0.0.9
2
5
  * Make it Ruby 2.0.0-compatible
3
6
 
data/README.md CHANGED
@@ -51,7 +51,6 @@ processor.call(text)
51
51
  :asset_path - URL path to link to emoji sprite. (String)
52
52
  :asset_root - Base URL to link to emoji sprite. (String)
53
53
  :base_url - Used to construct links to user profile pages for each. (String)
54
- :checkbox_disabled - Pass true to add `disabled` attribute to input element/ (Boolean)
55
54
  :default_language - Default language used if no language detected from code. (String)
56
55
  :language_aliases - Alias table for some language names. (Hash)
57
56
  :rule - Sanitization rule table. (Hash)
@@ -7,14 +7,10 @@ module Qiita
7
7
  # * [ ] Bar
8
8
  # * [ ] Baz
9
9
  #
10
- # Takes following context options:
11
- #
12
- # * :checkbox_disabled - Pass true to add `disabled` attribute to input element
13
- #
14
10
  class Checkbox < HTML::Pipeline::Filter
15
11
  def call
16
12
  doc.search("li").each_with_index do |li, index|
17
- list = List.new(disabled: context[:checkbox_disabled], index: index, node: li)
13
+ list = List.new(index: index, node: li)
18
14
  list.convert if list.has_checkbox?
19
15
  end
20
16
  doc
@@ -26,8 +22,7 @@ module Qiita
26
22
  CHECKBOX_CLOSE_MARK = "[x] "
27
23
  CHECKBOX_OPEN_MARK = "[ ] "
28
24
 
29
- def initialize(disabled: nil, index: nil, node: nil)
30
- @disabled = disabled
25
+ def initialize(index: nil, node: nil)
31
26
  @index = index
32
27
  @node = node
33
28
  end
@@ -57,7 +52,7 @@ module Qiita
57
52
  node = Nokogiri::HTML.fragment('<input type="checkbox" class="task-list-item-checkbox">')
58
53
  node.children.first["data-checkbox-index"] = @index
59
54
  node.children.first["checked"] = true if has_close_checkbox?
60
- node.children.first["disabled"] = true if @disabled
55
+ node.children.first["disabled"] = true
61
56
  node
62
57
  end
63
58
 
@@ -1,5 +1,5 @@
1
1
  module Qiita
2
2
  module Markdown
3
- VERSION = "0.0.9"
3
+ VERSION = "0.1.0"
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">a</li>
391
+ <input type="checkbox" class="task-list-item-checkbox" data-checkbox-index="0" disabled>a</li>
392
392
  <li class="task-list-item">
393
- <input type="checkbox" class="task-list-item-checkbox" data-checkbox-index="1" checked>b</li>
393
+ <input type="checkbox" class="task-list-item-checkbox" data-checkbox-index="1" 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">a
411
+ <input type="checkbox" class="task-list-item-checkbox" data-checkbox-index="0" 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">b</li>
415
+ <input type="checkbox" class="task-list-item-checkbox" data-checkbox-index="1" disabled>b</li>
416
416
  </ul>
417
417
  </li>
418
418
  </ul>
@@ -439,30 +439,6 @@ describe Qiita::Markdown::Processor do
439
439
  end
440
440
  end
441
441
 
442
- context "with task list and :checkbox_disabled context" do
443
- before do
444
- context[:checkbox_disabled] = true
445
- end
446
-
447
- let(:markdown) do
448
- <<-EOS.strip_heredoc
449
- - [ ] a
450
- - [x] b
451
- EOS
452
- end
453
-
454
- it "inserts checkbox with disabled attribute" do
455
- should eq <<-EOS.strip_heredoc
456
- <ul>
457
- <li class="task-list-item">
458
- <input type="checkbox" class="task-list-item-checkbox" data-checkbox-index="0" disabled>a</li>
459
- <li class="task-list-item">
460
- <input type="checkbox" class="task-list-item-checkbox" data-checkbox-index="1" checked disabled>b</li>
461
- </ul>
462
- EOS
463
- end
464
- end
465
-
466
442
  context 'with empty line between task list' do
467
443
  let(:markdown) do
468
444
  <<-EOS.strip_heredoc
@@ -472,11 +448,11 @@ describe Qiita::Markdown::Processor do
472
448
  EOS
473
449
  end
474
450
 
475
- it "inserts checkbox with disabled attribute" do
451
+ it "inserts checkbox" do
476
452
  should eq <<-EOS.strip_heredoc
477
453
  <ul>
478
- <li class="task-list-item"><p><input type="checkbox" class="task-list-item-checkbox" data-checkbox-index="0">a</p></li>
479
- <li class="task-list-item"><p><input type="checkbox" class="task-list-item-checkbox" data-checkbox-index="1" checked>b</p></li>
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>
480
456
  </ul>
481
457
  EOS
482
458
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qiita-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura