Skip to content

Commit bd3608e

Browse files
committed
Merge branch 'rewrite-journal-abbrevation-repository-12571' of github.com:LoayTarek5/jabref into rewrite-journal-abbrevation-repository-12571
2 parents 413b39a + 5fd4d85 commit bd3608e

File tree

21 files changed

+213
-34
lines changed

21 files changed

+213
-34
lines changed

.github/workflows/link-issue.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,20 +113,36 @@ jobs:
113113
114114
echo "Updating issue '${{ needs.determine_issue_number.outputs.issue_number }}'"
115115
116-
# Check if good first/second/.. issue
117-
# If yes, copy label to GitHub PR for transparency
116+
117+
# Copy over labels from issue to PR if they match good first/second/third/forth issue or component:* labels
118+
118119
LABELS=$(gh api repos/${{ github.repository }}/issues/${{ needs.determine_issue_number.outputs.issue_number }}/labels --jq '.[].name')
120+
121+
# Check for good first/second/.. issue label
119122
LABEL=$(echo "$LABELS" | grep -E '^good (first|second|third|forth) issue$' || true)
120-
if [ -n "$LABEL" ]; then
121-
echo "✅ Found label: $LABEL"
123+
124+
# Check for component:* labels (can be multiple)
125+
COMPONENT_LABELS=$(echo "$LABELS" | grep -E '^component:' || true)
126+
127+
if [ -n "$LABEL" ] || [ -n "$COMPONENT_LABELS" ]; then
122128
SILENT=false
123-
# Apply label
124-
gh issue edit "${{ github.event.pull_request.number }}" --add-label "$LABEL"
129+
if [ -n "$LABEL" ]; then
130+
echo "✅ Found label: $LABEL"
131+
gh pr edit "${{ github.event.pull_request.number }}" --add-label "$LABEL"
132+
fi
133+
if [ -n "$COMPONENT_LABELS" ]; then
134+
echo "✅ Found component labels:"
135+
while IFS= read -r COMPONENT_LABEL; do
136+
echo " - $COMPONENT_LABEL"
137+
gh pr edit "${{ github.event.pull_request.number }}" --add-label "$COMPONENT_LABEL"
138+
done <<< "$COMPONENT_LABELS"
139+
fi
125140
else
126141
echo "🚫 Silent fail if not possible to add assignee"
127142
SILENT=true
128143
fi
129144
145+
130146
# "gh issue edit" cannot be used - workaround found at https://github.com/cli/cli/issues/9620#issuecomment-2703135049
131147
132148
ASSIGNEES=$(gh api /repos/JabRef/jabref/issues/${{ needs.determine_issue_number.outputs.issue_number }} --jq '[.assignees[].login]')

.github/workflows/tests-code.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757

5858
dependencyscopes:
5959
name: Dependency Scopes
60+
# too slow on ubuntu-slim
6061
runs-on: ubuntu-latest
6162
steps:
6263
- name: Checkout source
@@ -70,7 +71,8 @@ jobs:
7071

7172
openrewrite:
7273
name: OpenRewrite
73-
runs-on: ubuntu-slim
74+
# too slow on ubuntu-slim
75+
runs-on: ubuntu-latest
7476
steps:
7577
- name: Checkout source
7678
uses: actions/checkout@v6
@@ -314,7 +316,8 @@ jobs:
314316
files: |
315317
jablib/src/main/java/org/jabref/logic/citationstyle/CSLStyleUtils.java
316318
jablib/src/test/java/org/jabref/logic/citationstyle/CSLStyleUtilsTest.java
317-
319+
jablib/src/main/java/org/jabref/logic/exporter/AcademicPagesExporter.java
320+
jablib/src/test/java/org/jabref/logic/exporter/AcademicPagesExporterTest.java
318321
- uses: ./.github/actions/setup-gradle
319322
if: steps.changed-windows-related-files.outputs.any_changed == 'true'
320323
- name: Run jablib tests

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
99

1010
## [Unreleased]
1111

12-
- We added `--key-patterns` option to CLI parameters to allows users to set a citation key's pattern for a specific entry type. [#14707](https://github.com/JabRef/jabref/issues/14707)
13-
1412
### Added
1513

