Examples of diff_main()


Examples of name.fraser.neil.plaintext.DiffMatchPatch.diff_main()

          }
          String oldValue = oldText.getObject();
          if (oldValue == null || "null".equals(oldValue) == true) {
            oldValue = getString("label.null");
          }
          final LinkedList<Diff> diffs = diffMatchPatch.diff_main(oldValue, newValue);
          diffMatchPatch.diff_cleanupSemantic(diffs);
          prettyHtml = getPrettyHtml(diffs);
        }
        return prettyHtml;
      }
View Full Code Here

Examples of name.fraser.neil.plaintext.diff_match_patch.diff_main()

 
  private void assertHtmlEquals(String expected, String serialized) {
    // Compute the diff of expected vs. serialized, and disregard constructs that we don't
    // care about, such as whitespace deltas and differently-computed escape sequences.
    diff_match_patch dmp = new diff_match_patch();
    LinkedList<Diff> diffs = dmp.diff_main(expected, serialized);
    while (diffs.size() > 0) {
      Diff cur = diffs.removeFirst();
      switch (cur.operation) {
      case DELETE:
        if (StringUtils.isBlank(cur.text) || "amp;".equalsIgnoreCase(cur.text)) {
View Full Code Here

Examples of name.fraser.neil.plaintext.diff_match_patch.diff_main()

        history.setProperty(Page.USER, identity);

        // create the diff
        diff_match_patch dmp = new diff_match_patch();
        // create the diff
        LinkedList<Diff> diffs = dmp.diff_main(oldPage.getContent(),
            p.getContent());
        // make the diff human readable
        dmp.diff_cleanupSemantic(diffs);
        // convert the diff to html
        String diff = dmp.diff_prettyHtml(diffs);
View Full Code Here

Examples of name.fraser.neil.plaintext.diff_match_patch.diff_main()

 
  private void assertHtmlEquals(String expected, String serialized) {
    // Compute the diff of expected vs. serialized, and disregard constructs that we don't
    // care about, such as whitespace deltas and differently-computed escape sequences.
    diff_match_patch dmp = new diff_match_patch();
    LinkedList<Diff> diffs = dmp.diff_main(expected, serialized);
    while (!diffs.isEmpty()) {
      Diff cur = diffs.removeFirst();
      switch (cur.operation) {
      case DELETE:
        if (StringUtils.isBlank(cur.text) || "amp;".equalsIgnoreCase(cur.text)) {
View Full Code Here

Examples of name.fraser.neil.plaintext.diff_match_patch.diff_main()

        HtmlView htmlView = new HtmlView();
        StringBuffer newHtml = new StringBuffer();
        StringBuffer oldHtml = new StringBuffer();

        diff_match_patch dmp = new diff_match_patch();
        LinkedList<diff_match_patch.Diff> diffs = dmp.diff_main(oldContent, newContent);

        for (diff_match_patch.Diff diff : diffs) {
            String text = diff.text.replace("&", "&amp;").replace("<", "&lt;")
                    .replace(">", "&gt;").replace(XmlUtil.crlf, "<br>");
            if (diff.operation == diff_match_patch.Operation.INSERT) {
View Full Code Here

Examples of name.fraser.neil.plaintext.diff_match_patch.diff_main()

  public static String runComparison(String s1, String s2) {
    s1 = s1.replace("<br/>", "\n");
    s2 = s2.replace("<br/>", "\n");
    diff_match_patch dmp = new diff_match_patch();
    dmp.Diff_EditCost = 30;
    LinkedList<Diff> ll = dmp.diff_main(s1, s2);
    dmp.diff_cleanupEfficiency(ll);
    return dmp.diff_prettyHtml(ll);
  }

  public static void handleException(Throwable e) {
View Full Code Here

Examples of name.fraser.neil.plaintext.diff_match_patch.diff_main()

  private void assertHtmlEquals(String expected, String serialized) {
    // Compute the diff of expected vs. serialized, and disregard constructs that we don't
    // care about, such as whitespace deltas and differently-computed escape sequences.
    diff_match_patch dmp = new diff_match_patch();
    LinkedList<Diff> diffs = dmp.diff_main(expected, serialized);
    while (!diffs.isEmpty()) {
      Diff cur = diffs.removeFirst();
      switch (cur.operation) {
      case DELETE:
        if (StringUtils.isBlank(cur.text) || "amp;".equalsIgnoreCase(cur.text)) {
View Full Code Here

Examples of name.neil.fraser.plaintext.diff_match_patch.diff_main()

    if (!newParagraphs.isEmpty()) {
      diff_match_patch dmp = new diff_match_patch();
      for (Node newParagraph : newParagraphs) {
        int minEditDistance = Integer.MAX_VALUE;
        for (Node oldParagraph : oldParagraphs) {
          LinkedList<Diff> diffs = dmp.diff_main(
              getTextContent(oldParagraph), getTextContent(newParagraph));
          minEditDistance = Math.min(minEditDistance, modifiedLevenshteinDistance(diffs));
        }
        if (minEditDistance > EDIT_DISTANCE_THRESHOLD) {
          Element paragraphElement = (Element) newParagraph;
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.