fix:Libre office reference extension after adding spaces.#13592
Conversation
|
Please provide an appropriate name and description to your PR, even if draft. |
|
Hey, let me know if you need any help continuing this. |
|
Hey I got preferences but i am not able to understand flow how do change the Boolean value from settings @subhramit |
See how the first setting in the screenshot in the issue is set (automatically sync bibliography) for example. That's also a boolean, right? |
|
hey @subhramit just check wether I am in right direction or not? |
| CheckMenuItem autoSync = new CheckMenuItem(Localization.lang("Automatically sync bibliography when inserting citations")); | ||
| autoSync.selectedProperty().set(openOfficePreferences.getSyncWhenCiting()); | ||
|
|
||
| CheckMenuItem smartSpace = new CheckMenuItem(Localization.lang("Add smart space after citation")); |
There was a problem hiding this comment.
The space we add before citations are called "smart" because they are aware of if a space already exists.
For the space after, we are just adding it if an option is manually enabled, so change this to 'add space after citations"
| private final StringProperty cslBibliographyHeaderFormat; | ||
| private final StringProperty cslBibliographyBodyFormat; | ||
| private final ObservableList<String> externalCslStyles; | ||
| private final BooleanProperty smartSpaceAfter; |
There was a problem hiding this comment.
Have to rename all these variables and methods due to above explanation.
| public static final String OO_CSL_BIBLIOGRAPHY_HEADER_FORMAT = "cslBibliographyHeaderFormat"; | ||
| public static final String OO_CSL_BIBLIOGRAPHY_BODY_FORMAT = "cslBibliographyBodyFormat"; | ||
|
|
||
| public static final String OO_SMART_SPACE_AFTER = "ooSmartSpaceAfter"; |
subhramit
left a comment
There was a problem hiding this comment.
Hi, i have left some initial comments. Your direction of playing around with preferences and properties is correct, but somehow the changes to CSLCitationooadapter seem to be lost. So you have to use this property in the functions there from preferences henceforth.
|
I tried to make changes around |
Unfortunately, that's not the right way. I get your thought process, but you had to use preferences, not PS - if this explanation is unclear, please do ask for more clarification. The reason I'm not giving you the solution right away is so that you learn something when navigating the codebase as well. |
|
now can you check @subhramit ? |
subhramit
left a comment
There was a problem hiding this comment.
Few comments on correctness.
After you are done with these, add a changelog entry, move the PR away from draft, mark the mandatory checks, write a description and post a short screen recording of the changes.
|
|
||
| private CitationStyle currentStyle; | ||
| private boolean styleChanged; | ||
| private boolean addSpaceAfter; |
|
|
||
| OOStyle initialStyle = openOfficePreferences.getCurrentStyle(); // may be a jstyle, can still be used for detecting subsequent style changes in context of CSL | ||
|
|
||
| this.addSpaceAfter = openOfficePreferences.getAddSpaceAfter(); |
| } | ||
|
|
||
| markManager.insertReferenceIntoOO(entries, document, cursor, ooText, !preceedingSpaceExists, false); | ||
| markManager.insertReferenceIntoOO(entries, document, cursor, ooText, !preceedingSpaceExists, addSpaceAfter); |
There was a problem hiding this comment.
Use this
| markManager.insertReferenceIntoOO(entries, document, cursor, ooText, !preceedingSpaceExists, addSpaceAfter); | |
| markManager.insertReferenceIntoOO(entries, document, cursor, ooText, !preceedingSpaceExists, openOfficePreferences.getAddSpaceAfter()); |
Reason: The setting may have changed after the instantiation of the adapter.
| CheckMenuItem autoSync = new CheckMenuItem(Localization.lang("Automatically sync bibliography when inserting citations")); | ||
| autoSync.selectedProperty().set(openOfficePreferences.getSyncWhenCiting()); | ||
|
|
||
| CheckMenuItem addSpaceAfter = new CheckMenuItem(Localization.lang("Add space after citation")); |
There was a problem hiding this comment.
| CheckMenuItem addSpaceAfter = new CheckMenuItem(Localization.lang("Add space after citation")); | |
| CheckMenuItem addSpaceAfter = new CheckMenuItem(Localization.lang("Add space after citation")); |
There was a problem hiding this comment.
Also, add the keys to the localization JabRef_en.properties file (see the failing check).
… to localization.
|
|
||
| Automatically\ add\ "Cited\ on\ pages..."\ at\ the\ end\ of\ bibliographic\ entries=Automatically add "Cited on pages..." at the end of bibliographic entries | ||
| Automatically\ sync\ bibliography\ when\ inserting\ citations=Automatically sync bibliography when inserting citations | ||
| "Add\ space\ after\ citation"=Add space after citation |
There was a problem hiding this comment.
Why the extra space above and here? You can click commit suggestion in https://github.com/JabRef/jabref/pull/13592/files#r2253606699 and below:
| "Add\ space\ after\ citation"=Add space after citation | |
| "Add\ space\ after\ citation"=Add space after citation |
|
|
||
| Automatically\ add\ "Cited\ on\ pages..."\ at\ the\ end\ of\ bibliographic\ entries=Automatically add "Cited on pages..." at the end of bibliographic entries | ||
| Automatically\ sync\ bibliography\ when\ inserting\ citations=Automatically sync bibliography when inserting citations | ||
| "Add\ space\ after\ citation"=Add space after citation |
There was a problem hiding this comment.
Please look at 1. Other example entries. And/or 2. Failing checks by clicking on them to get hints as to which tests are failing. The bot comments already instruct on this.
In this case, you have to remove the quotes. There should be no quotes, unless they are a part of the string itself.
| "Add\ space\ after\ citation"=Add space after citation | |
| Add\ space\ after\ citation=Add space after citation |
|
@subhramit can you check screen recording? |
Yep, that's correct. I tried out myself, works properly. Mow please add a changelog entry and mark the pr non-draft (ready for review). |
subhramit
left a comment
There was a problem hiding this comment.
I refined the changelog entry a bit, rest lgtm
|
@trag-bot didn't find any issues in the code! ✅✨ |
|
Thank you @subhramit for guiding me. |
Closes #13559
I have added
Add space after citationin settings of open office panel.screen recording of it is as follows.
Screen.Recording.2025-08-06.at.11.18.19.AM.mp4
so now by selecting checkbox we get space after citation.
Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if change is visible to the user)