Skip to content

Commit

Permalink
Merge branch 'JabRef:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
priyanshu16095 authored Jan 16, 2025
2 parents 507d51e + 64e625f commit dea0ed9
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 22 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13]
matrix: # if you change the os version rename all other occurrences
os: [ubuntu-22.04, windows-latest, macos-13]
include:
- os: ubuntu-latest
- os: ubuntu-22.04
displayName: linux
archivePortable: tar -c -C build/distribution JabRef | pigz --rsyncable > build/distribution/JabRef-portable_linux.tar.gz && rm -R build/distribution/JabRef
- os: windows-latest
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
submodules: 'true'
show-progress: 'false'
- name: Install pigz and cache (linux)
if: (matrix.os == 'ubuntu-latest')
if: (matrix.os == 'ubuntu-22.04')
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: pigz
Expand Down Expand Up @@ -212,7 +212,7 @@ jobs:
get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "${{ steps.gitversion.outputs.AssemblySemVer }}","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}"}
get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "portable","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}-portable"}
- name: Repack deb file for Debian
if: (matrix.os == 'ubuntu-latest') && (steps.checksecrets.outputs.secretspresent == 'YES')
if: (matrix.os == 'ubuntu-22.04') && (steps.checksecrets.outputs.secretspresent == 'YES')
shell: bash
run: |
cd build/distribution
Expand Down Expand Up @@ -247,7 +247,7 @@ jobs:
# macOS: Negated condition of "Upload to GitHub workflow artifacts store (macOS)"
# Reason: We either upload the non-notarized files - or notarize the files later (and upload these later)
# needs to be on one line; multi line does not work
if: ${{ (!startsWith(github.ref, 'refs/heads/gh-readonly-queue')) && (steps.checksecrets.outputs.secretspresent == 'YES') && ((matrix.os == 'ubuntu-latest') || ((matrix.os == 'macos-13') && !((startsWith(github.ref, 'refs/tags/') || inputs.notarization == true)))) }}
if: ${{ (!startsWith(github.ref, 'refs/heads/gh-readonly-queue')) && (steps.checksecrets.outputs.secretspresent == 'YES') && ((matrix.os == 'ubuntu-22.04') || ((matrix.os == 'macos-13') && !((startsWith(github.ref, 'refs/tags/') || inputs.notarization == true)))) }}
shell: bash
run: |
rsync -rt --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r --itemize-changes --stats --rsync-path="mkdir -p /var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }} && rsync" -e 'ssh -p 9922 -i sshkey -o StrictHostKeyChecking=no' build/distribution/ [email protected]:/var/www/builds.jabref.org/www/${{ steps.gitversion.outputs.branchName }}/ || true
Expand All @@ -268,7 +268,7 @@ jobs:
compression-level: 0 # no compression
announce:
name: Comment on pull request
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: [build]
if: ${{ github.event_name == 'pull_request' }}
steps:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
### Fixed

