markdiff 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce88d6225031a80172e2478e25ac5bbb0e4767ac
4
- data.tar.gz: dc7cc2269616091e0176d613b5cb81dd08e33fe1
3
+ metadata.gz: 0ee2a5b3a813d720c09eb7899ed15d8f04bc0c67
4
+ data.tar.gz: 604b3c40a6e7bd2c52c33638ffb285a0bcfe2a23
5
5
  SHA512:
6
- metadata.gz: bfd8ad92cbb696650cb72539f8e63a1bbe31d4b5198097ad12f0ab2e93ab28bb1836fb154c81096c1f2fd116c0f416b40b27ac09b304cf247650e41282897292
7
- data.tar.gz: 9bf8a6ce503b9729bf8e52374ad71edc4f9f92e22f5fabaf1770c1202f271d1eba022403276a2a11d4ede7410cc67f8bf78e1f36272aee675acdbb2798195c50
6
+ metadata.gz: aae5604ad09ce8ca3baeb318849477daee6fce59052f3a315640c511b7c25618d8c8163f12476f1da26dbde500eb1c3aff5ceb8a2e1e2dfaf11a15ecc7d83c67
7
+ data.tar.gz: 8f1b14bd5fcf4f12d45f221e70d9b8d6af764e89729cc7ba3f3c8d9baf367840568657b594c85cf3c3c1dbd46849fd82029035323f91a697b1e41216c2924689
@@ -1,3 +1,6 @@
1
+ ## 0.6.2
2
+ Support tr.added and tr.deleted
3
+
1
4
  ## 0.6.1
2
5
  - Fix patch order bug by making sort stable
3
6
 
@@ -19,30 +19,30 @@ module Markdiff
19
19
  case operation
20
20
  when ::Markdiff::Operations::AddChildOperation
21
21
  operation.target_node.add_child(operation.inserted_node)
22
- mark_li_as_changed(operation.target_node)
22
+ mark_li_or_tr_as_changed(operation.target_node)
23
23
  mark_top_level_node_as_changed(operation.target_node)
24
24
  when ::Markdiff::Operations::AddDataBeforeHrefOperation
25
25
  operation.target_node["data-before-href"] = operation.target_node["href"]
26
26
  operation.target_node["href"] = operation.after_href
27
- mark_li_as_changed(operation.target_node)
27
+ mark_li_or_tr_as_changed(operation.target_node)
28
28
  mark_top_level_node_as_changed(operation.target_node)
29
29
  when ::Markdiff::Operations::AddDataBeforeTagNameOperation
30
30
  operation.target_node["data-before-tag-name"] = operation.target_node.name
31
31
  operation.target_node.name = operation.after_tag_name
32
- mark_li_as_changed(operation.target_node)
32
+ mark_li_or_tr_as_changed(operation.target_node)
33
33
  mark_top_level_node_as_changed(operation.target_node)
34
34
  when ::Markdiff::Operations::AddPreviousSiblingOperation
35
35
  operation.target_node.add_previous_sibling(operation.inserted_node)
36
- mark_li_as_changed(operation.target_node) if operation.target_node.name != "li"
36
+ mark_li_or_tr_as_changed(operation.target_node) if operation.target_node.name != "li" && operation.target_node.name != "tr"
37
37
  mark_top_level_node_as_changed(operation.target_node.parent)
38
38
  when ::Markdiff::Operations::RemoveOperation
39
39
  operation.target_node.replace(operation.inserted_node) if operation.target_node != operation.inserted_node
40
- mark_li_as_changed(operation.target_node)
40
+ mark_li_or_tr_as_changed(operation.target_node)
41
41
  mark_top_level_node_as_changed(operation.target_node)
42
42
  when ::Markdiff::Operations::TextDiffOperation
43
43
  parent = operation.target_node.parent
44
44
  operation.target_node.replace(operation.inserted_node)
45
- mark_li_as_changed(parent)
45
+ mark_li_or_tr_as_changed(parent)
46
46
  mark_top_level_node_as_changed(parent)
47
47
  end
48
48
  end
@@ -182,9 +182,9 @@ module Markdiff
182
182
  end
183
183
 
184
184
  # @param [Nokogiri::XML::Node] node
185
- def mark_li_as_changed(node)
185
+ def mark_li_or_tr_as_changed(node)
186
186
  until node.parent.nil? || node.parent.fragment?
187
- if node.name == "li"
187
+ if node.name == "li" || node.name == "tr"
188
188
  classes = node["class"].to_s.split(/\s/)
189
189
  unless classes.include?("added") || classes.include?("changed") || classes.include?("removed")
190
190
  node["class"] = (classes + ["changed"]).join(" ")
@@ -5,7 +5,7 @@ module Markdiff
5
5
  class AddChildOperation < Base
6
6
  # @return [String]
7
7
  def inserted_node
8
- if @inserted_node.name == "li"
8
+ if @inserted_node.name == "li" || @inserted_node.name == "tr"
9
9
  @inserted_node["class"] = (@inserted_node["class"].to_s.split(/\s/) + ["added"]).join(" ")
10
10
  @inserted_node.inner_html = "<ins>#{@inserted_node.inner_html}</ins>"
11
11
  @inserted_node
@@ -5,7 +5,7 @@ module Markdiff
5
5
  class AddPreviousSiblingOperation < Base
6
6
  # @return [String]
7
7
  def inserted_node
8
- if @inserted_node.name == "li"
8
+ if @inserted_node.name == "li" || @inserted_node.name == "tr"
9
9
  node = @inserted_node.clone
10
10
  node["class"] = (node["class"].to_s.split(/\s/) + ["added"]).join(" ")
11
11
  node.inner_html = "<ins>#{@inserted_node.inner_html}</ins>"
@@ -5,7 +5,7 @@ module Markdiff
5
5
  class RemoveOperation < Base
6
6
  # @return [String]
7
7
  def inserted_node
8
- if target_node.name == "li"
8
+ if target_node.name == "li" || target_node.name == "tr"
9
9
  target_node["class"] = "removed"
10
10
  target_node.inner_html = %(<del class="del">#{target_node.inner_html}</del>)
11
11
  target_node
@@ -1,3 +1,3 @@
1
1
  module Markdiff
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdiff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.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-12-16 00:00:00.000000000 Z
11
+ date: 2016-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler