Esempio n. 1
0
 /** Converts HTML code to LaTeX code */
 private static void doConvertHTML(BibtexEntry entry, NamedCompound ce) {
   final String field = "title";
   String oldValue = entry.getField(field);
   if (oldValue == null) {
     return;
   }
   final HTMLConverter htmlConverter = new HTMLConverter();
   String newValue = htmlConverter.format(oldValue);
   if (!oldValue.equals(newValue)) {
     entry.setField(field, newValue);
     ce.addEdit(new UndoableFieldChange(entry, field, oldValue, newValue));
   }
 }
Esempio n. 2
0
 /** Converts Unicode characters to LaTeX code */
 private static void doConvertUnicode(BibtexEntry entry, NamedCompound ce) {
   final String[] fields = {"title", "author", "abstract"};
   for (String field : fields) {
     String oldValue = entry.getField(field);
     if (oldValue == null) {
       return;
     }
     final HTMLConverter htmlConverter = new HTMLConverter();
     String newValue = htmlConverter.formatUnicode(oldValue);
     if (!oldValue.equals(newValue)) {
       entry.setField(field, newValue);
       ce.addEdit(new UndoableFieldChange(entry, field, oldValue, newValue));
     }
   }
 }
Esempio n. 3
0
 @Override
 public List<FieldChange> cleanup(BibEntry entry) {
   ArrayList<FieldChange> changes = new ArrayList<>();
   final String[] fields = {"title", "author", "abstract"};
   for (String field : fields) {
     String oldValue = entry.getField(field);
     if (oldValue == null) {
       break;
     }
     final HTMLConverter htmlConverter = new HTMLConverter();
     String newValue = htmlConverter.formatUnicode(oldValue);
     if (!oldValue.equals(newValue)) {
       entry.setField(field, newValue);
       changes.add(new FieldChange(entry, field, oldValue, newValue));
     }
   }
   return changes;
 }
Esempio n. 4
0
  /**
   * This method must convert HTML style char sequences to normal characters.
   *
   * @param text The text to handle.
   * @return The converted text.
   */
  private String convertHTMLChars(String text) {

    return htmlConverter.format(text);
  }