Examples of LayoutFormatter


Examples of net.sf.jabref.export.layout.LayoutFormatter

  /**
   * Test method for {@link net.sf.jabref.export.layout.format.AuthorFirstLastOxfordCommas#format(java.lang.String)}.
   */
  public void testFormat() {
    LayoutFormatter a = new AuthorFirstLastOxfordCommas();

    // Empty case
    assertEquals("", a.format(""));

    // Single Names
    assertEquals("Van Something Someone", a.format("Someone, Van Something"));

    // Two names
    assertEquals("John von Neumann and Peter Black Brown", a
      .format("John von Neumann and Peter Black Brown"));

    // Three names
    assertEquals("John von Neumann, John Smith, and Peter Black Brown", a
      .format("von Neumann, John and Smith, John and Black Brown, Peter"));

    assertEquals("John von Neumann, John Smith, and Peter Black Brown", a
      .format("John von Neumann and John Smith and Black Brown, Peter"));
  }
View Full Code Here

Examples of net.sf.jabref.export.layout.LayoutFormatter

public class HTMLCharsTest extends TestCase {

  public void testBasicFormat() {

    LayoutFormatter layout = new HTMLChars();

    assertEquals("", layout.format(""));

    assertEquals("hallo", layout.format("hallo"));

    assertEquals("R�flexions sur le timing de la quantit�", layout
      .format("R�flexions sur le timing de la quantit�"));

    assertEquals("hállo", layout.format("h\\'allo"));
   
    assertEquals("ı ı", layout.format("\\i \\i"));
    assertEquals("ı", layout.format("\\i"));
    assertEquals("ı", layout.format("\\{i}"));
    assertEquals("ıı", layout.format("\\i\\i"));
   
    assertEquals("Ŀı", layout.format("\\Lmidot\\i"));
   
    assertEquals("ñ ñ í ı ı", layout.format("\\~{n} \\~n \\'i \\i \\i"));
  }
View Full Code Here

Examples of net.sf.jabref.export.layout.LayoutFormatter

    assertEquals("ñ ñ í ı ı", layout.format("\\~{n} \\~n \\'i \\i \\i"));
  }

  public void testLaTeXHighlighting() {

    LayoutFormatter layout = new HTMLChars();

    assertEquals("<em>hallo</em>", layout.format("\\emph{hallo}"));
    assertEquals("<em>hallo</em>", layout.format("{\\emph hallo}"));

    assertEquals("<em>hallo</em>", layout.format("\\textit{hallo}"));
    assertEquals("<em>hallo</em>", layout.format("{\\textit hallo}"));

    assertEquals("<b>hallo</b>", layout.format("\\textbf{hallo}"));
    assertEquals("<b>hallo</b>", layout.format("{\\textbf hallo}"));
  }
View Full Code Here

Examples of net.sf.jabref.export.layout.LayoutFormatter

public class RTFCharsTest extends TestCase {

  public void testBasicFormat() {

    LayoutFormatter layout = new RTFChars();

    assertEquals("", layout.format(""));

    assertEquals("hallo", layout.format("hallo"));

    // We should be able to replace the ? with e
    assertEquals("R\\u233?flexions sur le timing de la quantit\\u233?", layout.format("R�flexions sur le timing de la quantit�"));

    assertEquals("h\\u225allo", layout.format("h\\'allo"));
    assertEquals("h\\u225allo", layout.format("h\\'allo"));
  }
View Full Code Here

Examples of net.sf.jabref.export.layout.LayoutFormatter

    assertEquals("h\\u225allo", layout.format("h\\'allo"));
  }

  public void testLaTeXHighlighting(){
   
    LayoutFormatter layout = new RTFChars();
   
    assertEquals("{\\i hallo}", layout.format("\\emph{hallo}"));
    assertEquals("{\\i hallo}", layout.format("{\\emph hallo}"));

    assertEquals("{\\i hallo}", layout.format("\\textit{hallo}"));
    assertEquals("{\\i hallo}", layout.format("{\\textit hallo}"));

    assertEquals("{\\b hallo}", layout.format("\\textbf{hallo}"));
    assertEquals("{\\b hallo}", layout.format("{\\textbf hallo}"));
  }
View Full Code Here

Examples of net.sf.jabref.export.layout.LayoutFormatter

    assertEquals("{\\b hallo}", layout.format("\\textbf{hallo}"));
    assertEquals("{\\b hallo}", layout.format("{\\textbf hallo}"));
  }
 
  public void testComplicated() {
    LayoutFormatter layout = new RTFChars();

    assertEquals("R\\u233eflexions sur le timing de la quantit\\u233e \\u230ae should be \\u230ae", layout.format("R�flexions sur le timing de la quantit� \\ae should be �"));

    assertEquals("h\\u225all{\\uc2\\u339oe}", layout.format("h\\'all\\oe "));
  }
