diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 7e4b36dfe2c..9088ea73f88 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -19,11 +19,11 @@ JabRef version on -- [ ] **Mandatory**: I have tested the latest development version from http://builds.jabref.org/master/ and the problem persists +- [ ] **Mandatory**: I have tested the latest development version from http://builds.jabref.org/main and the problem persists diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 32db3646803..9c26cae4c24 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -3,9 +3,9 @@ on: [pull_request] jobs: automerge: - name: Automerge Dependabot + name: Automerge Dependency Updates runs-on: ubuntu-latest - if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]' || github.event.label.name == 'dependencies' + if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]' || contains(github.event.pull_request.labels.*.name, 'dependencies') steps: - name: 'Wait for status checks' id: waitforstatuschecks @@ -24,6 +24,6 @@ jobs: uses: pascalgn/automerge-action@v0.13.1 if: steps.waitforstatuschecks.outputs.status == 'success' env: - MERGE_METHOD: "squash" + MERGE_METHOD: "merge" MERGE_LABELS: "" GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/refresh-csl-subtrees.yml b/.github/workflows/refresh-csl-subtrees.yml index edb8a5db2a2..d7cdf3efbf1 100644 --- a/.github/workflows/refresh-csl-subtrees.yml +++ b/.github/workflows/refresh-csl-subtrees.yml @@ -31,17 +31,21 @@ jobs: cp buildres/csl/csl-styles/acm-siggraph.csl src/main/resources/csl-styles/ cp buildres/csl/csl-styles/ieee.csl src/main/resources/csl-styles/ cp buildres/csl/csl-styles/turabian-author-date.csl src/main/resources/csl-styles/ + git add . + git commit -m"Refresh example styles" || true - name: Add csl-locales remote run: git remote add -f csl-locales https://github.com/citation-style-language/locales.git - name: Update csl-locales run: | git subtree pull --prefix buildres/csl/csl-locales csl-locales master --squash || true - git subtree pull --prefix buildres/csl/csl-locales csl-locales master --squash cp buildres/csl/csl-locales/locales.json src/main/resources/csl-locales/ cp buildres/csl/csl-locales/locales-en-US.xml src/main/resources/csl-locales/ + git add . + git commit -m"Refresh example styles" || true - uses: peter-evans/create-pull-request@v3 with: - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.GH_TOKEN_UPDATE_GRADLE_WRAPPER }} branch: refresh-csl commit-message: Update CSL styles title: "[Bot] Update CSL styles" + labels: dependencies diff --git a/CHANGELOG.md b/CHANGELOG.md index b04b261b171..d3cb116cc81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,6 +74,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue in which a linked online file consisting of a web page was saved as an invalid pdf file upon being downloaded. The user is now notified when downloading a linked file results in an HTML file. [#7452](https://github.com/JabRef/jabref/issues/7452) - We fixed an issue where opening BibTex file (doubleclick) from Folder with spaces not working. [#6487](https://github.com/JabRef/jabref/issues/6487) - We fixed an issue with saving large `.bib` files [#7265](https://github.com/JabRef/jabref/issues/7265) +- We fixed an issue with very large page numbers [#7590](https://github.com/JabRef/jabref/issues/7590) ### Removed diff --git a/MAINTAINERS b/MAINTAINERS index d8cb8727de1..1c8bdbad56b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6,3 +6,4 @@ Christoph Schwentker (since 2016) Linus Dietz (since 2017) Carl Christian Snethlage (since 2020) Dominik Voigt (since 2020) +Jonatan Askertop (since 2021) diff --git a/buildres/csl/csl-styles/archives-of-hand-and-microsurgery.csl b/buildres/csl/csl-styles/archives-of-hand-and-microsurgery.csl new file mode 100644 index 00000000000..f4a15bc9705 --- /dev/null +++ b/buildres/csl/csl-styles/archives-of-hand-and-microsurgery.csl @@ -0,0 +1,158 @@ + + diff --git a/buildres/csl/csl-styles/canadian-biosystems-engineering.csl b/buildres/csl/csl-styles/canadian-biosystems-engineering.csl index 1c13ca3cbb2..0c47d82fab2 100644 --- a/buildres/csl/csl-styles/canadian-biosystems-engineering.csl +++ b/buildres/csl/csl-styles/canadian-biosystems-engineering.csl @@ -16,7 +16,7 @@ 1492-9058 1492-9066 Style for online journal Canadian Biosystems Engineering - 2020-09-26T15:27:23+00:00 + 2020-12-05T19:18:31+00:00 This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License @@ -275,6 +275,15 @@ + + + + + + + + + diff --git a/buildres/csl/csl-styles/journal-of-accounting-research.csl b/buildres/csl/csl-styles/journal-of-accounting-research.csl index 970e9d73aa4..3c625149f43 100644 --- a/buildres/csl/csl-styles/journal-of-accounting-research.csl +++ b/buildres/csl/csl-styles/journal-of-accounting-research.csl @@ -15,10 +15,6 @@ Xuanheng Huang huangxuanheng@gmail.com - - Vito Ferrulli - vitof970@gmail.com - 0021-8456 @@ -161,7 +157,7 @@ - + diff --git a/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java b/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java index 9e0e8d2139f..b0c7323d9a8 100644 --- a/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java +++ b/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java @@ -1,5 +1,6 @@ package org.jabref.logic.citationkeypattern; +import java.math.BigInteger; import java.text.Normalizer; import java.util.ArrayList; import java.util.Arrays; @@ -56,6 +57,10 @@ public class BracketedPattern { */ private static final int MAX_ALPHA_AUTHORS = 4; + /** + * Matches everything that is not a unicode decimal digit. + */ + private static final Pattern NOT_DECIMAL_DIGIT = Pattern.compile("\\P{Nd}"); /** * Matches everything that is not an uppercase ASCII letter. The intended use is to remove all lowercase letters */ @@ -1019,19 +1024,12 @@ public static String firstPage(String pages) { // FIXME: incorrectly exracts the first page when pages are // specified with ellipse, e.g. "213-6", which should stand // for "213-216". S.G. - final String[] splitPages = pages.split("\\D+"); - int result = Integer.MAX_VALUE; - for (String n : splitPages) { - if (n.matches("\\d+")) { - result = Math.min(Integer.parseInt(n), result); - } - } - - if (result == Integer.MAX_VALUE) { - return ""; - } else { - return String.valueOf(result); - } + return NOT_DECIMAL_DIGIT.splitAsStream(pages) + .filter(Predicate.not(String::isBlank)) + .map(BigInteger::new) + .min(BigInteger::compareTo) + .map(BigInteger::toString) + .orElse(""); } /** @@ -1057,19 +1055,12 @@ public static String pagePrefix(String pages) { * @throws NullPointerException if pages is null. */ public static String lastPage(String pages) { - final String[] splitPages = pages.split("\\D+"); - int result = Integer.MIN_VALUE; - for (String n : splitPages) { - if (n.matches("\\d+")) { - result = Math.max(Integer.parseInt(n), result); - } - } - - if (result == Integer.MIN_VALUE) { - return ""; - } else { - return String.valueOf(result); - } + return NOT_DECIMAL_DIGIT.splitAsStream(pages) + .filter(Predicate.not(String::isBlank)) + .map(BigInteger::new) + .max(BigInteger::compareTo) + .map(BigInteger::toString) + .orElse(""); } /** diff --git a/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java b/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java index 16b0ebe59f8..c59dd2251ec 100644 --- a/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java +++ b/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java @@ -325,6 +325,22 @@ void expandBracketsLastNameWithChineseCharacters() { assertEquals("杨秀群", BracketedPattern.expandBrackets("[auth]", null, bibEntry, null)); } + @Test + void expandBracketsUnmodifiedStringFromLongFirstPageNumber() { + BibEntry bibEntry = new BibEntry() + .withField(StandardField.PAGES, "2325967120921344"); + + assertEquals("2325967120921344", BracketedPattern.expandBrackets("[firstpage]", null, bibEntry, null)); + } + + @Test + void expandBracketsUnmodifiedStringFromLongLastPageNumber() { + BibEntry bibEntry = new BibEntry() + .withField(StandardField.PAGES, "2325967120921344"); + + assertEquals("2325967120921344", BracketedPattern.expandBrackets("[lastpage]", null, bibEntry, null)); + } + @Test void expandBracketsWithTestCasesFromRegExpBasedFileFinder() { BibEntry entry = new BibEntry(StandardEntryType.Article).withCitationKey("HipKro03");