diff --git a/CHANGELOG.md b/CHANGELOG.md index 992f0055839..ffaa0b80b05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We fixed an issue where the added protected term has unwanted leading and trailing whitespaces, where the formatted text has unwanted empty brackets and where the word at the cursor in the textbox can be added to the list. [#10415](https://github.com/JabRef/jabref/issues/10415) - We fixed an issue where in the merge dialog the file field of entries was not correctly merged when the first and second entry both contained values inside the file field. [#10572](https://github.com/JabRef/jabref/issues/10572) - We fixed some small inconsistencies in the user interface. [#10507](https://github.com/JabRef/jabref/issues/10507) [#10458](https://github.com/JabRef/jabref/issues/10458) +- We fixed the issue where the Hayagriva YAML exporter would not include a parent field for the publisher/series. [#10596](https://github.com/JabRef/jabref/issues/10596) ### Removed diff --git a/src/main/resources/resource/layout/hayagrivayaml.layout b/src/main/resources/resource/layout/hayagrivayaml.layout index cd19524d406..b60553bec16 100644 --- a/src/main/resources/resource/layout/hayagrivayaml.layout +++ b/src/main/resources/resource/layout/hayagrivayaml.layout @@ -6,11 +6,24 @@ - \format[Authors(LastFirst, MiddleInitial, Sep =\n - , LastSep =\n - )]{\author} \end{author} \begin{date} date: \date\end{date} +\begin{journal} + parent: + type: periodical + title: \journal +\end{journal} + \begin{journal&&volume}volume: \volume\end{journal&&volume} + \begin{journal&&number}issue: \number\end{journal&&number} + \begin{journal&&publisher}publisher: \publisher\end{journal&&publisher} +\begin{series} + parent: + type: book + title: "\series" +\end{series} +\begin{editor&&number} issue: \number\end{editor&&number} +\begin{editor&&publisher} publisher: \publisher\end{editor&&publisher} \begin{editor} editor: \editor\end{editor} -\begin{publisher} publisher: \publisher\end{publisher} \begin{address} location: \address\end{address} \begin{institution} organization: \institution\end{institution} -\begin{volume} volume: \volume\end{volume} \begin{edition} edition: \edition\end{edition} \begin{pages} page-range: \pages\end{pages} \begin{url} url: \url\end{url} diff --git a/src/test/java/org/jabref/logic/exporter/HayagrivaYamlExporterTest.java b/src/test/java/org/jabref/logic/exporter/HayagrivaYamlExporterTest.java index 7a058ec059d..0b6356906e9 100644 --- a/src/test/java/org/jabref/logic/exporter/HayagrivaYamlExporterTest.java +++ b/src/test/java/org/jabref/logic/exporter/HayagrivaYamlExporterTest.java @@ -183,4 +183,35 @@ void passesModifiedCharsetNull(@TempDir Path tempFile) throws Exception { "---"); assertEquals(expected, Files.readAllLines(file)); } + + @Test + public final void exportsCorrectParentField(@TempDir Path tempFile) throws Exception { + BibEntry entry = new BibEntry(StandardEntryType.Article) + .withCitationKey("test") + .withField(StandardField.AUTHOR, "Test Author") + .withField(StandardField.TITLE, "Test Title") + .withField(StandardField.JOURNAL, "Test Publisher") + .withField(StandardField.URL, "http://example.com") + .withField(StandardField.DATE, "2020-10-14"); + + Path file = tempFile.resolve("RandomFileName"); + Files.createFile(file); + hayagrivaYamlExporter.export(databaseContext, file, Collections.singletonList(entry)); + + List expected = List.of( + "---", + "test:", + " type: article", + " title: \"Test Title\"", + " author:", + " - Author, Test", + " date: 2020-10-14", + " parent:", + " type: periodical", + " title: Test Publisher", + " url: http://example.com", + "---"); + + assertEquals(expected, Files.readAllLines(file)); + } }