From e4b9eff248fc8d4ec57cc398f36236544323eb1c Mon Sep 17 00:00:00 2001 From: chiao26168 <72399061+chiao26168@users.noreply.github.com> Date: Tue, 23 May 2023 06:46:20 -0700 Subject: [PATCH 1/6] Add editor test pattern in BracketedPatternTest --- .../BracketedPatternTest.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java b/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java index 2ca9ded5ff8..f931d54e47b 100644 --- a/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java +++ b/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java @@ -660,4 +660,29 @@ void expandBracketsWithoutProtectiveBracesUsingUnprotectTermsModifier() { .withField(StandardField.JOURNAL, "{ACS} Medicinal Chemistry Letters"); assertEquals("ACS Medicinal Chemistry Letters", BracketedPattern.expandBrackets("[JOURNAL:unprotect_terms]", null, bibEntry, null)); } + + + @ParameterizedTest + @CsvSource({ + "'Newton', '[edtr]', 'Isaac Newton'", + "'I', '[edtrForeIni]', 'Isaac Newton'", + "'Newton', '[editors]', 'Isaac Newton'", + "'Ne', '[edtrIni2]', 'Isaac Newton'", + "'New', '[edtr3]', 'Isaac Newton'", + "'Newton', '[edtr7]', 'Isaac Newton'", + "'New', '[edtr3_1]', 'Isaac Newton'", + "'Newton.Maxwell', '[edtr.edtr.ea]', 'Isaac Newton and James Maxwell'", + "'Newton', '[edtrshort]', 'Isaac Newton'", + "'Newton', '[editorLast]', 'Isaac Newton'", + "'I', '[editorLastForeIni]', 'Isaac Newton'", + + "'Agency', '[editors]', 'European Union Aviation Safety Agency'", + "'EUASA', '[editors]', '{European Union Aviation Safety Agency}'" + }) + void testEditorFieldMarkers(String expectedCitationKey, String pattern, String editor) { + BibEntry bibEntry = new BibEntry().withField(StandardField.EDITOR, editor); + BracketedPattern bracketedPattern = new BracketedPattern(pattern); + assertEquals(expectedCitationKey, bracketedPattern.expand(bibEntry)); + } + } From 7c4940f81e7db09182f485f557d115326f7410a0 Mon Sep 17 00:00:00 2001 From: chiao26168 <72399061+chiao26168@users.noreply.github.com> Date: Tue, 23 May 2023 07:42:53 -0700 Subject: [PATCH 2/6] Fix [edtrN_M] pattern in BracketedPattern --- .../org/jabref/logic/citationkeypattern/BracketedPattern.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java b/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java index 13fda45cedf..1763695fb0d 100644 --- a/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java +++ b/src/main/java/org/jabref/logic/citationkeypattern/BracketedPattern.java @@ -421,7 +421,7 @@ public static String getFieldValue(BibEntry entry, String pattern, Character key String[] nums = pattern.substring(4).split("_"); return authNofMth(editorList, Integer.parseInt(nums[0]), - Integer.parseInt(nums[1]) - 1); + Integer.parseInt(nums[1])); } else if (pattern.matches("edtr\\d+")) { String fa = firstAuthor(editorList); int num = Integer.parseInt(pattern.substring(4)); From 056c6c92cb5543cfce29be997b990abcd73a303d Mon Sep 17 00:00:00 2001 From: chiao26168 <72399061+chiao26168@users.noreply.github.com> Date: Mon, 29 May 2023 17:11:25 -0700 Subject: [PATCH 3/6] Fix error from checkstyle --- .../jabref/logic/citationkeypattern/BracketedPatternTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java b/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java index f931d54e47b..6d51facece7 100644 --- a/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java +++ b/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java @@ -661,7 +661,6 @@ void expandBracketsWithoutProtectiveBracesUsingUnprotectTermsModifier() { assertEquals("ACS Medicinal Chemistry Letters", BracketedPattern.expandBrackets("[JOURNAL:unprotect_terms]", null, bibEntry, null)); } - @ParameterizedTest @CsvSource({ "'Newton', '[edtr]', 'Isaac Newton'", @@ -679,10 +678,10 @@ void expandBracketsWithoutProtectiveBracesUsingUnprotectTermsModifier() { "'Agency', '[editors]', 'European Union Aviation Safety Agency'", "'EUASA', '[editors]', '{European Union Aviation Safety Agency}'" }) + void testEditorFieldMarkers(String expectedCitationKey, String pattern, String editor) { BibEntry bibEntry = new BibEntry().withField(StandardField.EDITOR, editor); BracketedPattern bracketedPattern = new BracketedPattern(pattern); assertEquals(expectedCitationKey, bracketedPattern.expand(bibEntry)); } - } From dabdfa307f52780d18a17375e0d0e9afeeb6201e Mon Sep 17 00:00:00 2001 From: Christoph Date: Wed, 31 May 2023 21:06:14 +0200 Subject: [PATCH 4/6] Update src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java --- .../jabref/logic/citationkeypattern/BracketedPatternTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java b/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java index 6d51facece7..6959dde3ce0 100644 --- a/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java +++ b/src/test/java/org/jabref/logic/citationkeypattern/BracketedPatternTest.java @@ -675,7 +675,6 @@ void expandBracketsWithoutProtectiveBracesUsingUnprotectTermsModifier() { "'Newton', '[editorLast]', 'Isaac Newton'", "'I', '[editorLastForeIni]', 'Isaac Newton'", - "'Agency', '[editors]', 'European Union Aviation Safety Agency'", "'EUASA', '[editors]', '{European Union Aviation Safety Agency}'" }) From aa58136ec15ba2ffe043db955818a787b3fb1779 Mon Sep 17 00:00:00 2001 From: chiao26168 <72399061+chiao26168@users.noreply.github.com> Date: Thu, 1 Jun 2023 12:41:22 -0700 Subject: [PATCH 5/6] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f984267e2ba..f2a53ae53ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -93,6 +93,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue where no preview could be generated for some entry types and led to an exception [#9947](https://github.com/JabRef/jabref/issues/9947) - We fixed an issue where the Linux terminal working directory argument was malformed and therefore ignored upon opening a terminal [#9953](https://github.com/JabRef/jabref/issues/9953) - We fixed an issue where an Automatic Keyword Group could not be deleted in the UI. [#9778](https://github.com/JabRef/jabref/issues/9778) +- We fixed an issue where the citation key pattern `[edtrN_M]` was not handled properly. [#9946](https://github.com/JabRef/jabref/pull/9946) ### Removed From 1efb54ab2bb56b77bc4b6cfc70c27207bb7bf818 Mon Sep 17 00:00:00 2001 From: Christoph Date: Fri, 2 Jun 2023 15:35:03 +0200 Subject: [PATCH 6/6] Update CHANGELOG.md Co-authored-by: Jonatan Asketorp --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2a53ae53ed..22bc0a1d1ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -93,7 +93,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue where no preview could be generated for some entry types and led to an exception [#9947](https://github.com/JabRef/jabref/issues/9947) - We fixed an issue where the Linux terminal working directory argument was malformed and therefore ignored upon opening a terminal [#9953](https://github.com/JabRef/jabref/issues/9953) - We fixed an issue where an Automatic Keyword Group could not be deleted in the UI. [#9778](https://github.com/JabRef/jabref/issues/9778) -- We fixed an issue where the citation key pattern `[edtrN_M]` was not handled properly. [#9946](https://github.com/JabRef/jabref/pull/9946) +- We fixed an issue where the citation key pattern `[edtrN_M]` returned the wrong editor. [#9946](https://github.com/JabRef/jabref/pull/9946) ### Removed