}
}
}
// clean up publication field
BibtexEntryType type = entry.getType();
String sourceField = "";
if (type.getName() == "Article") {
sourceField = "journal";
entry.clearField("booktitle");
} else if (type.getName() == "Inproceedings"){
sourceField = "booktitle";
}
String fullName = entry.getField(sourceField);
if (fullName != null) {
if (type.getName() == "Article") {
int ind = fullName.indexOf(": Accepted for future publication");
if (ind > 0) {
fullName = fullName.substring(0, ind);
entry.setField("year", "to be published");
entry.clearField("month");
entry.clearField("pages");
}
String[] parts = fullName.split("[\\[\\]]"); //[see also...], [legacy...]
fullName = parts[0];
if (parts.length == 3) {
fullName += parts[2];
}
} else {
fullName = fullName.replace("Conference Proceedings", "Proceedings").
replace("Proceedings of", "Proceedings").replace("Proceedings.", "Proceedings");
fullName = fullName.replaceAll("International", "Int.");
fullName = fullName.replaceAll("Symposium", "Symp.");
fullName = fullName.replaceAll("Conference", "Conf.");
fullName = fullName.replaceAll(" on", " ").replace(" ", " ");
}
Matcher m1 = publicationPattern.matcher(fullName);
if (m1.find()) {
String prefix = m1.group(2).trim();
String postfix = m1.group(1).trim();
String abrv = "";
String[] parts = prefix.split("\\. ", 2);
if (parts.length == 2) {
if (parts[0].matches(abrvPattern)) {
prefix = parts[1];
abrv = parts[0];
} else {
prefix = parts[0];
abrv = parts[1];
}
}
if (prefix.matches(abrvPattern) == false) {
fullName = prefix + " " + postfix + " " + abrv;
fullName = fullName.trim();
} else {
fullName = postfix + " " + prefix;
}
}
if (type.getName() == "Article") {
fullName = fullName.replace("- ", "-"); //IEE Proceedings-
fullName = fullName.trim();
if (Globals.prefs.getBoolean("useIEEEAbrv")) {
String id = Globals.journalAbbrev.getAbbreviatedName(fullName, false);
if (id != null)
fullName = id;
}
}
if (type.getName() == "Inproceedings") {
Matcher m2 = proceedingPattern.matcher(fullName);
if (m2.find()) {
String prefix = m2.group(2);
String postfix = m2.group(1).replaceAll("\\.$", "");
if (prefix.matches(abrvPattern) == false) {