code_terminator 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/exercises/issue22.html +14 -0
- data/lib/code_terminator/html.rb +26 -0
- 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: 316dce18e871c4571066301904dfc2027d7aa37a
|
4
|
+
data.tar.gz: e01d9a08f46403f49a8513d18d005d7ad32b1d2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 833777c6950a30734bb85a2f99a3f4d4e7dd775ff675636991004f92145945658cf4be04172bebc0f44e1ede1aac29a0a5c38fb6c3a58130e1ca3f1ea6f6c36e
|
7
|
+
data.tar.gz: cd6e39147ab81af1c863f2fa901456645c335f2c0db3dc73a127591256a03b147683f44c971ef202ef01da5026b4f1fe6b256fc00ef0e2b7b6c4c6fa45ee5de2
|
data/lib/code_terminator/html.rb
CHANGED
@@ -74,6 +74,7 @@ class CodeTerminator::Html
|
|
74
74
|
node[:tag] = "body"
|
75
75
|
node[:attribute] = element_attribute.name if !element_attribute.name.nil?
|
76
76
|
node[:value] = element_attribute.value if !element_attribute.value.nil?
|
77
|
+
node[:pointer] = element_attribute.pointer_id
|
77
78
|
@elements << node
|
78
79
|
end
|
79
80
|
end
|
@@ -91,6 +92,7 @@ class CodeTerminator::Html
|
|
91
92
|
node[:parent] = "head"
|
92
93
|
node[:tag] = child.name
|
93
94
|
node[:content] = child.text if !child.text.nil? or child.comment?
|
95
|
+
node[:pointer] = child.pointer_id
|
94
96
|
@elements << node
|
95
97
|
else
|
96
98
|
child.attribute_nodes.each do |element_attribute|
|
@@ -105,6 +107,7 @@ class CodeTerminator::Html
|
|
105
107
|
node[:content] = child.text if !child.text.nil?
|
106
108
|
node[:attribute] = element_attribute.name if !element_attribute.name.nil?
|
107
109
|
node[:value] = element_attribute.value if !element_attribute.value.nil?
|
110
|
+
node[:pointer] = element_attribute.pointer_id
|
108
111
|
@elements << node
|
109
112
|
end
|
110
113
|
end
|
@@ -121,6 +124,7 @@ class CodeTerminator::Html
|
|
121
124
|
node[:parent] = "body"
|
122
125
|
node[:tag] = child.name
|
123
126
|
node[:content] = child.text if child.text? or child.comment?
|
127
|
+
node[:pointer] = child.pointer_id
|
124
128
|
@elements << node
|
125
129
|
else
|
126
130
|
child.attribute_nodes.each do |element_attribute|
|
@@ -129,6 +133,7 @@ class CodeTerminator::Html
|
|
129
133
|
node[:tag] = child.name
|
130
134
|
node[:attribute] = element_attribute.name if !element_attribute.name.nil?
|
131
135
|
node[:value] = element_attribute.value if !element_attribute.value.nil?
|
136
|
+
node[:pointer] = element_attribute.pointer_id
|
132
137
|
@elements << node
|
133
138
|
end
|
134
139
|
end
|
@@ -283,6 +288,8 @@ class CodeTerminator::Html
|
|
283
288
|
|
284
289
|
elements = get_elements(source)
|
285
290
|
|
291
|
+
css_code_checked = Array.new
|
292
|
+
|
286
293
|
exist_in_body = Array.new
|
287
294
|
|
288
295
|
error333 = nil
|
@@ -372,8 +379,22 @@ class CodeTerminator::Html
|
|
372
379
|
|
373
380
|
if code.css(e[:tag]).length > 0
|
374
381
|
|
382
|
+
|
375
383
|
code.css(e[:tag]).each do |tag|
|
376
384
|
|
385
|
+
p "code css + " + e[:tag].to_s
|
386
|
+
p "pointer element " + e[:pointer].to_s
|
387
|
+
|
388
|
+
p e_check = css_code_checked.select {|element| element[:target_pointer].to_s == e[:pointer].to_s }
|
389
|
+
p e_check2 = css_code_checked.select {|element| element[:pointer].to_s == tag.pointer_id.to_s }
|
390
|
+
if e_check.count < 1 and e_check2.count < 1
|
391
|
+
|
392
|
+
element_checked = Hash.new
|
393
|
+
element_checked[:pointer] = tag.pointer_id
|
394
|
+
element_checked[:tag] = e[:tag]
|
395
|
+
element_checked[:target_pointer]= e[:pointer]
|
396
|
+
|
397
|
+
|
377
398
|
if !e[:attribute].nil?
|
378
399
|
# Check the tag's attributes
|
379
400
|
if tag.attribute(e[:attribute]).nil?
|
@@ -387,10 +408,14 @@ class CodeTerminator::Html
|
|
387
408
|
error333 = new_error(element: e, type: 333, description: "Make sure that the attribute #{e[:attribute]} in `<#{e[:tag]}>` has the value #{e[:value]}")
|
388
409
|
end
|
389
410
|
else
|
411
|
+
p "add code_checked"
|
412
|
+
css_code_checked << element_checked
|
390
413
|
exist_in_body << true
|
391
414
|
end
|
392
415
|
|
393
416
|
end
|
417
|
+
|
418
|
+
end #if element checked
|
394
419
|
end
|
395
420
|
|
396
421
|
# Check that tags exist within parent tags
|
@@ -429,6 +454,7 @@ class CodeTerminator::Html
|
|
429
454
|
end
|
430
455
|
|
431
456
|
end
|
457
|
+
p css_code_checked
|
432
458
|
|
433
459
|
html_errors
|
434
460
|
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.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evelin Ponce
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- exercises/issue19.html
|
167
167
|
- exercises/issue20.html
|
168
168
|
- exercises/issue21.html
|
169
|
+
- exercises/issue22.html
|
169
170
|
- exercises/new.html
|
170
171
|
- exercises/new2.html
|
171
172
|
- exercises/test.css
|