Skip to content

Commit

Permalink
Merge pull request #10 from JabRef/main
Browse files Browse the repository at this point in the history
update2021.4.5
  • Loading branch information
XDZhelheim authored Apr 5, 2021
2 parents 9ecdf53 + 69e6f0c commit ac7a2ce
Show file tree
Hide file tree
Showing 10 changed files with 215 additions and 39 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ JabRef version <!-- version as shown in the about box --> on <!-- Windows 10|Ubu
<!--
Please always test if the bug is still reproducible in the latest development version.
We are constantly improving JabRef and some bugs may already be fixed.
You can download the development version at: http://builds.jabref.org/master/
You can download the development version at: http://builds.jabref.org/main
Please make a backup of your library before you try out this version.
If you already use a development version, ensure that you use the latest one.
-->
- [ ] **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

<!-- Add a clear and concise description of what the bug is. -->

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}"
8 changes: 6 additions & 2 deletions .github/workflows/refresh-csl-subtrees.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -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)
158 changes: 158 additions & 0 deletions buildres/csl/csl-styles/archives-of-hand-and-microsurgery.csl
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" default-locale="en-GB">
<info>
<title>Archives of Hand and Microsurgery</title>
<title-short>AHM</title-short>
<id>http://www.zotero.org/styles/archives-of-hand-and-microsurgery</id>
<link href="http://www.zotero.org/styles/archives-of-hand-and-microsurgery" rel="self"/>
<link href="http://www.zotero.org/styles/the-pan-african-medical-journal" rel="template"/>
<link href="https://submit.handmicro.org/about/Author.php" rel="documentation"/>
<author>
<name>Patrick O'Brien</name>
</author>
<category citation-format="numeric"/>
<category field="medicine"/>
<issn>2586-3290</issn>
<eissn>2586-3533</eissn>
<updated>2021-03-30T14:44:29+00:00</updated>
<rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
</info>
<macro name="author">
<names variable="author" suffix=". ">
<name delimiter-precedes-et-al="always" delimiter-precedes-last="always" initialize-with="" name-as-sort-order="all" sort-separator=" "/>
<label form="short" prefix=" (" suffix=")"/>
<substitute>
<names variable="editor"/>
</substitute>
</names>
</macro>
<macro name="editor">
<names variable="editor">
<name sort-separator=" " initialize-with="" name-as-sort-order="all" delimiter=", " delimiter-precedes-last="always" delimiter-precedes-et-al="never"/>
<label prefix=", "/>
</names>
</macro>
<macro name="publisher">
<group delimiter=": ">
<text variable="publisher-place"/>
<text variable="publisher"/>
</group>
</macro>
<macro name="access">
<choose>
<if variable="page" match="none">
<choose>
<if type="article-journal">
<choose>
<if match="none" variable="page volume">
<text variable="DOI" prefix="https://doi.org/"/>
</if>
</choose>
</if>
<else-if type="webpage post post-weblog">
<group delimiter=". ">
<text variable="URL"/>
<group delimiter=" ">
<text term="accessed" text-case="capitalize-first"/>
<date variable="accessed">
<date-part name="day" prefix=" "/>
<date-part name="month" strip-periods="true" prefix=" "/>
<date-part name="year" prefix=" "/>
</date>
</group>
</group>
</else-if>
</choose>
</if>
</choose>
</macro>
<macro name="journal-title">
<choose>
<if type="article-journal article-magazine" match="any">
<text variable="container-title" form="short" strip-periods="true" suffix="."/>
</if>
<else>
<text variable="container-title" suffix=". "/>
</else>
</choose>
</macro>
<macro name="title">
<choose>
<if type="book thesis" match="any">
<text variable="title" font-style="italic"/>
</if>
<else>
<text variable="title"/>
</else>
</choose>
</macro>
<macro name="edition">
<choose>
<if is-numeric="edition">
<group delimiter=" ">
<number variable="edition" form="ordinal"/>
<text term="edition" form="short"/>
</group>
</if>
<else>
<text variable="edition" suffix="."/>
</else>
</choose>
</macro>
<citation collapse="citation-number">
<sort>
<key variable="citation-number"/>
</sort>
<layout vertical-align="baseline" delimiter="," prefix="[" suffix="]">
<text variable="citation-number"/>
</layout>
</citation>
<bibliography et-al-min="7" et-al-use-first="6" second-field-align="flush">
<layout suffix=".">
<text variable="citation-number" suffix="."/>
<text macro="author"/>
<text macro="title" suffix=". "/>
<choose>
<if type="bill book graphic legal_case legislation motion_picture report song" match="any">
<group delimiter=" " prefix=" ">
<text macro="edition"/>
<text macro="publisher"/>
</group>
</if>
<else-if type="chapter paper-conference" match="any">
<group delimiter=". " prefix=" ">
<group>
<text term="in" suffix=": " text-case="capitalize-first"/>
<text macro="editor"/>
</group>
<text variable="container-title" font-style="italic"/>
<date variable="issued">
<date-part name="year"/>
</date>
<text macro="publisher"/>
<group delimiter=" ">
<label plural="never" variable="page" form="short"/>
<text variable="page"/>
</group>
</group>
</else-if>
<else>
<text macro="journal-title"/>
<group delimiter=";" suffix=".">
<date variable="issued" prefix=" ">
<date-part name="year"/>
</date>
<group delimiter=":">
<group>
<text variable="volume"/>
<text variable="issue" prefix="(" suffix=")"/>
</group>
<text variable="page"/>
</group>
</group>
</else>
</choose>
<text macro="access" prefix=" "/>
</layout>
</bibliography>
</style>
11 changes: 10 additions & 1 deletion buildres/csl/csl-styles/canadian-biosystems-engineering.csl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<issn>1492-9058</issn>
<eissn>1492-9066</eissn>
<summary>Style for online journal Canadian Biosystems Engineering</summary>
<updated>2020-09-26T15:27:23+00:00</updated>
<updated>2020-12-05T19:18:31+00:00</updated>
<rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
</info>
<locale xml:lang="en-US">
Expand Down Expand Up @@ -275,6 +275,15 @@
<else-if type="webpage chapter paper-conference article-journal article-magazine article-newspaper" match="any">
<text variable="title"/>
</else-if>
<else-if type="patent">
<group delimiter=". ">
<text variable="title"/>
<group delimiter=", ">
<text variable="authority"/>
<text variable="number"/>
</group>
</group>
</else-if>
<else-if type="motion_picture broadcast" match="any"/>
<else>
<choose>
Expand Down
6 changes: 1 addition & 5 deletions buildres/csl/csl-styles/journal-of-accounting-research.csl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
<name>Xuanheng Huang</name>
<email>huangxuanheng@gmail.com</email>
</contributor>
<contributor>
<name>Vito Ferrulli</name>
<email>vitof970@gmail.com</email>
</contributor>
<category citation-format="author-date"/>
<category field="generic-base"/>
<issn>0021-8456</issn>
Expand Down Expand Up @@ -161,7 +157,7 @@
<if type="legal_case" match="none">
<choose>
<if variable="DOI">
<text variable="DOI" prefix="Available at https://doi.org/"/>
<text variable="DOI" prefix="https://doi.org/"/>
</if>
<else>
<text variable="URL" prefix="Available at "/>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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("");
}

/**
Expand All @@ -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("");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit ac7a2ce

Please sign in to comment.