code_terminator 0.4.10 → 0.4.11

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: 4dc9ff45c1c323bf6b3adba5bf2625c6cbedad3f
4
- data.tar.gz: 2da73d6e8f68cfe2b0d0cc7648f94d75a1c39827
3
+ metadata.gz: 9b76dd452042adda33c441f4a7e84c6dcb1d5f26
4
+ data.tar.gz: 20d8fcaee74dc97e05af018c83e5776d85eaed70
5
5
  SHA512:
6
- metadata.gz: 81987118b05ec841325f80605de7ae99e4b64c007e88de093998ff2cc688611b5e23e3737c2909a44757b4bfc15103f111c2260d48593f3e0112a75794bbcc4e
7
- data.tar.gz: 39757e3d726a55e053793de4fa3cb646e9ae76be2dd2b4ba2006ba5930c8bb1ee5b0bf2554cd096851ca573a020ef6a68b8ad401ad233172998b89f760235f2a
6
+ metadata.gz: 74548c5bbfd5d923759db75f972f727e286b3f778ea86d392fd8816021dfb3a0266560c864499dc95558a0d1a30e289c7d7e1df7424ce1d8ac3e41b9e813d677
7
+ data.tar.gz: 0f3cf3d0e45ab2765274601f337e583ac49939e245dfd4abafb88c2ec8b1896123d4f873aa337b78422c22500a16f10fdf6ce7cae989000a8b7422c7d554a860
@@ -1,5 +1,4 @@
1
1
  <body>
2
- <p></p>
3
2
  <h1>hola</h1>
4
3
  <footer>
5
4
  <p>Please contact:<a href='mailto:joe@email.com'>joe@email.com</a> now</p>
@@ -269,23 +269,33 @@ class CodeTerminator::Html
269
269
  # Check the text
270
270
  if !e[:content].nil?
271
271
  if code.css(e[:parent]).count < 2
272
-
273
272
  #new code
274
273
  if code.css(e[:parent]).class == Nokogiri::XML::NodeSet
275
274
  text_found = false
276
275
  error330 = nil
277
- code.css(e[:parent]).children.each do |node_child|
278
- if node_child.class != Nokogiri::XML::Element
279
- #embebed code
280
- #if code.css(e[:parent]).text != e[:content]
281
- if node_child.text.strip != e[:content].strip
282
- error330 = new_error(element: e, type: 330, description: "The text inside `<#{e[:parent]}>` should be #{e[:content]}.")
283
- else
284
- text_found = true
276
+ if code.css(e[:parent]).children.any?
277
+ code.css(e[:parent]).children.each do |node_child|
278
+
279
+ if node_child.class != Nokogiri::XML::Element
280
+ #embebed code
281
+ #if code.css(e[:parent]).text != e[:content]
282
+ if node_child.text.strip != e[:content].strip
283
+ error330 = new_error(element: e, type: 330, description: "The text inside `<#{e[:parent]}>` should be #{e[:content]}.")
284
+ else
285
+ text_found = true
286
+ end
287
+ #end embebed code
288
+ end
285
289
  end
286
- #end embebed code
287
- end
288
- end
290
+ else
291
+ if code.css(e[:parent]).text.strip != e[:content].strip
292
+ p "text of node: " + code.css(e[:parent]).text
293
+ error330 = new_error(element: e, type: 330, description: "The text inside `<#{e[:parent]}>` should be #{e[:content]}.")
294
+ else
295
+ text_found = true
296
+ end
297
+ end
298
+
289
299
  if !text_found && !error330.nil?
290
300
  html_errors << error330
291
301
  error330 = nil
@@ -297,6 +307,7 @@ class CodeTerminator::Html
297
307
  exist = false
298
308
  code.css(e[:parent]).each do |code_css|
299
309
  #if code_css.at_css(e[:tag]).parent.name == e[:parent]
310
+ p "text content: " + code_css.text
300
311
  if code_css.text == e[:content]
301
312
  exist = true
302
313
  end
@@ -1,3 +1,3 @@
1
1
  module CodeTerminator
2
- VERSION = "0.4.10"
2
+ VERSION = "0.4.11"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code_terminator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.10
4
+ version: 0.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evelin Ponce
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-08 00:00:00.000000000 Z
11
+ date: 2016-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler