-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Functionality to modify CSL bibliography title and format #12784
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
Conversation
src/main/java/org/jabref/gui/openoffice/StyleSelectDialogView.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/gui/openoffice/ModifyBibliographyTitleDialog.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/gui/openoffice/ModifyBibliographyTitleDialog.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/openoffice/OpenOfficePreferences.java
Outdated
Show resolved
Hide resolved
Recording.2025-03-20.mp4Works fine! |
src/main/java/org/jabref/logic/openoffice/OpenOfficePreferences.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/openoffice/OpenOfficePreferences.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/openoffice/OpenOfficePreferences.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/openoffice/OpenOfficePreferences.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java
Outdated
Show resolved
Hide resolved
@@ -176,7 +178,7 @@ public void insertBibliography(XTextCursor cursor, CitationStyle selectedStyle, | |||
throws WrappedTargetException, CreationException { | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
This is not clear to me. How do I get them from preferences.
src/main/java/org/jabref/logic/openoffice/OpenOfficePreferences.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/gui/openoffice/ModifyBibliographyTitleDialogViewModel.java
Outdated
Show resolved
Hide resolved
I see most changes addressed. I am a bit busy, will give more feedback once I find some time this week. |
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.
Few more changes.
src/main/java/org/jabref/gui/openoffice/ModifyCSLBibliographyTitleDialogViewModel.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/openoffice/OpenOfficePreferences.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/openoffice/OpenOfficePreferences.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/openoffice/oocsltext/CSLFormatUtils.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/openoffice/oocsltext/Format.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/openoffice/OpenOfficePreferences.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/gui/openoffice/ModifyCSLBibliographyTitleDialogViewModel.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jabref/logic/openoffice/oocsltext/CSLFormatUtils.java
Outdated
Show resolved
Hide resolved
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 |
@priyanshu16095 currently actionable items (as I see) would be the fxml button and localization of strings. I will probably handle the design part later on. Please request me or Ruslan for a review once done (and tested). |
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.
Tested, can get this in.
My PRs caused this breakage, will fix. |
@@ -94,6 +95,7 @@ private void initializeCitationAdapter(XTextDocument doc) throws WrappedTargetEx | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
Closes #12663
This PR adds the functionality to modfy CSL bibliography title and format.
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if change is visible to the user)