Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into winBuild
Browse files Browse the repository at this point in the history
* upstream/master:
  Jstor Fetcher (#6992)
  Group: "Searching for keywords" searches for a single keyword ==> use singular (#6995)
  Merge parsing of bracketed patterns (#6989)
  6848 fixed the issue of clicking collapse all expanding tree (#6993)
  Enable auto sync per default for Open/Libre Office (#6985)
  Bump unirest-java from 3.11.00 to 3.11.01 (#7001)
  Bump byte-buddy-parent from 1.10.16 to 1.10.17 (#7004)
  Bump lucene-queryparser from 8.6.2 to 8.6.3 (#7002)
  Bump postgresql from 42.2.16 to 42.2.17 (#7005)
  Bump pascalgn/automerge-action from v0.11.0 to v0.12.0 (#7006)
  Bump flowless from 0.6.1 to 0.6.2 (#7003)
  • Loading branch information
Siedlerchr committed Oct 14, 2020
2 parents 439924c + 170e900 commit 99f4de9
Show file tree
Hide file tree
Showing 16 changed files with 411 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Merge pull requests
uses: pascalgn/automerge-action@v0.11.0
uses: pascalgn/automerge-action@v0.12.0
if: steps.waitforstatuschecks.outputs.status == 'success'
env:
MERGE_METHOD: "squash"
Expand Down
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ Eiswindyeti
Ellen Reitmayr
Erdem Derebasoglu
Erdem Derebaşoğlu
Eric Lau
Erik Putrycz
Ervin Kolenovic
Escoul
Expand Down Expand Up @@ -179,6 +180,7 @@ Jens Döcke
joeyzgraggen
Johannes Hupe
Johannes Manner
Johannes Theiner
John David
John Relph
John Zedlewski
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We added a query parser and mapping layer to enable conversion of queries formulated in simplified lucene syntax by the user into api queries. [#6799](https://github.com/JabRef/jabref/pull/6799)
- We added some basic functionality to customise the look of JabRef by importing a css theme file. [#5790](https://github.com/JabRef/jabref/issues/5790)
- We added connection check function in network preference setting [#6560](https://github.com/JabRef/jabref/issues/6560)
- We added a new fetcher to enable users to search jstor.org [#6627](https://github.com/JabRef/jabref/issues/6627)

### Changed

- We changed the default preferences for OpenOffice/LibreOffice integration to automatically sync the bibliography when
inserting new citations in a OpenOffic/LibreOffice document. [#6957](https://github.com/JabRef/jabref/issues/6957)
- We restructured the 'File' tab and extracted some parts into the 'Linked files' tab [#6779](https://github.com/JabRef/jabref/pull/6779)
- JabRef now offers journal lists from <https://abbrv.jabref.org>. JabRef the lists which use a dot inside the abbreviations. [#5749](https://github.com/JabRef/jabref/pull/5749)
- We removed two useless preferences in the groups preferences dialog. [#6836](https://github.com/JabRef/jabref/pull/6836)
Expand All @@ -33,6 +36,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We improved the detection of "short" DOIs [6880](https://github.com/JabRef/jabref/issues/6880)
- We improved the duplicate detection when identifiers like DOI or arxiv are semantiaclly the same, but just syntactically differ (e.g. with or without http(s):// prefix). [#6707](https://github.com/JabRef/jabref/issues/6707)
- We changed in the group interface "Generate groups from keywords in a BibTeX field" by "Generate groups from keywords in the following field". [#6983](https://github.com/JabRef/jabref/issues/6983)
- We changed the name of a group type from "Searching for keywords" to "Searching for a keyword". [6995](https://github.com/JabRef/jabref/pull/6995)

### Fixed

Expand All @@ -48,6 +52,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue where it was impossible to connect to OpenOffice/LibreOffice on Mac OSX. [#6970](https://github.com/JabRef/jabref/pull/6970)
- We fixed an issue with the python script used by browser plugins that failed to locate JabRef if not installed in its default location. [#6963](https://github.com/JabRef/jabref/pull/6963/files)
- We fixed an issue where identity column header had incorrect foreground color in the Dark theme. [#6796](https://github.com/JabRef/jabref/issues/6796)
- We fixed an issue where clicking on Collapse All button in the Search for Unlinked Local Files expanded the directory structure erroneously [#6848](https://github.com/JabRef/jabref/issues/6848)

### Removed

Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ dependencies {
antlr4 'org.antlr:antlr4:4.8-1'
implementation 'org.antlr:antlr4-runtime:4.8-1'

implementation (group: 'org.apache.lucene', name: 'lucene-queryparser', version: '8.6.2') {
implementation (group: 'org.apache.lucene', name: 'lucene-queryparser', version: '8.6.3') {
exclude group: 'org.apache.lucene', module: 'lucene-sandbox'
}

implementation group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.7.0'

implementation 'org.postgresql:postgresql:42.2.16'
implementation 'org.postgresql:postgresql:42.2.17'

implementation ('com.oracle.ojdbc:ojdbc10:19.3.0.0') {
// causing module issues
Expand All @@ -163,14 +163,14 @@ dependencies {
implementation 'de.saxsys:mvvmfx-validation:1.9.0-SNAPSHOT'
implementation 'de.saxsys:mvvmfx:1.8.0'
implementation 'com.tobiasdiez:easybind:2.1.0'
implementation 'org.fxmisc.flowless:flowless:0.6.1'
implementation 'org.fxmisc.flowless:flowless:0.6.2'
implementation 'org.fxmisc.richtext:richtextfx:0.10.4'
implementation group: 'org.glassfish.hk2.external', name: 'jakarta.inject', version: '2.6.1'
implementation 'com.jfoenix:jfoenix:9.0.10'
implementation 'org.controlsfx:controlsfx:11.0.2'

implementation 'org.jsoup:jsoup:1.13.1'
implementation 'com.konghq:unirest-java:3.11.00'
implementation 'com.konghq:unirest-java:3.11.01'

implementation 'org.slf4j:slf4j-api:2.0.0-alpha1'
implementation group: 'org.apache.logging.log4j', name: 'log4j-jcl', version: '3.0.0-SNAPSHOT'
Expand Down Expand Up @@ -204,7 +204,7 @@ dependencies {
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.7.0'
testImplementation 'org.junit.platform:junit-platform-launcher:1.7.0'

testImplementation 'net.bytebuddy:byte-buddy-parent:1.10.16'
testImplementation 'net.bytebuddy:byte-buddy-parent:1.10.17'
testRuntime group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT'
testRuntime group: 'org.apache.logging.log4j', name: 'log4j-jul', version: '3.0.0-SNAPSHOT'
testImplementation 'org.mockito:mockito-core:3.5.13'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private void initialize() {
buttonOptionCollapseAll.setOnAction(event -> {
CheckBoxTreeItem<FileNodeWrapper> root = (CheckBoxTreeItem<FileNodeWrapper>) tree.getRoot();
expandTree(root, false);
root.setExpanded(true);
root.setExpanded(false);
});

textfieldDirectoryPath = new TextField();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/groups/GroupDialog.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
</tooltip>
</RadioButton>
<RadioButton fx:id="keywordsRadioButton" toggleGroup="$type" wrapText="true"
text="%Searching for keywords">
text="%Searching for a keyword">
<tooltip>
<Tooltip text="%Dynamically group entries by searching a field for a keyword"/>
</tooltip>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/gui/groups/GroupDialogViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,20 @@ private void setupValidation() {
}
},
ValidationMessage.error(String.format("%s > %n %s %n %n %s",
Localization.lang("Searching for keywords"),
Localization.lang("Searching for a keyword"),
Localization.lang("Keywords"),
Localization.lang("Invalid regular expression."))));

keywordFieldEmptyValidator = new FunctionBasedValidator<>(
keywordGroupSearchFieldProperty,
StringUtil::isNotBlank,
ValidationMessage.error(Localization.lang("Please enter a field name to search for keywords.")));
ValidationMessage.error(Localization.lang("Please enter a field name to search for a keyword.")));

keywordSearchTermEmptyValidator = new FunctionBasedValidator<>(
keywordGroupSearchTermProperty,
input -> !StringUtil.isNullOrEmpty(input),
ValidationMessage.error(String.format("%s > %n %s %n %n %s",
Localization.lang("Searching for keywords"),
Localization.lang("Searching for a keyword"),
Localization.lang("Keywords"),
Localization.lang("Search term is empty.")
)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,43 @@ public String expand(BibEntry bibentry, Character keywordDelimiter, BibDatabase
public static String expandBrackets(String pattern, Character keywordDelimiter, BibEntry entry, BibDatabase database) {
Objects.requireNonNull(pattern);
Objects.requireNonNull(entry);
return expandBrackets(pattern, expandBracketContent(keywordDelimiter, entry, database));
}

/**
* Utility method creating a function taking the string representation of the content of a bracketed expression and
* expanding it.
*
* @param keywordDelimiter The keyword delimiter to use
* @param entry The {@link BibEntry} to use for expansion
* @param database The {@link BibDatabase} for field resolving. May be null.
* @return a function accepting a bracketed expression and returning the result of expanding it
*/
private static Function<String, String> expandBracketContent(Character keywordDelimiter, BibEntry entry, BibDatabase database) {
return (String bracket) -> {
String expandedPattern;
List<String> fieldParts = parseFieldAndModifiers(bracket);
// check whether there is a modifier on the end such as
// ":lower":
expandedPattern = getFieldValue(entry, fieldParts.get(0), keywordDelimiter, database);
if (fieldParts.size() > 1) {
// apply modifiers:
expandedPattern = applyModifiers(expandedPattern, fieldParts, 1);
}
return expandedPattern;
};
}

/**
* Expands a pattern.
*
* @param pattern The pattern to expand
* @param bracketContentHandler A function taking the string representation of the content of a bracketed pattern
* and expanding it
* @return The expanded pattern. Not null.
*/
public static String expandBrackets(String pattern, Function<String, String> bracketContentHandler) {
Objects.requireNonNull(pattern);
StringBuilder expandedPattern = new StringBuilder();
StringTokenizer parsedPattern = new StringTokenizer(pattern, "\\[]\"", true);

Expand All @@ -181,23 +218,14 @@ public static String expandBrackets(String pattern, Character keywordDelimiter,
case "\"" -> appendQuote(expandedPattern, parsedPattern);
case "[" -> {
String fieldMarker = contentBetweenBrackets(parsedPattern, pattern);

List<String> fieldParts = parseFieldMarker(fieldMarker);
// check whether there is a modifier on the end such as
// ":lower":
if (fieldParts.size() <= 1) {
expandedPattern.append(getFieldValue(entry, fieldMarker, keywordDelimiter, database));
} else {
// apply modifiers:
String fieldValue = getFieldValue(entry, fieldParts.get(0), keywordDelimiter, database);
expandedPattern.append(applyModifiers(fieldValue, fieldParts, 1));
}
expandedPattern.append(bracketContentHandler.apply(fieldMarker));
}
case "\\" -> {
if (parsedPattern.hasMoreTokens()) {
expandedPattern.append(parsedPattern.nextToken());
} else {
LOGGER.warn("Found a \"\\\" that is not part of an escape sequence");
}
// FIXME: else -> raise exception or log? (S.G.)
}
default -> expandedPattern.append(token);
}
Expand Down Expand Up @@ -1069,7 +1097,7 @@ public static String lastPage(String pages) {
* @param arg The argument string.
* @return An array of strings representing the parts of the marker
*/
protected static List<String> parseFieldMarker(String arg) {
protected static List<String> parseFieldAndModifiers(String arg) {
List<String> parts = new ArrayList<>();
StringBuilder current = new StringBuilder();
boolean escaped = false;
Expand Down
Loading

0 comments on commit 99f4de9

Please sign in to comment.