markdiff 0.5.4 → 0.5.5

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: 253f738465580e885b9b7724ed900dbf171c90e3
4
- data.tar.gz: b9b941d9fc3b4169e309750ee952698f40d4c60d
3
+ metadata.gz: e80f72a11886759cdc06f7808979e6ed0bad625a
4
+ data.tar.gz: 9cd7dc00d2f40c38a6a09f424da0719f57f00451
5
5
  SHA512:
6
- metadata.gz: f3cc15598bf1ff8a2915a05b78fb9e0fce660edd5557de5f023353c1a355c5fa353b40beeb6c0caf4b81918aeea560b302e02c8f6c371c7f5d4a6810e482c9d8
7
- data.tar.gz: 662a972f514dce5543a8b1f2a0107a8e05411751bef87bc7bef63c63b97ac6831d65fd1620b57534192b6aa5c1e9716ce52c989566df69399f4ddb59cfab2757
6
+ metadata.gz: bbcaaf7b68319e07798a1706b86acc4b7fc583e073c5c40e8cc41ef93ada23075d7053ba96019b03d2caeb02f146c01f508e3bdf236281cae8623607ecf6a4b2
7
+ data.tar.gz: fa5d376beedea28a30d8420174611841dde14e93ded018bd1ab90f26cae73f7d977bf084a5a2037e70d3616a04cde47fc7f1e86b4a1438951309840e8535e2c8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.5.5
2
+ - Preserve classes on adding new class (e.g. .added)
3
+
1
4
  ## 0.5.4
2
5
  - Fix bug on patch operations order
3
6
 
@@ -183,8 +183,11 @@ module Markdiff
183
183
  # @param [Nokogiri::XML::Node] node
184
184
  def mark_li_as_changed(node)
185
185
  until node.parent.nil? || node.parent.fragment?
186
- if node.name == "li" && node["class"].nil?
187
- node["class"] = "changed"
186
+ if node.name == "li"
187
+ classes = node["class"].to_s.split(/\s/)
188
+ unless classes.include?("added") || classes.include?("changed") || classes.include?("removed")
189
+ node["class"] = (classes + ["changed"]).join(" ")
190
+ end
188
191
  end
189
192
  node = node.parent
190
193
  end
@@ -6,7 +6,7 @@ module Markdiff
6
6
  # @return [String]
7
7
  def inserted_node
8
8
  if @inserted_node.name == "li"
9
- @inserted_node["class"] = "added"
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
12
12
  else
@@ -7,7 +7,7 @@ module Markdiff
7
7
  def inserted_node
8
8
  if @inserted_node.name == "li"
9
9
  node = @inserted_node.clone
10
- node["class"] = "added"
10
+ node["class"] = (node["class"].to_s.split(/\s/) + ["added"]).join(" ")
11
11
  node.inner_html = "<ins>#{@inserted_node.inner_html}</ins>"
12
12
  node
13
13
  else
@@ -1,3 +1,3 @@
1
1
  module Markdiff
2
- VERSION = "0.5.4"
2
+ VERSION = "0.5.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdiff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura