-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Added a custom Export for academicpages.github.io #14463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Hey @GreLucie!Thank you for contributing to JabRef! Your help is truly appreciated ❤️ We have automated checks in place, based on which you will soon get feedback if any of them are failing. In a while, maintainers 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. Please re-check our contribution guide in case of any other doubts related to our contribution workflow. |
| } | ||
| try { | ||
| Integer iterator = 1; | ||
| for (BibEntry entry : entries) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could simply switch this to a normal for loop with for (int i =1; i< entiries.length; i++) so you don't need the iterator variable.
|
|
||
| String content = Files.readString(expectedFile); | ||
|
|
||
| // Verify YAML front matter fields |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the pattern of other tests in that directory, do a full comparison. of the content
CHANGELOG.md
Outdated
| ### Removed | ||
|
|
||
| ## [6.0-alpha.3] – 2025-10-30 | ||
| ## [6.0-alpha.3] – 2025-11-29 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this change
…uits avec le format exigé de academic pages
…r-issue-12727 # Conflicts: # jablib/src/main/java/org/jabref/logic/exporter/AcademicPagesExporter.java
| import org.jabref.model.entry.BibEntry; | ||
| import org.jabref.model.metadata.SelfContainedSaveOrder; | ||
|
|
||
| import org.jetbrains.annotations.NotNull; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use jspecify nonnull
| ### Removed | ||
|
|
||
| ## [6.0-alpha.3] – 2025-11-29 | ||
| ## [6.0-alpha.3] – 2025-10-30 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this some automatic tool that always changes the date?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, you told me to revert this change so I went back to the unmodified CHANGELOG for now. I know we have to change it eventually but while this PR is just a draft we decided to change it once all the issues have been fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can change it at any time - the earlier the better :) -- BUT - do NOT CHANGE RELEASE DATES
Add your change to the "Unreleased" section.
Note: Current diff shows CHANGELOG.md unmodified: https://github.com/JabRef/jabref/pull/14463/files (which is OK at this stage).
|
Hi, we just wanted to clarify the mechanism that we chose to implement for this new AcademicPagesExporter so that we can have your opinion on it and know whether or not it meets your expectations : |
|
Yep that sound reasonable. Go ahead |
|
@sadok-lajmi Please merge |
| /** | ||
| * Initialize another export format based on templates stored in dir with layoutFile lfFilename. | ||
| * | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment is strange. What is lfFilename? Where does it come from? I think, this is not something a user of the class should know. You can just delete whole JavaDoc comment.
|
|
||
| private static final Logger LOGGER = LoggerFactory.getLogger(AcademicPagesExporter.class); | ||
|
|
||
| private final String lfFileName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not abbreviate. Use layoutFileFileName or short layoutFile (because you don't have layoutFileContent.
| */ | ||
| @Override | ||
| public void export(@NonNull final BibDatabaseContext databaseContext, | ||
| final Path file, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure that Path may be null?
Annoate all or nothing.
Proposal: Add @NullMarked to the class and mark only things which might be null - I think, there aren't any
| Files.createDirectories(exportDirectory); | ||
|
|
||
| for (BibEntry entry : entries) { | ||
| if (entry.getType() == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, what? When can this happen?
| List<BibEntry> individual_entry = new ArrayList<>(); | ||
| individual_entry.add(entry); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, what? Use List.of(entry) directly as parameter in the next line.
| } | ||
|
|
||
| private static @NonNull Path getPath(BibEntry entry, Path exportDirectory) { | ||
| Replace replace_formatter = new Replace(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why underscores in varable names? In Java, it is camel case.
|
|
||
| private static @NonNull Path getPath(BibEntry entry, Path exportDirectory) { | ||
| Replace replace_formatter = new Replace(); | ||
| replace_formatter.setArgument(" ,-"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thsi is a magic constant - please add a comment why this strange argument.
| Replace replace_formatter = new Replace(); | ||
| replace_formatter.setArgument(" ,-"); | ||
| RemoveLatexCommandsFormatter commands_formatter = new RemoveLatexCommandsFormatter(); | ||
| HTMLChars html_formatter = new HTMLChars(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add all formatters as class variable
| HTMLChars html_formatter = new HTMLChars(); | ||
| String title = entry.getTitle().get(); | ||
| String formatted_title = commands_formatter.format(html_formatter.format(replace_formatter.format(title))); | ||
| SafeFileName safe_formatter = new SafeFileName(); // added custom formatter to remove all characters that are not allowed in filenames |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? It is obvious - then remove the comment.
| Optional<Month> month = Month.parse(fieldText); | ||
| return month.map(Month::getTwoDigitNumber).orElse("01"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge this into one line plese.
…porter.java Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
|
JUnit tests of You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide. |
Closes #12727
This PR is to add a custom exporter for academicpages.github.io by adding the corresponding layouts.
It also implements a way to export multiple files to this format.
Steps to test
When jabref is running, go to file->Export->Export selected entries ( or all entries) and choose "Academic Pages Markdowns" for the export type.
You can then add the markdown file(s) to your academic page to see it on your own page.

More information about academic pages on the page : https://academicpages.github.io/
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)