Rework LibreOffice CSL Style Inference flow
We implemented compatibility with Zotero and add a preference "Infer CSL style from document". But this preference causes many issues when doing interoperability work with Zotero users.
Goals of rework:
- [ ] Decouple from Zotero flow - Allow "infer style" for JabRef-only flows as well
- [ ] Decouple trigger from "other" LO functions like connect, cite etc - Remove "Infer CSL style from document" from preference. Instead, add it as a dedicated button
- [ ] Show notifications of detected style used in the document
Hints:
- Button shouldn't be greyed out in jabref mode
- Reuse the code for the button "cite"
Refs https://github.com/JabRef/jabref/pull/16461 https://github.com/JabRef/jabref/pull/16358
/assign-me
Thank you for your continued work in JabRef. At this point, you probably already know the basics and the important links. If not, our contributing guidelines is the place you should go to.
At this point in time, you raised 1 pull request(s) of which 0% (0/1) have been merged.
Hi @pluto-han @subhramit , I’d be interested in working on this issue. I noticed that @fulluhere is currently assigned to it. If they’re no longer working on it or the assignment is available again, I’d be happy to take it up. Please let me know. Thanks!
Hey @hello-ryuzaki , you'll get a notification in case they abandon the issue. We usually have a limit for time and a bar for quality, so if either isn't met, issues are freed up again.
⏰ Assignment Reminder
Hi @fulluhere, this is a friendly reminder about your assignment to this issue.
[!WARNING] This issue will be automatically unassigned in 4 days if there's no activity.
Remember that you can ask the JabRef Guru or DeepWiki about anything regarding JabRef. Additionally, our contributing guide has hints on creating a pull request and a link to our Gitter chat.
How to keep your assignment
If you are working on it, you can prevent automatic unassignment by:
- Submitting a draft pull request with your progress within 4 days
- Asking for the 📌 Pinned label if you need more time
We appreciate your contribution and are here to help if needed!
@fulluhere are you still working on this? Please unassign yourself if you are not.
@subhramit there is no any activity can you assign this to me
This requires familiarity with multiple software (Zotero, LibreOffice) and context of our LibreOffice integration. This issue will be hard for you unless you already have context and reproduced the current state of the features. I would ask you to go for something else, someone from the internal team may take this up.
This requires familiarity with multiple software (Zotero, LibreOffice) and context of our LibreOffice integration. This issue will be hard for you unless you already have context and reproduced the current state of the features. I would ask you to go for something else, someone from the internal team may take this up.
Still i want to give it a try, will learn all required things just give refrence of some things that i should know or i should look at
Do something, since your earlier contributions were not exactly clean and at times we had to repeat information that was already present, try the inference flow out and tell me in your own words what you understand about what needs to be done, and then code snippet wise what your approach will be. If you understand it correctly, we can move forward.
We don't have time to guide these days, because a release is due. We expect contributors to help us, not take our time away. Except for a little bit of leeway for first time contributors/good first issues in that regard.
Do something, since your earlier contributions were not exactly clean and at times we had to repeat information that was already present, try the inference flow out and tell me in your own words what you understand about what needs to be done, and then code snippet wise what your approach will be. If you understand it correctly, we can move forward.
We don't have time to guide these days, because a release is due. We expect contributors to help us, not take our time away. Except for a little bit of leeway for first time contributors/good first issues in that regard.
Okay understood and repeataton of things won't happen again
So this is what i understood is
private static Optional<String> readSerializedData(XTextDocument document)
throws WrappedTargetException {
Optional<String> serializedData = readChunkedProperty(document, ZOTERO_PREF);
if (serializedData.isEmpty()) {
serializedData = readChunkedProperty(document, CSL_PREF);
}
return serializedData;
}
so readSerializedData tries both ZOTERO_PREF and CSL_PREF in which ZOTERO_PREF is zotero specifc so when it is absent in meta.xml file it falls back to CSL_PREF that is for jabref only correct me if i am wrong and for meta.xml jabref never parses it itslef but through libreoffice over its api XTextDocumet reading and writing user-defined document properties on the open document object and LibreOffice itself later serializes those properties into meta.xml so it means since when ZOTERO_PREF not present it goes to CSL_PRED half way decoupling is done as findCitationStyle is getting style id from XTextDocument document and checks it over the availableStyles for i guess i have to do the same i have to do the same
One thing that i uncerstood is weiteCitationStylke is also writes ZOTERO_PREF
private static Optional<String> readSerializedData(XTextDocument document)
throws WrappedTargetException {
Optional<String> serializedData = readChunkedProperty(document, ZOTERO_PREF);
if (serializedData.isEmpty()) {
serializedData = readChunkedProperty(document, CSL_PREF);
}
return serializedData;
}
so readSerializedData is done for both ZOTERO_PREF and CSL_PREF but when it writes it never writes CSL_PREF so even if readSerializedData reads a non zotero document that is jabref writeCitationStyle writes ZOTERO_PREF there only so whatever i understood in zotero mode when inference calls findCitationStyle so it sees ZOTERO_PREF and it works this is what i understood so far i have not thoght anything about my approach yet codewise what i will do that i will tell you
it falls back to CSL_PREF that is for jabref only
CSL_PREF is the old name for ZOTERO_PREF. I add it just in case users use old version of Zotero.
Please also clone Zotero's repo and look into it. You can also follow the steps in the video in https://github.com/JabRef/jabref/pull/16358 and the gifs in https://github.com/JabRef/jabref/wiki/GSoC-2026-%E2%80%90-Improved-LibreOffice%E2%80%90JabRef-integration
it falls back to CSL_PREF that is for jabref only
CSL_PREFis the old name forZOTERO_PREF. I add it just in case users use old version of Zotero.Please also clone Zotero's repo and look into it. You can also follow the steps in the video in #16358 and the gifs in https://github.com/JabRef/jabref/wiki/GSoC-2026-%E2%80%90-Improved-LibreOffice%E2%80%90JabRef-integration
Okay understood thanks for clearifying
/assign @thesauravpoddar
Thanks for guiding @pluto-han
Thank you for your continued work in JabRef. At this point, you probably already know the basics and the important links. If not, our contributing guidelines is the place you should go to.
At this point in time, you raised 4 pull request(s) of which 100% (4/4) have been merged.
So this is what i understood is
private static Optional
readSerializedData(XTextDocument document) throws WrappedTargetException { Optional serializedData = readChunkedProperty(document, ZOTERO_PREF); if (serializedData.isEmpty()) { serializedData = readChunkedProperty(document, CSL_PREF); } return serializedData; } so readSerializedDatatries bothZOTERO_PREFandCSL_PREFin whichZOTERO_PREFis zotero specifc so when it is absent in meta.xml file it falls back toCSL_PREFthat is for jabref only correct me if i am wrong and for meta.xml jabref never parses it itslef but through libreoffice over its apiXTextDocumetreading and writinguser-defined document propertieson the open document object and LibreOffice itself later serializes those properties into meta.xml so it means since when ZOTERO_PREF not present it goes to CSL_PRED half way decoupling is done asfindCitationStyleis getting style id from XTextDocument document and checks it over the availableStyles for i guess i have to do the same i have to do the same One thing that i uncerstood isweiteCitationStylkeis also writesZOTERO_PREFprivate static Optional<String> readSerializedData(XTextDocument document) throws WrappedTargetException { Optional<String> serializedData = readChunkedProperty(document, ZOTERO_PREF); if (serializedData.isEmpty()) { serializedData = readChunkedProperty(document, CSL_PREF); } return serializedData; }so
readSerializedDatais done for both ZOTERO_PREF and CSL_PREF but when it writes it never writes CSL_PREF so even ifreadSerializedDatareads a non zotero document that is jabref writeCitationStyle writes ZOTERO_PREF there only so whatever i understood in zotero mode when inference callsfindCitationStyleso it sees ZOTERO_PREF and it works this is what i understood so far i have not thoght anything about my approach yet codewise what i will do that i will tell you
- Currently style is written to meta.xml only for Zotero mode
- We want to make it independent of the Zotero mode, it should always write
- Reading already happens for Zotero mode (if infer is enabled). We want to allow that mode for reading it and setting the style in JabRef mode as well.
- UI: The button is greyed out in JabRef mode. It should always be available to opt in after this.
try the inference flow out and tell me in your own words what you understand about what needs to be done
I don't think you tried this - did you?
and then code snippet wise what your approach will be. If you understand it correctly, we can move forward.
Seems like you directly started looking at the code. I mentioned "and then". There was a reason behind that order, to build understanding. Reading code first before understanding the feature doesn't really make one understand anything. I don't understand why you find it hard to follow instructions. Please try out, and ask whatever you feel you are a bit unclear about.
So this is what i understood is private static Optional readSerializedData(XTextDocument document) throws WrappedTargetException { Optional serializedData = readChunkedProperty(document, ZOTERO_PREF); if (serializedData.isEmpty()) { serializedData = readChunkedProperty(document, CSL_PREF); } return serializedData; } so
readSerializedDatatries bothZOTERO_PREFandCSL_PREFin whichZOTERO_PREFis zotero specifc so when it is absent in meta.xml file it falls back toCSL_PREFthat is for jabref only correct me if i am wrong and for meta.xml jabref never parses it itslef but through libreoffice over its apiXTextDocumetreading and writinguser-defined document propertieson the open document object and LibreOffice itself later serializes those properties into meta.xml so it means since when ZOTERO_PREF not present it goes to CSL_PRED half way decoupling is done asfindCitationStyleis getting style id from XTextDocument document and checks it over the availableStyles for i guess i have to do the same i have to do the same One thing that i uncerstood isweiteCitationStylkeis also writesZOTERO_PREFprivate static Optional<String> readSerializedData(XTextDocument document) throws WrappedTargetException { Optional<String> serializedData = readChunkedProperty(document, ZOTERO_PREF); if (serializedData.isEmpty()) { serializedData = readChunkedProperty(document, CSL_PREF); } return serializedData; }so
readSerializedDatais done for both ZOTERO_PREF and CSL_PREF but when it writes it never writes CSL_PREF so even ifreadSerializedDatareads a non zotero document that is jabref writeCitationStyle writes ZOTERO_PREF there only so whatever i understood in zotero mode when inference callsfindCitationStyleso it sees ZOTERO_PREF and it works this is what i understood so far i have not thoght anything about my approach yet codewise what i will do that i will tell you
- Currently style is written to meta.xml only for Zotero mode
- We want to make it independent of the Zotero mode, it should always write
- Reading already happens for Zotero mode (if infer is enabled). We want to allow that mode for reading it and setting the style in JabRef mode as well.
- UI: The button is greyed out in JabRef mode. It should always be available to opt in after this.
sorry for my poor explanationa and vague wordings wanted to explain the same thing