Add generic CSV export filter#15838
Conversation
Adds a new CSV export filter that exports all standard BibTeX fields as-is, with a header row. Fixes JabRef#15711
|
Hey @joaohmalves! 👋 Thank you for contributing to JabRef! We have automated checks in place, based on which you will soon get feedback if any of them are failing. We also use Qodo for review assistance. It will update your pull request description with a review help and offer suggestions to improve the pull request. After all automated checks pass, a maintainer will also review your contribution. Once that happens, you can go through their comments in the "Files changed" tab and act on them, or reply to the conversation if you have further inputs. You can read about the whole pull request process in our contribution guide. Please ensure that your pull request is in line with our AI Usage Policy and make necessary disclosures. |
Review Summary by QodoAdd generic CSV export filter for BibTeX entries
WalkthroughsDescription• Adds generic CSV export filter for standard BibTeX fields • Registers new "CSV" exporter in ExporterFactory • Includes layout files with header row and field formatting • Adds comprehensive unit tests for export functionality Diagramflowchart LR
A["ExporterFactory"] -->|registers| B["CSV Exporter"]
B -->|uses| C["csv.begin.layout"]
B -->|uses| D["csv.layout"]
E["GenericCsvExportFormatTest"] -->|tests| B
B -->|exports to| F["CSV File with Headers"]
File Changes1. jablib/src/main/java/org/jabref/logic/exporter/ExporterFactory.java
|
Code Review by Qodo
1.
|
- Apply OpenRewrite suggestions - Add missing fields Chapter and Annote to header - Apply ReplaceWithEscapedDoubleQuotes to all fields - Add execution lock annotations to test class - Add citation key assertion and quote escaping tests
| assertTrue(header.contains("Citation Key")); | ||
| assertTrue(header.contains("Author")); | ||
| assertTrue(header.contains("Title")); | ||
| assertTrue(header.contains("Year")); | ||
| assertTrue(header.contains("Journal")); | ||
| assertTrue(header.contains("DOI")); | ||
| assertTrue(header.contains("Abstract")); | ||
| assertTrue(header.contains("Chapter")); | ||
| assertTrue(header.contains("Annote")); |
There was a problem hiding this comment.
If you read other tests in the same folder, you will find they never make a wall of assertTrue
AI loves using it
There was a problem hiding this comment.
Yeah sorry just checked that, will be fixing it
| assertTrue(lines.get(1).contains("Doe2023")); | ||
| assertTrue(lines.get(1).contains("Doe, John")); | ||
| assertEquals( | ||
| "\"Citation Key\",\"Author\",\"Title\",\"Year\",\"Journal\",\"Booktitle\",\"Publisher\",\"Volume\",\"Number\",\"Pages\",\"Month\",\"Edition\",\"Address\",\"Editor\",\"Series\",\"Note\",\"HowPublished\",\"Organization\",\"Institution\",\"School\",\"Chapter\",\"Annote\",\"DOI\",\"URL\",\"Keywords\",\"Abstract\",\"ISBN\",\"ISSN\"", |
There was a problem hiding this comment.
Better use three quotation marks, so you can use textblocks and do not escape the quotes https://www.baeldung.com/java-text-blocks
Adds a new CSV export filter that exports all standard BibTeX fields as-is, with a header row.
Related issues and pull requests
Closes #15711
PR Description
Fixes #15711
Adds a new generic CSV export filter based on the OpenOffice CSV layout.
The filter exports all standard BibTeX fields as-is with a header row,
making it suitable for use in spreadsheet applications like Excel or
LibreOffice Calc. The exporter is registered in ExporterFactory and
includes layout files and tests.
Steps to test
AI usage
Checklist
CHANGELOG.mdin a way that can be understood by the average user (if change is visible to the user)