View Full Code Here

Examples of net.sf.jabref.export.layout.LayoutFormatter

    assertEquals("h\\u225all{\\uc2\\u339oe}", layout.format("h\\'all\\oe "));
  }

  public void testSpecialCharacters() {

    LayoutFormatter layout = new RTFChars();

    assertEquals("\\u243o", layout.format("\\'{o}")); // �
    assertEquals("\\'f2", layout.format("\\`{o}")); // �
    assertEquals("\\'f4", layout.format("\\^{o}")); // �
    assertEquals("\\'f6", layout.format("\\\"{o}")); // �
    assertEquals("\\u245o", layout.format("\\~{o}")); // �
    assertEquals("\\u333o", layout.format("\\={o}"));
    assertEquals("\\u334O", layout.format("\\u{o}"));
    assertEquals("\\u231c", layout.format("\\c{c}")); // �
    assertEquals("{\\uc2\\u339oe}", layout.format("\\oe"));
    assertEquals("{\\uc2\\u338OE}", layout.format("\\OE"));
    assertEquals("{\\uc2\\u230ae}", layout.format("\\ae")); // �
    assertEquals("{\\uc2\\u198AE}", layout.format("\\AE")); // �

    assertEquals("", layout.format("\\.{o}")); // ???
    assertEquals("", layout.format("\\v{o}")); // ???
    assertEquals("", layout.format("\\H{a}")); // � // ???
    assertEquals("", layout.format("\\t{oo}"));
    assertEquals("", layout.format("\\d{o}")); // ???
    assertEquals("", layout.format("\\b{o}")); // ???
    assertEquals("", layout.format("\\aa")); // �
    assertEquals("", layout.format("\\AA")); // �
    assertEquals("", layout.format("\\o")); // �
    assertEquals("", layout.format("\\O")); // �
    assertEquals("", layout.format("\\l"));
    assertEquals("", layout.format("\\L"));
    assertEquals("{\\uc2\\u223ss}", layout.format("\\ss")); // �
    assertEquals("", layout.format("?`")); // �
    assertEquals("", layout.format("!`")); // �

    assertEquals("", layout.format("\\dag"));
    assertEquals("", layout.format("\\ddag"));
    assertEquals("", layout.format("\\S")); // �
    assertEquals("", layout.format("\\P")); // �
    assertEquals("", layout.format("\\copyright")); // �
    assertEquals("", layout.format("\\pounds")); // �
  }
View Full Code Here

Examples of net.sf.jabref.export.layout.LayoutFormatter

    handledExtensions.add(BIBTEX + "author");
    populateFromBibtex(bibtex);
  }
 
  protected void populateFromBibtex(BibtexEntry bibtex) {
    LayoutFormatter chars = new XMLChars();
    if (bibtex.getField("title") != null) {
      if(CHARFORMAT)
        title = chars.format(bibtex.getField("title").toString());
      else
        title = bibtex.getField("title").toString();
    }
   
    if (bibtex.getField("publisher") != null) {
      if(CHARFORMAT)
        publisher = chars.format(bibtex.getField("publisher").toString());
      else
        publisher = bibtex.getField("publisher").toString();
    }
     
    if (bibtex.getField("bibtexkey") != null)
      id = bibtex.getField("bibtexkey").toString();
    if (bibtex.getField("place") != null) {
      if(CHARFORMAT)
        place = chars.format(bibtex.getField("place").toString());
      else
        place = bibtex.getField("place").toString();
    }
     
    date = getDate(bibtex)
View Full Code Here

Examples of net.sf.jabref.export.layout.LayoutFormatter

    }
  }
 
  protected List<PersonName> getAuthors(String authors) {
    List<PersonName> result = new LinkedList<PersonName>();
    LayoutFormatter chars = new XMLChars();
   
    if (authors.indexOf(" and ") == -1) {
      if(CHARFORMAT)
        result.add(new PersonName(chars.format(authors)));
      else
        result.add(new PersonName(authors));
    }
        else
        {
            String[] names = authors.split(" and ");
            for (int i=0; i<names.length; i++) {
              if(CHARFORMAT)
                result.add(new PersonName(chars.format(names[i])));
              else
                result.add(new PersonName(names[i]));
            }
        }
    return result;
View Full Code Here

Examples of net.sf.jabref.export.layout.LayoutFormatter

  private String format(String value)
  {
    if(value == null)
      return null;
    String result = null;
    LayoutFormatter chars = new XMLChars();
    result = chars.format(value);
    return result;
  }
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.