Functionality to modify CSL bibliography title and format#12784
Conversation
Recording.2025-03-20.mp4Works fine! |
| boolean isNumericStyle = selectedStyle.isNumericStyle(); | ||
|
|
||
| OOText title = OOFormat.paragraph(OOText.fromString(CSLFormatUtils.DEFAULT_BIBLIOGRAPHY_TITLE), CSLFormatUtils.DEFAULT_BIBLIOGRAPHY_HEADER_PARAGRAPH_FORMAT); | ||
| OOText title = OOFormat.paragraph(OOText.fromString(openOfficePreferences.getBibliographyTitle().get()), openOfficePreferences.getHeaderFormat().get()); |
There was a problem hiding this comment.
Instead of fetching the properties via preferences here (which would cause introduction of preferences), once you move the format definitions to CSLFormatUtils, get them from preferences there itself, then use them here (static access).
There was a problem hiding this comment.
@priyanshu16095 Why is this marked resolved even though I still see raw preferences being imported and used here?
I don't mind repeating review comments for first-time contributors, but please understand that right now you are expected to act with a sense of ownership. It takes patience to repeat review comments, more so to check, find and "unresolve" old comments when it seems something has been asked for before. I think I have also repeated to you thrice now - do not resolve comments before they are completely addressed.
There was a problem hiding this comment.
This is not clear to me. How do I get them from preferences.
|
I see most changes addressed. I am a bit busy, will give more feedback once I find some time this week. |
|
Please request a review once you have addressed all the comments above. |
|
Answering #12784 (comment) here: What you have to do is, get the preferences in OOFormat.paragraph(OOText.fromString(CSLFormatUtils.getBibliographyTitle(), CSLFormatUtils.getBibliographyHeaderFormat());Let me know if this is clear. |
Even better way: public class CSLFormatUtils {
public static String BIBLIOGRAPHY_TITLE;
public static String BIBLIOGRAPHY_HEADER_FORMAT;
public CSLFormatUtils(OpenOfficePreferences openOfficePreferences) {
BIBLIOGRAPHY_TITLE = openOfficePreferences.cslBibliographyTitle().get();
BIBLIOGRAPHY_HEADER_FORMAT = openOfficePreferences.cslBibliographyTitle().get();
}
...No need of extra functions, and can directly use I am adding some more review comments to get rid of |
|
My PRs caused this breakage, will fix. |
| OOStyle initialStyle = openOfficePreferences.getCurrentStyle(); // may be a jstyle, can still be used for detecting subsequent style changes in context of CSL | ||
| cslCitationOOAdapter = new CSLCitationOOAdapter(doc, databasesSupplier, initialStyle); | ||
| cslUpdateBibliography = new CSLUpdateBibliography(); | ||
| CSLFormatUtils.setBibliographyProperties(openOfficePreferences); |
There was a problem hiding this comment.
The addition of this line in the initializeCitationAdapter method changes the method's behavior, but the JavaDoc for the method has not been updated to reflect this change, violating instruction 1.
|
@Siedlerchr can you test this once? I think it would be mergeable now. |
|
@trag-bot didn't find any issues in the code! ✅✨ |
|
Since Ruslan did the second review and I tested it, I am letting this in. |
* Functionality to modify title and header format * Add CHANGELOG.md entry, rename Formats to Format and address the reviews * Fix typo in CHANGELOG.md entry * Rename variables * Rename variable, remove two methods, fix check * Rename variables and fix the check * Rename classes * Some minor changes * Renamed variables * Rename variable * Remove hardcoded value from constructor * Rename variable * Use CSLFormatUtils for title and format * Remove preference from constructor * Update JabRefCliPreferences.java Co-authored-by: Subhramit Basu <subhramit.bb@live.in> * Update JabRefCliPreferences.java Co-authored-by: Subhramit Basu <subhramit.bb@live.in> * Update ModifyCSLBibliographyTitleDialogViewModel.java Co-authored-by: Subhramit Basu <subhramit.bb@live.in> * Update ModifyCSLBibliographyTitleDialogViewModel.java Co-authored-by: Subhramit Basu <subhramit.bb@live.in> * Remove static import * Remove DEFAULT from variable names * Use getters * Remove unused methods * Elaborate changelog entry * Shorten changelog entry * Restore methods * Reduce use of `get()`, better naming for methods * Use correct function * Rename controller to view as per MVVM * More renaming * Consistent naming in `CliPreferences` * Fix functionality * Tragbot comment - resolve architectural violation * Variable naming convention and Tragbot comment - resolve encapsulation * Fix preferences * Remove Heading from Format * Update CHANGELOG.md Co-authored-by: Ruslan <ruslanpopov1512@gmail.com> * Use localized strings * Fix preferences initialization pipeline --------- Co-authored-by: Subhramit Basu <subhramit.bb@live.in> Co-authored-by: Ruslan <ruslanpopov1512@gmail.com>
* Functionality to modify title and header format * Add CHANGELOG.md entry, rename Formats to Format and address the reviews * Fix typo in CHANGELOG.md entry * Rename variables * Rename variable, remove two methods, fix check * Rename variables and fix the check * Rename classes * Some minor changes * Renamed variables * Rename variable * Remove hardcoded value from constructor * Rename variable * Use CSLFormatUtils for title and format * Remove preference from constructor * Update JabRefCliPreferences.java Co-authored-by: Subhramit Basu <subhramit.bb@live.in> * Update JabRefCliPreferences.java Co-authored-by: Subhramit Basu <subhramit.bb@live.in> * Update ModifyCSLBibliographyTitleDialogViewModel.java Co-authored-by: Subhramit Basu <subhramit.bb@live.in> * Update ModifyCSLBibliographyTitleDialogViewModel.java Co-authored-by: Subhramit Basu <subhramit.bb@live.in> * Remove static import * Remove DEFAULT from variable names * Use getters * Remove unused methods * Elaborate changelog entry * Shorten changelog entry * Restore methods * Reduce use of `get()`, better naming for methods * Use correct function * Rename controller to view as per MVVM * More renaming * Consistent naming in `CliPreferences` * Fix functionality * Tragbot comment - resolve architectural violation * Variable naming convention and Tragbot comment - resolve encapsulation * Fix preferences * Remove Heading from Format * Update CHANGELOG.md Co-authored-by: Ruslan <ruslanpopov1512@gmail.com> * Use localized strings * Fix preferences initialization pipeline --------- Co-authored-by: Subhramit Basu <subhramit.bb@live.in> Co-authored-by: Ruslan <ruslanpopov1512@gmail.com>
Signed-off-by: subhramit <subhramit.bb@live.in>
| cslBibliographyTitle.bindBidirectional(openOfficePreferences.cslBibliographyTitleProperty()); | ||
| cslBibliographySelectedHeaderFormat.bindBidirectional(openOfficePreferences.cslBibliographyHeaderFormatProperty()); |
There was a problem hiding this comment.
These direct bindings here are too sensitive - will capture and save updates regardless of whether a "save/ok" button is pressed, will be changing them in an upcoming PR.
* Introduce bibliography body formats (fix code from #13050) Co-authored-by: DTT12912 <derictonythomas@gmail.com> Co-authored-by: subhramit <subhramit.bb@live.in> Signed-off-by: subhramit <subhramit.bb@live.in> * Get hanging indent working Signed-off-by: subhramit <subhramit.bb@live.in> * Remove redundant AI comment Signed-off-by: subhramit <subhramit.bb@live.in> * Fix JabRef formatting infra Signed-off-by: subhramit <subhramit.bb@live.in> * Remove redundant comment Signed-off-by: subhramit <subhramit.bb@live.in> * Temp commit Signed-off-by: subhramit <subhramit.bb@live.in> * Revert "Temp commit" This reverts commit 1174ca0. * Remove unused constant Signed-off-by: subhramit <subhramit.bb@live.in> * Rename adapter, remove redundant comment Signed-off-by: subhramit <subhramit.bb@live.in> * Remove commented code Signed-off-by: subhramit <subhramit.bb@live.in> * Swap order of conditions Signed-off-by: subhramit <subhramit.bb@live.in> * wip Signed-off-by: subhramit <subhramit.bb@live.in> * wip Signed-off-by: subhramit <subhramit.bb@live.in> * Selective override of preferences Signed-off-by: subhramit <subhramit.bb@live.in> * Use list instead of enum Signed-off-by: subhramit <subhramit.bb@live.in> * Rename variables Signed-off-by: subhramit <subhramit.bb@live.in> * Rename with lambda Signed-off-by: subhramit <subhramit.bb@live.in> * Add setters Signed-off-by: subhramit <subhramit.bb@live.in> * Fix bindings introduced in #12784 Signed-off-by: subhramit <subhramit.bb@live.in> * Simplify button logic Signed-off-by: subhramit <subhramit.bb@live.in> * Shift to OO Panel, complete pref behavior Signed-off-by: subhramit <subhramit.bb@live.in> * Add more style options Signed-off-by: subhramit <subhramit.bb@live.in> * Replace unused variables Signed-off-by: subhramit <subhramit.bb@live.in> * Rename variables Signed-off-by: subhramit <subhramit.bb@live.in> * Remove default indent Signed-off-by: subhramit <subhramit.bb@live.in> * Remove unused import Signed-off-by: subhramit <subhramit.bb@live.in> * Add comment Signed-off-by: subhramit <subhramit.bb@live.in> * Add property button disable condition Signed-off-by: subhramit <subhramit.bb@live.in> * Localization keys Signed-off-by: subhramit <subhramit.bb@live.in> * Fix tests, add changelog entries Signed-off-by: subhramit <subhramit.bb@live.in> * Add links to changelog entries Signed-off-by: subhramit <subhramit.bb@live.in> * Refine comment Signed-off-by: subhramit <subhramit.bb@live.in> * Add note Signed-off-by: subhramit <subhramit.bb@live.in> --------- Signed-off-by: subhramit <subhramit.bb@live.in> Co-authored-by: DTT12912 <derictonythomas@gmail.com>
Closes #12663
This PR adds the functionality to modfy CSL bibliography title and format.
Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if change is visible to the user)