Пример #1
0
 public String getUntaggedNodeText() {
   String nodeText = node.getText();
   // cache empty or dirty?:
   if (untaggedNodeText == null
       || (originalNodeText != null && !originalNodeText.equals(nodeText))) {
     originalNodeText = nodeText;
     // remove tags:
     untaggedNodeText = HtmlTools.htmlToPlain(nodeText).replaceAll("\\s+", " ");
   }
   return untaggedNodeText;
 }
Пример #2
0
 public String getUntaggedNotesText() {
   String notesText = node.getNoteText();
   if (notesText == null) return "";
   if (untaggedNotesText == null
       || (originalNotesText != null && !originalNotesText.equals(notesText))) {
     originalNotesText = notesText;
     // remove tags:
     untaggedNotesText = HtmlTools.removeHtmlTagsFromString(notesText).replaceAll("\\s+", " ");
   }
   return untaggedNotesText;
 }
Пример #3
0
 public static void replace(
     IReplaceInputInformation info, String searchString, String replaceString) {
   String regExp = "(" + (searchString) + ")";
   Pattern p = Pattern.compile(regExp, Pattern.CASE_INSENSITIVE);
   // String replacement = getPureRegularExpression(replaceString);
   String replacement = (replaceString);
   int length = info.getLength();
   for (int i = 0; i < length; i++) {
     NodeHolder nodeHolder = info.getNodeHolderAt(i);
     String text = nodeHolder.node.getText();
     String replaceResult = HtmlTools.getInstance().getReplaceResult(p, replacement, text);
     if (!Tools.safeEquals(text, replaceResult)) {
       // set new node text only, if different.
       info.changeString(nodeHolder, replaceResult);
     }
   }
 }