code_terminator 0.4.14 → 0.4.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exercises/issue16.html +1 -0
- data/lib/code_terminator/html.rb +30 -16
- data/lib/code_terminator/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a74c3589fc1cce252bdc6c1f1cfbbc8c39610cf
|
4
|
+
data.tar.gz: f500e2e20044cba091c042b3788108b36d6a022f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5aeedd345f4b1976d3d4c31c74734ab3f677df087e54c925da3db2b5c9c21ab9976b155a82d2901e04d0b1cd8d7c89adcec4c55d8316bce25b43c3f4dce0cd61
|
7
|
+
data.tar.gz: 58701c448eda38a40ef722c6bc22ea276ee57e5f0bddad29f4c069c1b2de36d73a332f70cf1e0648f3069c0bbbff853ac416ba1a6c1b14e22e09d23a0e434157
|
@@ -0,0 +1 @@
|
|
1
|
+
<html><head></head><body><!-- This is a comment --></body></html>
|
data/lib/code_terminator/html.rb
CHANGED
@@ -295,32 +295,38 @@ class CodeTerminator::Html
|
|
295
295
|
|
296
296
|
# Check the text
|
297
297
|
if !e[:content].nil?
|
298
|
+
|
298
299
|
if code.css(e[:parent]).count < 2
|
299
|
-
#new code
|
300
300
|
if code.css(e[:parent]).class == Nokogiri::XML::NodeSet
|
301
301
|
text_found = false
|
302
302
|
error330 = nil
|
303
303
|
if code.css(e[:parent]).children.any?
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
304
|
+
code.css(e[:parent]).children.each do |node_child|
|
305
|
+
if node_child.class != Nokogiri::XML::Element
|
306
|
+
#embebed code
|
307
|
+
#if code.css(e[:parent]).text != e[:content]
|
308
|
+
|
309
|
+
if node_child.text.strip != e[:content].strip
|
310
|
+
if item == "comment"
|
311
|
+
# if comment isn't present in the code, mark add tag
|
312
|
+
if e[:content].strip != ""
|
311
313
|
error330 = new_error(element: e, type: 330, description: "The text inside the comment should be #{e[:content]}")
|
312
314
|
else
|
313
|
-
|
315
|
+
# html_errors << new_error(element: e, type: 404, description: "Remember to add the `<#{e[:tag]}>` tag")
|
314
316
|
end
|
315
317
|
else
|
316
|
-
|
318
|
+
error330 = new_error(element: e, type: 330, description: "The text inside `<#{e[:parent]}>` should be #{e[:content]}")
|
317
319
|
end
|
318
|
-
|
320
|
+
else
|
321
|
+
text_found = true
|
319
322
|
end
|
323
|
+
#end embebed code
|
320
324
|
end
|
325
|
+
end
|
326
|
+
#end each
|
321
327
|
else
|
322
328
|
if code.css(e[:parent]).text.strip != e[:content].strip
|
323
|
-
p "text of node: " + code.css(e[:parent]).text
|
329
|
+
# p "text of node: " + code.css(e[:parent]).text
|
324
330
|
if item == "comment"
|
325
331
|
error330 = new_error(element: e, type: 330, description: "The text inside the comment should be #{e[:content]}")
|
326
332
|
else
|
@@ -330,14 +336,14 @@ class CodeTerminator::Html
|
|
330
336
|
text_found = true
|
331
337
|
end
|
332
338
|
end
|
339
|
+
#end if parent has children
|
333
340
|
|
334
341
|
if !text_found && !error330.nil?
|
335
342
|
html_errors << error330
|
336
343
|
error330 = nil
|
337
344
|
end
|
338
345
|
end
|
339
|
-
#
|
340
|
-
|
346
|
+
#end if parent is nodeset
|
341
347
|
else
|
342
348
|
exist = false
|
343
349
|
code.css(e[:parent]).each do |code_css|
|
@@ -352,9 +358,13 @@ class CodeTerminator::Html
|
|
352
358
|
html_errors << new_error(element: e, type: 330, description: "The text inside `<#{e[:parent]}>` should be #{e[:content]}")
|
353
359
|
end
|
354
360
|
end
|
355
|
-
|
361
|
+
#end if parent < 2
|
362
|
+
|
363
|
+
end
|
364
|
+
#end if content is null
|
356
365
|
|
357
366
|
else
|
367
|
+
#item class is different to text or comment
|
358
368
|
|
359
369
|
if code.css(e[:tag]).length > 0
|
360
370
|
|
@@ -367,7 +377,11 @@ class CodeTerminator::Html
|
|
367
377
|
else
|
368
378
|
if tag.attribute(e[:attribute]).value != e[:value]
|
369
379
|
exist_in_body << false
|
370
|
-
|
380
|
+
# p "type " + e[:tag] + " with attribute " + e[:attribute] + " value " + e[:value]
|
381
|
+
# Check if the img have attribute src and value is null, the user can write whatever image he wants
|
382
|
+
if !(e[:tag] == "img" && e[:attribute] == "src" && e[:value] == "")
|
383
|
+
error333 = new_error(element: e, type: 333, description: "Make sure that the attribute #{e[:attribute]} in `<#{e[:tag]}>` has the value #{e[:value]}")
|
384
|
+
end
|
371
385
|
else
|
372
386
|
exist_in_body << true
|
373
387
|
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.
|
4
|
+
version: 0.4.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evelin Ponce
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- exercises/issue13.html
|
161
161
|
- exercises/issue14.html
|
162
162
|
- exercises/issue15.html
|
163
|
+
- exercises/issue16.html
|
163
164
|
- exercises/new.html
|
164
165
|
- exercises/new2.html
|
165
166
|
- exercises/test.css
|