Skip to content

Commit

Permalink
Fix #3805: dash correctly terminates commands in layout files (#4137)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasdiez authored and LinusDietz committed Jun 29, 2018
1 parent 8777c16 commit cf9fbb0
Show file tree
Hide file tree
Showing 6 changed files with 329 additions and 339 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where in rare cases entries where overlayed in the main table. https://github.com/JabRef/jabref/issues/3281
- We fixed an issue where selecting a group messed up the focus of the main table / entry editor. https://github.com/JabRef/jabref/issues/3367
- We fixed an issue where composite author names were sorted incorrectly. https://github.com/JabRef/jabref/issues/2828
- We fixed an issue where commands followed by `-` didn't work. [#3805](https://github.com/JabRef/jabref/issues/3805)
- We fixed an issue where some journal names were wrongly marked as abbreviated. [#4115](https://github.com/JabRef/jabref/issues/4115)
- We fixed an issue where the custom file column were sorted incorrectly. https://github.com/JabRef/jabref/issues/3119
- We fixed an issues where the entry losses focus when a field is edited and at the same time used for sorting. https://github.com/JabRef/jabref/issues/3373
Expand Down
59 changes: 28 additions & 31 deletions src/main/java/org/jabref/logic/layout/Layout.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class Layout {

private final List<String> missingFormatters = new ArrayList<>();


public Layout(List<StringInt> parsedEntries, LayoutFormatterPreferences prefs) {
List<LayoutEntry> tmpEntries = new ArrayList<>(parsedEntries.size());

Expand All @@ -32,35 +31,35 @@ public Layout(List<StringInt> parsedEntries, LayoutFormatterPreferences prefs) {

for (StringInt parsedEntry : parsedEntries) {
switch (parsedEntry.i) {
case LayoutHelper.IS_LAYOUT_TEXT:
case LayoutHelper.IS_SIMPLE_FIELD:
case LayoutHelper.IS_OPTION_FIELD:
// Do nothing
break;
case LayoutHelper.IS_FIELD_START:
case LayoutHelper.IS_GROUP_START:
blockEntries = new ArrayList<>();
blockStart = parsedEntry.s;
break;
case LayoutHelper.IS_FIELD_END:
case LayoutHelper.IS_GROUP_END:
if ((blockStart != null) && (blockEntries != null)) {
if (blockStart.equals(parsedEntry.s)) {
blockEntries.add(parsedEntry);
le = new LayoutEntry(blockEntries,
parsedEntry.i == LayoutHelper.IS_FIELD_END ? LayoutHelper.IS_FIELD_START : LayoutHelper.IS_GROUP_START,
prefs);
tmpEntries.add(le);
blockEntries = null;
} else {
LOGGER.debug(blockStart + '\n' + parsedEntry.s);
LOGGER.warn("Nested field/group entries are not implemented!");
Thread.dumpStack();
case LayoutHelper.IS_LAYOUT_TEXT:
case LayoutHelper.IS_SIMPLE_COMMAND:
case LayoutHelper.IS_OPTION_FIELD:
// Do nothing
break;
case LayoutHelper.IS_FIELD_START:
case LayoutHelper.IS_GROUP_START:
blockEntries = new ArrayList<>();
blockStart = parsedEntry.s;
break;
case LayoutHelper.IS_FIELD_END:
case LayoutHelper.IS_GROUP_END:
if ((blockStart != null) && (blockEntries != null)) {
if (blockStart.equals(parsedEntry.s)) {
blockEntries.add(parsedEntry);
le = new LayoutEntry(blockEntries,
parsedEntry.i == LayoutHelper.IS_FIELD_END ? LayoutHelper.IS_FIELD_START : LayoutHelper.IS_GROUP_START,
prefs);
tmpEntries.add(le);
blockEntries = null;
} else {
LOGGER.debug(blockStart + '\n' + parsedEntry.s);
LOGGER.warn("Nested field/group entries are not implemented!");
Thread.dumpStack();
}
}
}
break;
default:
break;
break;
default:
break;
}

if (blockEntries == null) {
Expand Down Expand Up @@ -130,8 +129,6 @@ public String doLayout(BibDatabaseContext databaseContext, Charset encoding) {
return sb.toString();
}

// added section - end (arudert)

public List<String> getMissingFormatters() {
return new ArrayList<>(missingFormatters);
}
Expand Down
Loading

0 comments on commit cf9fbb0

Please sign in to comment.