Skip to content

Commit 68923ad

Browse files
authored
[OO] Allow slashes in citation keys for reference marks (#12961)
* Allow slashes Signed-off-by: subhramit <[email protected]> * Add changelog entry Signed-off-by: subhramit <[email protected]> * Add test Signed-off-by: subhramit <[email protected]> * Remove escape of hyphen Signed-off-by: subhramit <[email protected]> * Remove extra newline Signed-off-by: subhramit <[email protected]> --------- Signed-off-by: subhramit <[email protected]>
1 parent b2070b3 commit 68923ad

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
9292
- We fixed an issue where BibTeX Strings were not included in the backup file [#12462](https://github.com/JabRef/jabref/issues/12462)
9393
- We fixed an issue where mixing JStyle and CSL style citations in LibreOffice caused two separate bibliography sections to be generated. [#12262](https://github.com/JabRef/jabref/issues/12262)
9494
- We fixed an issue in the LibreOffice integration where the formatting of text (e.g. superscript) was lost when using certain numeric CSL styles. [melting-pot#772](https://github.com/JabRef/jabref-issue-melting-pot/issues/772)
95-
- We fixed an issue where CSL style citations with citation keys having special characters (such as hyphens or colons) would not be recognized as valid by JabRef. [forum#5431](https://discourse.jabref.org/t/error-when-connecting-to-libreoffice/5431)
95+
- We fixed an issue where CSL style citations with citation keys having special characters (such as hyphens, colons or slashes) would not be recognized as valid by JabRef. [forum#5431](https://discourse.jabref.org/t/error-when-connecting-to-libreoffice/5431)
9696
- We fixed an issue where the `[authorsAlpha]` pattern in Citation key generator would not behave as per the user documentation. [#12312](https://github.com/JabRef/jabref/issues/12312)
9797
- We fixed an issue where import at "Search for unlinked local files" would re-add already imported files. [#12274](https://github.com/JabRef/jabref/issues/12274)
9898
- We fixed an issue where month values 21–24 (ISO 8601-2019 season codes) in Biblatex date fields were not recognized as seasons during parsing. [#12437](https://github.com/JabRef/jabref/issues/12437)

src/main/java/org/jabref/logic/openoffice/ReferenceMark.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public class ReferenceMark {
1515

1616
private static final Logger LOGGER = LoggerFactory.getLogger(ReferenceMark.class);
1717

18-
private static final Pattern REFERENCE_MARK_FORMAT = Pattern.compile("^(JABREF_[\\w-:.]+ CID_\\d+(?:, JABREF_[\\w-:.]+ CID_\\d+)*) (\\w+)$");
19-
private static final Pattern ENTRY_PATTERN = Pattern.compile("JABREF_([\\w-:.]+) CID_(\\d+)");
18+
private static final Pattern REFERENCE_MARK_FORMAT = Pattern.compile("^(JABREF_[\\w-:./]+ CID_\\d+(?:, JABREF_[\\w-:./]+ CID_\\d+)*) (\\w+)$");
19+
private static final Pattern ENTRY_PATTERN = Pattern.compile("JABREF_([\\w-:./]+) CID_(\\d+)");
2020

2121
private final String name;
2222
private List<String> citationKeys;

src/test/java/org/jabref/logic/openoffice/ReferenceMarkTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ private static Stream<Arguments> validParsing() {
4949
Arguments.of(
5050
"JABREF_willberg-forssman:1997b CID_5 yov3b0su",
5151
List.of("willberg-forssman:1997b"), List.of(5), "yov3b0su"
52+
),
53+
Arguments.of(
54+
"JABREF_PGF/TikZTeam2023 CID_8 kyu75a4s",
55+
List.of("PGF/TikZTeam2023"), List.of(8), "kyu75a4s"
5256
)
5357
);
5458
}

0 commit comments

Comments
 (0)