Package name.fraser.neil.plaintext

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


        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

 
  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

        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

  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

  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

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.