Commit 5f26773c5c437c8f8a0b0ef03facb359807a208e

Authored by lyandro.santana
1 parent 754d011d

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
src/main/java/br/com/checker/emag/core/MarkEvaluation.java
... ... @@ -161,6 +161,7 @@ public class MarkEvaluation extends Evaluation {
161 161 List<Occurrence> occurrences = new ArrayList<Occurrence>();
162 162  
163 163 List<String> tags = Arrays.asList("h1","h2","h3","h4","h5","h6","a","p");
  164 + List<Integer> linhasImg = new ArrayList<Integer>();
164 165  
165 166 for (String tag : tags) {
166 167 for (Element element : getDocument().getAllElements(tag)) {
... ... @@ -175,8 +176,13 @@ public class MarkEvaluation extends Evaluation {
175 176 Element img = element.getFirstElement("img");
176 177  
177 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 186 }else{
181 187 if(element.getContent().toString().isEmpty() || element.getContent().toString().trim().equals("")){
182 188 occurrences.add(this.buildOccurrence("1.2", true, element.getStartTag().toString() + endTag, element, "1"));
... ... @@ -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 198 tags = Arrays.asList("!doctype","script","meta","style","head","link","h1","h2","h3","h4","h5","h6","a","p");
192 199  
193 200 for (Element element : getDocument().getAllElements()) {
194 201 if(!tags.contains(element.getName())){
195 202  
196   - if(element != null){
197   -
  203 + if(element != null && !(element.getName().equals("!--"))){
  204 +
198 205 String endTag = element.getEndTag() == null ? "" : element.getEndTag().toString();
199 206  
200 207 Element img = element.getFirstElement("img");
... ... @@ -234,8 +241,9 @@ public class MarkEvaluation extends Evaluation {
234 241 else if(attribute.getCount()==0)
235 242 occurrences.add(this.buildOccurrence("1.2", isError, element.toString(), element, "1"));
236 243 }*/
  244 +
237 245  
238   -
  246 +
239 247 return occurrences;
240 248 }
241 249  
... ...