Skip to content
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

Custom export format biblatex date field to bibtex year, month and day ones. #6579

Closed
webanck opened this issue Jun 3, 2020 · 6 comments · Fixed by #7039
Closed

Custom export format biblatex date field to bibtex year, month and day ones. #6579

webanck opened this issue Jun 3, 2020 · 6 comments · Fixed by #7039

Comments

@webanck
Copy link

webanck commented Jun 3, 2020

Hello, I see date processing is still in the pipes ! (See issues #1249 and #6224)

Almost two years ago (see here), I asked for a way to write a custom export with dates from the biblatex date field to bibtex year, month and day fields with an emphasis on the month field (I am not the first one, see here).
I tried using the DateFormatter but an error is still raised when the date field doesn't resolve as a full ISO date (YYYY-MM-DD), and even if it worked, it would only output the month number, and not the bibtex equivalent.

Any clue on how to solve this ?

@webanck
Copy link
Author

webanck commented Jun 3, 2020

Well, in fact, it is very easy to solve now as all fields seem well treated as valid aliases now.

The custom export filter as

\begin{year}  year = \year\end{year}\begin{month},
  month = \month\end{month}\begin{day},
  day = \day\end{day}

will now output entries as

  year = 2018,
  month = May,

@webanck webanck closed this as completed Jun 3, 2020
@webanck
Copy link
Author

webanck commented Jun 3, 2020

Well, in fact, it only works for the month of May because it is already a 3 characters long string, but for January for instance, the full month name will be output, instead of Jan.
So my initial problem is still not solved :(
There is no formatter documented to output the month in the same format as the bibtex field !
Even the undocumented RisMonth format makes the assumption of a short name for the month.

@webanck webanck reopened this Jun 3, 2020
@Siedlerchr
Copy link
Member

Siedlerchr commented Jun 3, 2020

Have you seen the DateFormatter? https://docs.jabref.org/collaborative-work/export/customexports#built-in-export-formatters

edit// I saw that it requires valid iso date.

@webanck
Copy link
Author

webanck commented Jun 3, 2020

Yeah, I tried but it doesn't work, as you saw (I added an explicit mention about it in the first message of this issue).

@Siedlerchr
Copy link
Member

Siedlerchr commented Jun 3, 2020

I currently see no existing solution, so you would need to write your own Formatter which can format Months.
/Edit: That should not be that difficult as we already have a Month class which is able to do some month parsing and probably formatting as well.

@joethei joethei mentioned this issue Oct 25, 2020
5 tasks
Siedlerchr added a commit that referenced this issue Oct 29, 2020
* add short date formatter. fixes #6579

* Update src/main/java/org/jabref/logic/layout/format/ShortMonthFormatter.java

Co-authored-by: Christoph <siedlerkiller@gmail.com>

* remove setArgument

* fixing imports

Co-authored-by: Christoph <siedlerkiller@gmail.com>
@Siedlerchr
Copy link
Member

Thanks to @joethei there's now a new Short Month Formatter

We would like to ask you to use a development build from https://builds.jabref.org/master and report back if it works for you. Please remember to make a backup of your library before trying-out this version.
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants