Commit 5f26773c5c437c8f8a0b0ef03facb359807a208e
1 parent
754d011d
Exists in
master
and in
1 other branch
marcação
git-svn-id: https://svn.bento.ifrs.edu.br/default/ASES/ASES%20-%20Web/ASES%20-%20Web/Fontes/avaliador-api@10453 c2178572-b5ca-4887-91d2-9e3a90c7d55b
Showing
1 changed file
with
14 additions
and
6 deletions
Show diff stats
src/main/java/br/com/checker/emag/core/MarkEvaluation.java
@@ -161,6 +161,7 @@ public class MarkEvaluation extends Evaluation { | @@ -161,6 +161,7 @@ public class MarkEvaluation extends Evaluation { | ||
161 | List<Occurrence> occurrences = new ArrayList<Occurrence>(); | 161 | List<Occurrence> occurrences = new ArrayList<Occurrence>(); |
162 | 162 | ||
163 | List<String> tags = Arrays.asList("h1","h2","h3","h4","h5","h6","a","p"); | 163 | List<String> tags = Arrays.asList("h1","h2","h3","h4","h5","h6","a","p"); |
164 | + List<Integer> linhasImg = new ArrayList<Integer>(); | ||
164 | 165 | ||
165 | for (String tag : tags) { | 166 | for (String tag : tags) { |
166 | for (Element element : getDocument().getAllElements(tag)) { | 167 | for (Element element : getDocument().getAllElements(tag)) { |
@@ -175,8 +176,13 @@ public class MarkEvaluation extends Evaluation { | @@ -175,8 +176,13 @@ public class MarkEvaluation extends Evaluation { | ||
175 | Element img = element.getFirstElement("img"); | 176 | Element img = element.getFirstElement("img"); |
176 | 177 | ||
177 | if(img != null){ | 178 | if(img != null){ |
178 | - if(img.getAttributes().get("alt") != null && img.getAttributes().get("alt").getValue().isEmpty()) | ||
179 | - occurrences.add(this.buildOccurrence("1.2", true,element.getStartTag().toString() + endTag, element, "1")); | 179 | + if(img.getAttributes().get("alt") != null && img.getAttributes().get("alt").getValue().isEmpty()){ |
180 | + | ||
181 | + if(!linhasImg.contains(this.getRow(img))){ | ||
182 | + occurrences.add(this.buildOccurrence("1.2", true,img.getStartTag().toString(), img, "1")); | ||
183 | + } | ||
184 | + linhasImg.add(this.getRow(img)); | ||
185 | + } | ||
180 | }else{ | 186 | }else{ |
181 | if(element.getContent().toString().isEmpty() || element.getContent().toString().trim().equals("")){ | 187 | if(element.getContent().toString().isEmpty() || element.getContent().toString().trim().equals("")){ |
182 | occurrences.add(this.buildOccurrence("1.2", true, element.getStartTag().toString() + endTag, element, "1")); | 188 | occurrences.add(this.buildOccurrence("1.2", true, element.getStartTag().toString() + endTag, element, "1")); |
@@ -187,14 +193,15 @@ public class MarkEvaluation extends Evaluation { | @@ -187,14 +193,15 @@ public class MarkEvaluation extends Evaluation { | ||
187 | 193 | ||
188 | } | 194 | } |
189 | 195 | ||
190 | - List<Integer> linhasImg = new ArrayList<Integer>(); | 196 | + linhasImg = new ArrayList<Integer>(); |
197 | + | ||
191 | tags = Arrays.asList("!doctype","script","meta","style","head","link","h1","h2","h3","h4","h5","h6","a","p"); | 198 | tags = Arrays.asList("!doctype","script","meta","style","head","link","h1","h2","h3","h4","h5","h6","a","p"); |
192 | 199 | ||
193 | for (Element element : getDocument().getAllElements()) { | 200 | for (Element element : getDocument().getAllElements()) { |
194 | if(!tags.contains(element.getName())){ | 201 | if(!tags.contains(element.getName())){ |
195 | 202 | ||
196 | - if(element != null){ | ||
197 | - | 203 | + if(element != null && !(element.getName().equals("!--"))){ |
204 | + | ||
198 | String endTag = element.getEndTag() == null ? "" : element.getEndTag().toString(); | 205 | String endTag = element.getEndTag() == null ? "" : element.getEndTag().toString(); |
199 | 206 | ||
200 | Element img = element.getFirstElement("img"); | 207 | Element img = element.getFirstElement("img"); |
@@ -234,8 +241,9 @@ public class MarkEvaluation extends Evaluation { | @@ -234,8 +241,9 @@ public class MarkEvaluation extends Evaluation { | ||
234 | else if(attribute.getCount()==0) | 241 | else if(attribute.getCount()==0) |
235 | occurrences.add(this.buildOccurrence("1.2", isError, element.toString(), element, "1")); | 242 | occurrences.add(this.buildOccurrence("1.2", isError, element.toString(), element, "1")); |
236 | }*/ | 243 | }*/ |
244 | + | ||
237 | 245 | ||
238 | - | 246 | + |
239 | return occurrences; | 247 | return occurrences; |
240 | } | 248 | } |
241 | 249 |