-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add setting: always add "Cited on pages" text to JStyles. #11732
Changes from 4 commits
68834e9
7243dda
a5a902b
cda2669
160721d
a4f05b1
3e507b8
09d9647
576eb92
21c7de1
9efdd4b
dd273f7
ee2ebb4
f2c3744
b43835a
7ce9dc8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -618,12 +618,16 @@ private boolean checkThatEntriesHaveKeys(List<BibEntry> entries) { | |
} | ||
|
||
private ContextMenu createSettingsPopup() { | ||
OpenOfficePreferences openOfficePreferences = preferencesService.getOpenOfficePreferences(); | ||
|
||
ContextMenu contextMenu = new ContextMenu(); | ||
|
||
if (currentStyle instanceof JStyle) { | ||
addAlwaysCitedOnPagesTextOption(contextMenu); | ||
} | ||
|
||
OpenOfficePreferences openOfficePreferences = preferencesService.getOpenOfficePreferences(); | ||
|
||
CheckMenuItem autoSync = new CheckMenuItem(Localization.lang("Automatically sync bibliography when inserting citations")); | ||
autoSync.selectedProperty().set(preferencesService.getOpenOfficePreferences().getSyncWhenCiting()); | ||
autoSync.selectedProperty().set(openOfficePreferences.getSyncWhenCiting()); | ||
|
||
ToggleGroup toggleGroup = new ToggleGroup(); | ||
RadioMenuItem useActiveBase = new RadioMenuItem(Localization.lang("Look up BibTeX entries in the active tab only")); | ||
|
@@ -657,4 +661,15 @@ private ContextMenu createSettingsPopup() { | |
|
||
return contextMenu; | ||
} | ||
|
||
private void addAlwaysCitedOnPagesTextOption(ContextMenu contextMenu) { | ||
OpenOfficePreferences openOfficePreferences = preferencesService.getOpenOfficePreferences(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Additional request for refactor (since we're here): If we require Note: Actually, it is slightly bad design that the entire |
||
|
||
CheckMenuItem alwaysAddCitedOnPagesText = new CheckMenuItem(Localization.lang("Automatically add \"Cited on pages...\" at beginning of citation")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Tl;dr - change "citation" -> "bibliographic entries", "beginning of" -> (wherever it shows up) Update: Can't test where it appears before work on the backend is complete. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Edit: Re-read your main review comment. Need to still update There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good job. It definitely should be at the end of the citation. "backref", which is part of the hyperref package offers the "cited on pages" feature for LaTeX documents, so that could serve as an inspiration. I do not remember exactly, but I believe I made some minor adjustments to the default backref settings, so that it always starts in a new line, which I think looks slick :-) Here an example from a paper I wrote in LaTeX that includes backref: |
||
|
||
alwaysAddCitedOnPagesText.selectedProperty().set(openOfficePreferences.getAlwaysAddCitedOnPages()); | ||
alwaysAddCitedOnPagesText.setOnAction(e -> openOfficePreferences.setAlwaysAddCitedOnPages(alwaysAddCitedOnPagesText.isSelected())); | ||
|
||
contextMenu.getItems().add(alwaysAddCitedOnPagesText); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. I'm really embarrassed I forgot about the CSL Styles, will add the removal mechanism and move the item below the "old" option as requested. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Please be comfortable, you are new to the codebase, so that's very normal! |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1132,6 +1132,7 @@ Unable\ to\ reload\ style\ file=Unable to reload style file | |
|
||
Problem\ during\ separating\ cite\ markers=Problem during separating cite markers | ||
|
||
Automatically\ add\ "Cited\ on\ pages..."\ at\ beginning\ of\ citation=Automatically add "Cited on pages..." at beginning of citation | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Text needs to be changed (see comment above for line 668). |
||
Automatically\ sync\ bibliography\ when\ inserting\ citations=Automatically sync bibliography when inserting citations | ||
Look\ up\ BibTeX\ entries\ in\ the\ active\ tab\ only=Look up BibTeX entries in the active tab only | ||
Look\ up\ BibTeX\ entries\ in\ all\ open\ libraries=Look up BibTeX entries in all open libraries | ||
|
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.
Any reason why this was moved? Initializations are usually done at the beginning of the scope.
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.
Personal practice is to initialize as close to first usage as possible to increase refactorability, but if it's project standard to initialize at the beginning, then I will gladly undo.
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.
Yes, there is no general hard-and-fast best practice regarding this. Beginning-of-scope-initialization is preferred when a dependency is used throughout the scope multiple times in logically segregated segments. Near-first-use-initialization is used if the usage is confined, and refactorability is indeed the argument.
I would have requested you to change back, but since moving it to the class level (my comment below on refactoring) will anyway do it at a more global level, this line will just be removed from here.