Package org.wikipediacleaner.api.check

Examples of org.wikipediacleaner.api.check.CheckErrorResult.addReplacement()


        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


          }
          result = true;
          CheckErrorResult errorResult = createCheckErrorResult(
              analysis,
              title.getBeginIndex(), title.getEndIndex());
          errorResult.addReplacement(PageElementTitle.createTitle(
              title.getLevel(),
              text.substring(0, text.length() - 1),
              title.getAfterTitle()));
          errors.add(errorResult);
        }
View Full Code Here

          CheckErrorResult errorResult = createCheckErrorResult(
              analysis, link.getBeginIndex(), endIndex);
          String replacement = PageElementInternalLink.createInternalLink(
              link.getLinkNotNormalized(), link.getAnchor(),
              link.getDisplayedTextNotTrimmed() + contents.substring(link.getEndIndex(), endIndex));
          errorResult.addReplacement(replacement, GT._("Compact link"));
          errors.add(errorResult);
        }
      }
    }
    return result;
View Full Code Here

            finished = true;
          } else if (tmpChar == '{') {
            if ((tmpIndex == 0) || (contents.charAt(tmpIndex - 1) != '{')) {
              CheckErrorResult errorResult = createCheckErrorResult(
                  analysis, tmpIndex, currentIndex + 2);
              errorResult.addReplacement("{" + contents.substring(tmpIndex, currentIndex + 2));
              errors.add(errorResult);
              result = true;
            }
            errorReported = true;
            finished = true;
View Full Code Here

            if ((firstChar > 0) && (contents.charAt(firstChar - 1) == '[')) {
              firstChar--;
            }
            CheckErrorResult errorResult = createCheckErrorResult(
                analysis, firstChar, currentIndex + 2);
            errorResult.addReplacement("{{" + contents.substring(tmpIndex + 1, currentIndex + 2));
            errorResult.addReplacement("[[" + contents.substring(tmpIndex + 1, currentIndex) + "]]");
            errors.add(errorResult);
            result = true;
            errorReported = true;
            finished = true;
View Full Code Here

              firstChar--;
            }
            CheckErrorResult errorResult = createCheckErrorResult(
                analysis, firstChar, currentIndex + 2);
            errorResult.addReplacement("{{" + contents.substring(tmpIndex + 1, currentIndex + 2));
            errorResult.addReplacement("[[" + contents.substring(tmpIndex + 1, currentIndex) + "]]");
            errors.add(errorResult);
            result = true;
            errorReported = true;
            finished = true;
          }
View Full Code Here

        // Default
        if (!errorReported) {
          CheckErrorResult errorResult = createCheckErrorResult(
              analysis, currentIndex, currentIndex + 2);
          errorResult.addReplacement("", GT._("Delete"));
          errors.add(errorResult);
          result = true;
        }
      }
      currentIndex = contents.indexOf("}}", currentIndex + 2);
View Full Code Here

          } else if (tmpChar == '}') {
            if ((tmpIndex + 1 >= maxLength) ||
                (contents.charAt(tmpIndex + 1) != '}')) {
              CheckErrorResult errorResult = createCheckErrorResult(
                  analysis, currentIndex, tmpIndex + 1);
              errorResult.addReplacement(contents.substring(currentIndex, tmpIndex + 1) + "}");
 
              // Check if the situation is something like [[http://....] (replacement: [http://....])
              boolean protocolFound = PageElementExternalLink.isPossibleProtocol(contents, currentIndex + 2);
              if (protocolFound) {
                errorResult.addReplacement(contents.substring(currentIndex + 1, tmpIndex + 1));
View Full Code Here

              errorResult.addReplacement(contents.substring(currentIndex, tmpIndex + 1) + "}");
 
              // Check if the situation is something like [[http://....] (replacement: [http://....])
              boolean protocolFound = PageElementExternalLink.isPossibleProtocol(contents, currentIndex + 2);
              if (protocolFound) {
                errorResult.addReplacement(contents.substring(currentIndex + 1, tmpIndex + 1));
              }
 
              errors.add(errorResult);
              result = true;
            }
View Full Code Here

            if ((lastChar + 1 < maxLength) && (contents.charAt(lastChar + 1) == ']')) {
              lastChar++;
            }
            CheckErrorResult errorResult = createCheckErrorResult(
                analysis, currentIndex, lastChar + 1);
            errorResult.addReplacement(contents.substring(currentIndex, tmpIndex) + "}}");
            errorResult.addReplacement("[[" + contents.substring(currentIndex + 2, tmpIndex) + "]]");
            errors.add(errorResult);
            result = true;
            errorReported = true;
            finished = true;
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.