Examples of CheckErrorResult


Examples of org.wikipediacleaner.api.check.CheckErrorResult

            if (errors == null) {
              return true;
            }
            result = true;
            int endIndex = Math.max(possibleEnd, firstCrIndex);
            CheckErrorResult errorResult = createCheckErrorResult(
                analysis, beginIndex, endIndex);
            if (possibleEnd > 0) {
              StringBuilder replacement = new StringBuilder();
              replacement.append(contents.substring(beginIndex, linkEndIndex));
              if (linkEndIndex < possibleEnd) {
                if (contents.charAt(linkEndIndex) != ' ') {
                  replacement.append(' ');
                }
                replacement.append(contents.substring(linkEndIndex, possibleEnd).replaceAll("\\n", ""));
              }
              if (contents.charAt(possibleEnd - 1) != ']') {
                replacement.append("]");
              }
              replacement.append(contents.substring(possibleEnd, endIndex));
              errorResult.addReplacement(replacement.toString());
            }
            if (firstCrIndex > 0) {
              errorResult.addReplacement(
                  contents.substring(beginIndex, firstCrIndex) + "]" +
                  contents.substring(firstCrIndex, endIndex));
            }
            errors.add(errorResult);
          }
View Full Code Here

Examples of org.wikipediacleaner.api.check.CheckErrorResult

      if (shouldCount) {
        if (errors == null) {
          return true;
        }
        result = true;
        CheckErrorResult errorResult = createCheckErrorResult(
            analysis,
            tag.getCompleteBeginIndex(), tag.getCompleteEndIndex());
        if (tag.isFullTag()) {
          errorResult.addReplacement("");
        } else if (tag.isComplete()) {
          String value = contents.substring(tag.getValueBeginIndex(), tag.getValueEndIndex());
          errorResult.addReplacement(value);
          if (replacements != null) {
            for (String replacement : replacements) {
              errorResult.addReplacement("{{" + replacement + "|" + value + "}}");
            }
          }
          errorResult.addReplacement("''" + value + "''");
          errorResult.addReplacement("'''" + value + "'''");
        }
        errors.add(errorResult);
      }
    }
    return result;
View Full Code Here

Examples of org.wikipediacleaner.api.check.CheckErrorResult

        if (errors == null) {
          return true;
        }
        result = true;
        if (!iTag.isFullTag() && iTag.isComplete()) {
          CheckErrorResult error = createCheckErrorResult(
              analysis,
              iTag.getCompleteBeginIndex(),
              iTag.getCompleteEndIndex());
          String text = analysis.getContents().substring(
              iTag.getValueBeginIndex(),
              iTag.getValueEndIndex());
          if ((text != null) && (text.trim().length() > 0)) {
            String visibleText = text;
            if (text.length() > 30) {
              visibleText = text.substring(0, 10) + "…" + text.substring(text.length() - 10);
            }
            error.addReplacement(
                "''" + text + "''",
                GT._("Replace with {0}", "''" + visibleText + "''"));
            error.addReplacement(
                text,
                GT._("Replace with {0}", visibleText));
          } else {
            error.addReplacement("", GT._("Delete"));
          }
          errors.add(error);
        } else {
          CheckErrorResult error = createCheckErrorResult(
              analysis, iTag.getBeginIndex(), iTag.getEndIndex());
          error.addReplacement("", GT._("Delete"));
          errors.add(error);
        }
      }
    }
    return result;
View Full Code Here

Examples of org.wikipediacleaner.api.check.CheckErrorResult

      if ((refTag != null) || (subTag != null) || (supTag != null)) {
        if (errors == null) {
          return true;
        }
        result = true;
        CheckErrorResult errorResult = createCheckErrorResult(
            analysis,
            smallTag.getBeginIndex(), smallTag.getEndIndex());
        errors.add(errorResult);
      }
    }
View Full Code Here

Examples of org.wikipediacleaner.api.check.CheckErrorResult

      if (weirdCharacters.indexOf(contents.charAt(index)) >= 0) {
        if (errors == null) {
          return true;
        }
        result = true;
        CheckErrorResult errorResult = createCheckErrorResult(
            analysis, index, index + 1);
        errorResult.addReplacement("");
        errors.add(errorResult);
      }
    }

    return result;