- We fixed an issue where a bib file with UFF-8 charset was wrongly loaded with a different charset [forum#5369](https://discourse.jabref.org/t/jabref-5-15-opens-bib-files-with-shift-jis-encoding-instead-of-utf-8/5369/)
- We fixed an issue where new entries were inserted in the middle of the table instead of at the end. [#12371](https://github.com/JabRef/jabref/pull/12371)
- We fixed an issue where removing the sort from the table did not restore the original order. [#12371](https://github.com/JabRef/jabref/pull/12371)

### Removed

Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ plugins {

id 'idea'

id 'org.openrewrite.rewrite' version '6.29.3'
id 'org.openrewrite.rewrite' version '7.0.0'

id "org.itsallcode.openfasttrace" version "3.0.1"
}
Expand Down Expand Up @@ -308,7 +308,7 @@ dependencies {
// API
implementation 'jakarta.ws.rs:jakarta.ws.rs-api:4.0.0'
// Implementation of the API
implementation 'org.glassfish.jersey.core:jersey-server:3.1.9'
implementation 'org.glassfish.jersey.core:jersey-server:3.1.10'
// injection framework
implementation 'org.glassfish.jersey.inject:jersey-hk2:3.1.9'
implementation 'org.glassfish.hk2:hk2-api:3.1.1'
Expand All @@ -317,8 +317,8 @@ dependencies {
// testImplementation 'org.glassfish.hk2:hk2-junitrunner:3.0.4'
// HTTP server
// implementation 'org.glassfish.jersey.containers:jersey-container-netty-http:3.1.1'
implementation 'org.glassfish.jersey.containers:jersey-container-grizzly2-http:3.1.9'
testImplementation 'org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-grizzly2:3.1.9'
implementation 'org.glassfish.jersey.containers:jersey-container-grizzly2-http:3.1.10'
testImplementation 'org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-grizzly2:3.1.10'
// Allow objects "magically" to be mapped to JSON using GSON
// implementation 'org.glassfish.jersey.media:jersey-media-json-gson:3.1.1'

Expand Down Expand Up @@ -401,7 +401,7 @@ dependencies {
xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '3.0.2'
xjc group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '3.0.2'

rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.23.2"))
rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:3.0.1"))
rewrite("org.openrewrite.recipe:rewrite-static-analysis")
rewrite("org.openrewrite.recipe:rewrite-logging-frameworks")
rewrite("org.openrewrite.recipe:rewrite-testing-frameworks")
Expand Down
2 changes: 1 addition & 1 deletion buildres/abbrv.jabref.org
Submodule abbrv.jabref.org updated 1 files
+4 −1 CHANGELOG.md
23 changes: 22 additions & 1 deletion src/main/java/org/jabref/gui/maintable/MainTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,28 @@ public MainTable(MainTableDataModel model,
this.setItems(model.getEntriesFilteredAndSorted());

// Enable sorting
model.getEntriesFilteredAndSorted().comparatorProperty().bind(this.comparatorProperty());
// Workaround for a JavaFX bug: https://bugs.openjdk.org/browse/JDK-8301761 (The sorting of the SortedList can become invalid)
// The default comparator of the SortedList does not consider the insertion index of entries that are equal according to the comparator.
// When two entries are equal based on the comparator, the entry that was inserted first should be considered smaller.
this.setSortPolicy(_ -> true);
model.getEntriesFilteredAndSorted().comparatorProperty().bind(
this.comparatorProperty().map(comparator -> {
if (comparator == null) {
return null;
}

return (entry1, entry2) -> {
int result = comparator.compare(entry1, entry2);
if (result != 0) {
return result;
}
// If the entries are equal according to the comparator, compare them by their index in the database.
// The comparison should ideally be based on the database index, but retrieving the index takes log(n). See {@link BibDatabase#indexOf}.
// Using the entry ID is also valid since IDs are monotonically increasing.
return entry1.getEntry().getId().compareTo(entry2.getEntry().getId());
};
})
);

// Store visual state
new PersistenceVisualStateTable(this, mainTablePreferences.getColumnPreferences()).addListeners();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,16 +252,24 @@ private boolean isFarAway(TextPosition previous, TextPosition current) {
return Math.abs(Xgap) > XspaceThreshold && Math.abs(Ygap) > YspaceThreshold;
}

private boolean isUnwantedText(TextPosition previousTextPosition, TextPosition textPosition) {
private boolean isUnwantedText(TextPosition previousTextPosition, TextPosition textPosition,
Map<Float, TextPosition> lastPositionMap, float fontSize) {
// This indicates that the text is at the start of the line, so it is needed.
if (textPosition == null || previousTextPosition == null) {
return false;
}
// We use the font size to identify titles. Blank characters don't have a font size, so we discard them.
// The space will be added back in the final result, but not in this method.
if (StringUtil.isBlank(textPosition.getUnicode())) {
return true;
}
// The title usually don't in the bottom 10% of a page.
return (textPosition.getPageHeight() - textPosition.getYDirAdj())
< (textPosition.getPageHeight() * 0.1);
// Titles are generally not located in the bottom 10% of a page.
if ((textPosition.getPageHeight() - textPosition.getYDirAdj()) < (textPosition.getPageHeight() * 0.1)) {
return true;
}
// Characters in a title typically remain close together,
// so a distant character is unlikely to be part of the title.
return lastPositionMap.containsKey(fontSize) && isFarAway(lastPositionMap.get(fontSize), textPosition);
}

private Optional<String> findLargestFontText(List<TextPosition> textPositions) {
Expand All @@ -271,8 +279,7 @@ private Optional<String> findLargestFontText(List<TextPosition> textPositions) {
for (TextPosition textPosition : textPositions) {
float fontSize = textPosition.getFontSizeInPt();
// Exclude unwanted text based on heuristics
if (isUnwantedText(previousTextPosition, textPosition) ||
(lastPositionMap.containsKey(fontSize) && isFarAway(lastPositionMap.get(fontSize), textPosition))) {
if (isUnwantedText(previousTextPosition, textPosition, lastPositionMap, fontSize)) {
continue;
}
fontSizeTextMap.putIfAbsent(fontSize, new StringBuilder());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,16 @@ public SqlQueryNode visitComparison(SearchParser.ComparisonContext ctx) {
setFlags(searchFlags, REGULAR_EXPRESSION, true, true);
}

// field = "" -> should find entries where the field is empty
// field != "" -> should find entries where the field is not empty
if (term.isEmpty()) {
if (searchFlags.contains(NEGATION)) {
searchFlags.remove(NEGATION);
} else {
searchFlags.add(NEGATION);
}
}

return getFieldQueryNode(field.toLowerCase(Locale.ROOT), term, searchFlags);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/csl-locales
2 changes: 1 addition & 1 deletion src/main/resources/csl-styles
Submodule csl-styles updated 1 files
+20 −9 leviathan.csl
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,38 @@ cte0 AS (
)
)
SELECT * FROM cte0 GROUP BY entryid"""
),

Arguments.of(
"file = \"\"",
"""
WITH
cte0 AS (
SELECT main_table.entryid
FROM bib_fields."tableName" AS main_table
WHERE main_table.entryid NOT IN (
SELECT inner_table.entryid
FROM bib_fields."tableName" AS inner_table
WHERE (
(inner_table.field_name = 'file') AND ((inner_table.field_value_literal ILIKE ('%%')) OR (inner_table.field_value_transformed ILIKE ('%%')))
)
)
)
SELECT * FROM cte0 GROUP BY entryid"""
),

Arguments.of(
"file != \"\"",
"""
WITH
cte0 AS (
SELECT main_table.entryid
FROM bib_fields."tableName" AS main_table
WHERE (
(main_table.field_name = 'file') AND ((main_table.field_value_literal ILIKE ('%%')) OR (main_table.field_value_transformed ILIKE ('%%')))
)
)
SELECT * FROM cte0 GROUP BY entryid"""
)
);
}
Expand Down

0 comments on commit dea0ed9

Please sign in to comment.