14+
- We added `--key-patterns` option to CLI parameters to allows users to set a citation key's pattern for a specific entry type. [#14707](https://github.com/JabRef/jabref/issues/14707)
15+
- We added a CLI option `--field-formatters` to the `convert` and `generate-bib-from-aux` commands to apply field formatters during export. [#11520](https://github.com/JabRef/jabref/issues/11520)
1616
- We added a preference to skip the import dialog for entries received from browser extensions, allowing direct import into the current library. The import dialog is shown by default; users can enable direct import in Preferences.
1717
- We added support for dragging entries from the "Citation relations" tab to other libraries. [#15135](https://github.com/JabRef/jabref/issues/15135)
1818
- We added a fetcher selection dropdown to the citation count field in the General tab, allowing users to choose between Semantic Scholar, OpenAlex, OpenCitations, and scite.ai as the source. The selected fetcher is now persisted across restarts and can also be configured in the Entry Editor preferences. [#15134](https://github.com/JabRef/jabref/issues/15134)
@@ -32,6 +32,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
3232
⚠️ JabRef will recreate the index in a new folder for new files and this will take a long time for a huge library.
3333
Moreover, switching back and forth JabRef versions and meanwhile adding PDFs also requires rebuilding the index now and then.
3434
[#15220](https://github.com/JabRef/jabref/pull/15220)
35+
- We enabled drag and drop of Windows shortcut (`.lnk`) files to open libraries. [#15036](https://github.com/JabRef/jabref/issues/15036)
3536
- We refined the "Select files to import" page in "Search for unlinked local files" dialog to give the users the choice of linking the file to a related entry or import it to a new entry. [#13689](https://github.com/JabRef/jabref/issues/13689)
3637

3738
### Fixed

build-logic/src/main/kotlin/org.jabref.gradle.base.dependency-rules.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jvmDependencyConflicts {
2222
conflictResolution {
2323
select("org.gradlex:jna", "net.java.dev.jna:jna-jpms")
2424
select("org.gradlex:jna-platform", "net.java.dev.jna:jna-platform-jpms")
25+
select("org.jabref:mslinks", "com.github.vatbub:mslinks")
2526
}
2627
}
2728

gradle.properties

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Activate this if you work on the build itself
2+
# org.gradle.logging.level=info
3+
14
org.gradle.vfs.watch=true
25

36
# -Xmx6g
@@ -10,18 +13,17 @@ org.gradle.jvmargs=-Xmx6g -Dorg.kordamp.banner=false
1013

1114
# hint by https://docs.gradle.org/current/userguide/performance.html#enable_configuration_cache
1215
org.gradle.configuration-cache=true
16+
1317
org.gradle.configuration-cache.parallel=true
1418

1519
# hint by https://docs.gradle.org/current/userguide/performance.html#enable_the_build_cache
1620
org.gradle.caching=true
1721

18-
# Activate this if you work on the build itself
19-
# org.gradle.logging.level=info
20-
21-
org.gradle.configureondemand=true
22-
2322
# hint by https://docs.gradle.org/current/userguide/performance.html#sec:enable_parallel_execution
2423
org.gradle.parallel=true
2524

25+
# Causes issues when .kts files change
26+
org.gradle.configureondemand=false
27+
2628
# Tweak Java Toolchains
2729
org.gradle.java.installations.auto-download=true

gradle/modules.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ info.picocli.codegen=info.picocli:picocli-codegen
88
io.github.darvil.terminal.textformatter=io.github.darvil82:terminal-text-formatter
99
io.github.eadr=io.github.adr:e-adr
1010
jul.to.slf4j=org.slf4j:jul-to-slf4j
11-
mslinks=com.github.vatbub:mslinks
11+
mslinks=org.jabref:mslinks
1212
org.apache.logging.log4j.to.slf4j=org.apache.logging.log4j:log4j-to-slf4j
1313
org.glassfish.jersey.container.grizzly2.http=org.glassfish.jersey.containers:jersey-container-grizzly2-http
1414
org.glassfish.jersey.core.common=org.glassfish.jersey.core:jersey-common

jabgui/src/main/java/org/jabref/gui/frame/FrameDndHandler.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,14 @@ private List<Path> getBibFiles(Dragboard dragboard) {
241241
if (!dragboard.hasFiles()) {
242242
return List.of();
243243
} else {
244-
return dragboard.getFiles().stream().map(File::toPath).filter(FileUtil::isBibFile).collect(Collectors.toList());
244+
return dragboard.getFiles().stream().map(File::toPath).filter(this::isAcceptedFile).collect(Collectors.toList());
245245
}
246246
}
247247

248+
private boolean isAcceptedFile(Path path) {
249+
return FileUtil.isBibFile(FileUtil.resolveIfShortcut(path));
250+
}
251+
248252
private boolean hasGroups(Dragboard dragboard) {
249253
return !getGroups(dragboard).isEmpty();
250254
}

jabgui/src/main/java/org/jabref/gui/importer/actions/OpenDatabaseAction.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.Iterator;
99
import java.util.List;
1010
import java.util.Optional;
11+
import java.util.stream.Collectors;
1112

1213
import javax.swing.undo.UndoManager;
1314

@@ -37,6 +38,7 @@
3738
import org.jabref.logic.util.StandardFileType;
3839
import org.jabref.logic.util.TaskExecutor;
3940
import org.jabref.logic.util.io.FileHistory;
41+
import org.jabref.logic.util.io.FileUtil;
4042
import org.jabref.model.entry.BibEntryTypesManager;
4143
import org.jabref.model.util.FileUpdateMonitor;
4244

@@ -163,12 +165,19 @@ public void openFile(Path file) {
163165
///
164166
/// @param filesToOpen the filesToOpen, may be null or not existing
165167
public void openFiles(List<Path> filesToOpen) {
168+
// Resolve any shortcuts to their targets and filter to only .bib files.
169+
// The resulting list must remain modifiable for downstream processing (iterator.remove() calls below).
170+
List<Path> resolvedFiles = filesToOpen.stream()
171+
.map(FileUtil::resolveIfShortcut)
172+
.filter(FileUtil::isBibFile)
173+
.collect(Collectors.toList());
174+
166175
LibraryTab toRaise = null;
167-
int initialCount = filesToOpen.size();
176+
int initialCount = resolvedFiles.size();
168177
int removed = 0;
169178

170179
// Check if any of the files are already open:
171-
for (Iterator<Path> iterator = filesToOpen.iterator(); iterator.hasNext(); ) {
180+
for (Iterator<Path> iterator = resolvedFiles.iterator(); iterator.hasNext(); ) {
172181
Path file = iterator.next();
173182
for (LibraryTab libraryTab : tabContainer.getLibraryTabs()) {
174183
if ((libraryTab.getBibDatabaseContext().getDatabasePath().isPresent())
@@ -188,10 +197,10 @@ public void openFiles(List<Path> filesToOpen) {
188197

189198
// Run the actual open in a thread to prevent the program
190199
// locking until the file is loaded.
191-
if (!filesToOpen.isEmpty()) {
200+
if (!resolvedFiles.isEmpty()) {
192201
assert fileUpdateMonitor != null;
193202
FileHistory fileHistory = preferences.getLastFilesOpenedPreferences().getFileHistory();
194-
filesToOpen.forEach(theFile -> {
203+
resolvedFiles.forEach(theFile -> {
195204
// This method will execute the concrete file opening and loading in a background thread
196205
openTheFile(theFile);
197206
fileHistory.newFile(theFile);

jabgui/src/main/java/org/jabref/gui/maintable/MainTable.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
import org.jabref.logic.journals.JournalAbbreviationRepository;
6262
import org.jabref.logic.l10n.Localization;
6363
import org.jabref.logic.util.TaskExecutor;
64+
import org.jabref.logic.util.io.FileUtil;
6465
import org.jabref.model.database.BibDatabaseContext;
6566
import org.jabref.model.entry.BibEntry;
6667
import org.jabref.model.entry.BibEntryTypesManager;
@@ -537,7 +538,10 @@ private void handleOnDragDropped(TableRow<BibEntryTableViewModel> row, BibEntryT
537538
boolean success = false;
538539

539540
if (event.getDragboard().hasFiles()) {
540-
List<Path> files = event.getDragboard().getFiles().stream().map(File::toPath).collect(Collectors.toList());
541+
List<Path> files = event.getDragboard().getFiles().stream()
542+
.map(File::toPath)
543+
.map(FileUtil::resolveIfShortcut)
544+
.collect(Collectors.toList());
541545

542546
// Depending on the pressed modifier, move/copy/link files to drop target
543547
// Modifiers do not work on macOS: https://bugs.openjdk.org/browse/JDK-8264172
@@ -568,7 +572,10 @@ private void handleOnDragDroppedTableView(DragEvent event) {
568572
boolean success = false;
569573

570574
if (event.getDragboard().hasFiles()) {
571-
List<Path> files = event.getDragboard().getFiles().stream().map(File::toPath).toList();
575+
List<Path> files = event.getDragboard().getFiles().stream()
576+
.map(File::toPath)
577+
.map(FileUtil::resolveIfShortcut)
578+
.toList();
572579
importHandler
573580
.importFilesInBackground(files, event.getTransferMode())
574581
.executeWith(taskExecutor);

jabkit/src/main/java/org/jabref/toolkit/commands/Convert.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import javax.xml.parsers.ParserConfigurationException;
99
import javax.xml.transform.TransformerException;
1010

11+
import org.jabref.logic.cleanup.FieldFormatterCleanupMapper;
1112
import org.jabref.logic.exporter.Exporter;
1213
import org.jabref.logic.exporter.ExporterFactory;
1314
import org.jabref.logic.exporter.SaveException;
@@ -50,6 +51,9 @@ class Convert implements Runnable {
5051
@Option(names = {"--output-format"}, description = "Output format")
5152
private String outputFormat = "bibtex";
5253

54+
@Option(names = {"--field-formatters"}, description = "Field Formatter")
55+
private String fieldFormatters;
56+
5357
@Override
5458
public void run() {
5559
Optional<ParserResult> parserResult = JabKit.importFile(inputFile, inputFormat, jabKit.cliPreferences, sharedOptions.porcelain);
@@ -63,6 +67,8 @@ public void run() {
6367
return;
6468
}
6569

70+
FieldFormatterCleanupMapper.applyFormatters(fieldFormatters, parserResult.get().getDatabase().getEntries());
71+
6672
if (!sharedOptions.porcelain) {
6773
System.out.println(Localization.lang("Converting '%0' to '%1'.", inputFile, outputFormat));
6874
}

0 commit comments

Comments
 (0)