Examples of PageElementFunction


Examples of org.wikipediacleaner.api.data.PageElementFunction

              nbCr++;
            }
            tmpIndex--;
          }
          PageElementTemplate template = analysis.isInTemplate(tmpIndex - 1);
          PageElementFunction function = analysis.isInFunction(tmpIndex - 1);
          if ((template != null) && (template.getEndIndex() == tmpIndex)) {
            replacement.append("\n\n");
            beginIndex = tmpIndex;
          } else if ((function != null) && (function.getEndIndex() == tmpIndex)) {
            if (function.getMagicWord().isPossibleAlias(MagicWord.DEFAULT_SORT)) {
              tmpIndex = function.getBeginIndex();
              while ((tmpIndex > 0) &&
                     ((contents.charAt(tmpIndex - 1) == ' ') ||
                      (contents.charAt(tmpIndex - 1) == '\n'))) {
                tmpIndex--;
              }
              replacement.append("\n\n");
              replacement.append(contents.substring(function.getBeginIndex(), function.getEndIndex()));
            }
            replacement.append("\n");
            beginIndex = tmpIndex;
          } else if (analysis.getPage().isRedirect() && (nbCr == 0)) {
            int crIndex = contents.indexOf('\n');
View Full Code Here

Examples of org.wikipediacleaner.api.data.PageElementFunction

        if ((template != null) && (template.getEndIndex() == currentIndex + 2)) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        PageElementFunction function = analysis.isInFunction(currentIndex);
        if ((function != null) && (function.getEndIndex() == currentIndex + 2)) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        if ((currentIndex + 2 < maxLength) &&
View Full Code Here

Examples of org.wikipediacleaner.api.data.PageElementFunction

             (template.getBeginIndex() == currentIndex + 1))) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        PageElementFunction function = analysis.isInFunction(currentIndex + 2);
        if ((function != null) &&
            ((function.getBeginIndex() == currentIndex) ||
             (function.getBeginIndex() == currentIndex + 1))) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        if ((currentIndex + 2 < maxLength) &&
View Full Code Here

Examples of org.wikipediacleaner.api.data.PageElementFunction

      if (contents.charAt(tmpIndex) == '{') {
        PageElementTemplate template = analysis.isInTemplate(tmpIndex);
        if ((template != null) && (template.getBeginIndex() == tmpIndex)) {
          nextIndex = template.getEndIndex();
        } else {
          PageElementFunction function = analysis.isInFunction(tmpIndex);
          if ((function != null) && (function.getBeginIndex() == tmpIndex)) {
            nextIndex = function.getEndIndex();
          }
        }
      }
      if (!finished) {
        tmpIndex = nextIndex;
View Full Code Here

Examples of org.wikipediacleaner.api.data.PageElementFunction

          }
        }

        // Check for functions
        if (!done) {
          PageElementFunction function = analysis.isInFunction(currentIndex);
          if ((function != null) &&
              (function.getBeginIndex() == currentIndex)) {
            MagicWord magicWord = function.getMagicWord();
            String magicWordName = magicWord.getName();
            boolean isOk = false;
            if (MagicWord.DEFAULT_SORT.equals(magicWordName) ||
                MagicWord.FORMAT_NUM.equals(magicWordName) ||
                MagicWord.DISPLAY_TITLE.equals(magicWordName)) {
              isOk = true;
            }
            if (!isOk &&
                MagicWord.TAG.equals(magicWordName) &&
                (function.getParameterCount() > 0) &&
                (PageElementTag.TAG_WIKI_REF.equals(function.getParameterValue(0)))) {
              isOk = true;
            }
            if (!isOk) {
              result = true;
              done = true;
              if (errors == null) {
                return true;
              }
              CheckErrorResult errorResult = createCheckErrorResult(
                  analysis, function.getBeginIndex(), function.getEndIndex());
              if (MagicWord.PAGE_NAME.equals(magicWordName)) {
                errorResult.addReplacement(page.getTitle());
              }
              if (MagicWord.IF_EXPR.equals(magicWordName)) {
                for (int param = 1; param < function.getParameterCount(); param++) {
                  errorResult.addReplacement(function.getParameterValue(param));
                }
              }
              if ((analysis.isInTag(currentIndex, PageElementTag.TAG_WIKI_GALLERY) == null) &&
                  (analysis.isInTag(currentIndex, PageElementTag.TAG_WIKI_INCLUDEONLY) == null) &&
                  (analysis.isInTag(currentIndex, PageElementTag.TAG_WIKI_REF) == null) &&
                  (analysis.isInTag(currentIndex, PageElementTag.TAG_WIKI_TIMELINE) == null)) {
                errorResult.addReplacement(
                    "{{subst:" +
                    contents.substring(function.getBeginIndex() + 2, function.getEndIndex()));
              }
              errors.add(errorResult);
              nextIndex = function.getEndIndex();
            } else {
              nextIndex = currentIndex + 2;
            }
          }
        }
View Full Code Here

Examples of org.wikipediacleaner.api.data.PageElementFunction

      return createDefaultPopupParameter(pageAnalysis, position, parameter);
    }

    // Menu for function
    if (element instanceof PageElementFunction) {
      PageElementFunction function = (PageElementFunction) element;
      return createDefaultPopupFunction(pageAnalysis, position, function);
    }

    // Menu for ISBN
    if (element instanceof PageElementISBN) {
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.