View Full Code Here

Examples of org.wikipediacleaner.api.check.CheckErrorResult

          }
          result = true;
          if (commentFound != null) {
            lastPos = commentFound.getBeginIndex();
          }
          CheckErrorResult errorResult = createCheckErrorResult(
              analysis, title.getBeginIndex(), lastPos);
          if (texts != null) {
            for (String text : texts) {
              String replacement =
                  contents.substring(title.getBeginIndex(), title.getEndIndex()) + "\n" +
                  text + "\n\n";
              errorResult.addReplacement(replacement, GT._("Add {0}", text));
            }
          }
          errorResult.addReplacement("", GT._("Delete section"));
          if ((nextTitle != null) && (nextTitle.getLevel() == title.getLevel())) {
            errorResult.addEditTocAction();
          }
          errors.add(errorResult);
        }
      }
    }
View Full Code Here

Examples of org.wikipediacleaner.api.check.CheckErrorResult

        if (breakFound) {
          if (errors == null) {
            return true;
          }
          result = true;
          CheckErrorResult errorResult = createCheckErrorResult(
              analysis, beginError, endError,
              (tagAfter ? ErrorLevel.WARNING : ErrorLevel.ERROR));
          if (!tagAfter) {
            errorResult.addReplacement("");
          }
          errors.add(errorResult);
        }
      }
    }
View Full Code Here

Examples of org.wikipediacleaner.api.check.CheckErrorResult

          }
        }

        // Report error
        int endIndex = (nextTag != null) ? nextTag.getEndIndex() : galleryTag.getEndIndex();
        CheckErrorResult errorResult = createCheckErrorResult(
            analysis, beginIndex, endIndex);
        if (nextTag == null) {
          errorResult.addReplacement("");
          index++;
        } else if (nextTag.getParametersCount() == 0) {
          errorResult.addReplacement(contents.substring(
              galleryTag.getBeginIndex(), galleryTag.getEndIndex()));
          errorResult.addReplacement(contents.substring(
              nextTag.getBeginIndex(), nextTag.getEndIndex()));
          index += 2;
        } else {
          errorResult.addReplacement(contents.substring(
              nextTag.getBeginIndex(), nextTag.getEndIndex()));
          errorResult.addReplacement(contents.substring(
              galleryTag.getBeginIndex(), galleryTag.getEndIndex()));
          index += 2;
        }
        errors.add(errorResult);
      } else {
View Full Code Here

Examples of org.wikipediacleaner.api.check.CheckErrorResult

            }
          }
        }

        // Put each category on a different line
        CheckErrorResult errorResult = createCheckErrorResult(
            analysis,
            beginIndex,
            categories.get(lastCategory).getEndIndex());
        boolean automatic = true;
        for (int i = currentCategory; i < lastCategory; i++) {
          int end = categories.get(i + 1).getBeginIndex();
          for (int index = categories.get(i).getEndIndex(); index < end; index++) {
            char currentChar = contents.charAt(index);
            if ((currentChar != ' ') && (currentChar != '\n')) {
              automatic = false;
            }
          }
          replacement.append(contents.substring(
              categories.get(i).getBeginIndex(),
              end).trim());
          replacement.append('\n');
        }
        String replacementText = (lastCategory - currentCategory > 1) ?
            "[[...]]\u21B5...\u21B5[[...]]" : "[[...]]\u21B5[[...]]";
        replacement.append(contents.substring(
            categories.get(lastCategory).getBeginIndex(),
            categories.get(lastCategory).getEndIndex()));
        errorResult.addReplacement(replacement.toString(), replacementText, automatic);
        errors.add(errorResult);
      }
      currentCategory = lastCategory + 1;
    }
View Full Code Here

Examples of org.wikipediacleaner.api.check.CheckErrorResult

      if ((alt == null) || (alt.trim().length() == 0)) {
        if (errors == null) {
          return true;
        }
        result = true;
        CheckErrorResult error = createCheckErrorResult(
            analysis,
            image.getBeginIndex(), image.getEndIndex());
        errors.add(error);
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.