-
-
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
Unmerge LO citations #7455
Unmerge LO citations #7455
Conversation
Thanks for your contribution. Codewise looks good to me so far. |
I started a new branch to reorganize OOBibBase.java, at https://github.com/antalk2/jabref/tree/improve-reversibility So far it should contain no changes to user-visible functionality, On the other hand, reorganizing means lots of changes, I am worried, that with so many changes I end up with Please let me know what to expect and what to watch out for. |
Probably the best would be to merge this one and you keep working on your branch. But try to focus on one issue change per commit, so we can understand what you changed, commit by commit. You can also label your PR as WIP and draft, growing as you work on it, and we check regularly in and have a look at your changes. Don't worry, working on JabRef together should be fun. We don't bite. 😄 |
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.
Just a few quick nitpicks I saw.
UndefinedCharacterFormatException, UnknownPropertyException, PropertyVetoException, CreationException, | ||
BibEntryNotFoundException { | ||
XNameAccess nameAccess = getReferenceMarks(); | ||
// TODO: doesn't work for citations in footnotes/tables |
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.
Are you going to work on this todo?
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 one is not really mine,
// TODO: doesn't work for citations in footnotes/tables |
There is some code in getReferenceMarks concerning footnotes, but not tables.
I did insert some TODO notes, however.
Some of these are questions, like: https://github.com/antalk2/jabref/blob/ff1bc8933e3b05630633ef262e8b6f7928446ba9/src/main/java/org/jabref/gui/openoffice/OOBibBase.java#L184, where I am not sure
if the code is there for a purpose (e.g. to provoke an exception if some assumption fails) or just forgotten.
.getAnchor(); | ||
|
||
XTextCursor mxDocCursor = range1.getText().createTextCursorByRange(range1); | ||
// |
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.
Empty comment line can be removed
List<String> keys = parseRefMarkName(names.get(piv)); | ||
if (keys.size() > 1) { | ||
removeReferenceMark(names.get(piv)); | ||
// |
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.
Empty comment line
|
||
final XTextRangeCompare compare = UnoRuntime.queryInterface(XTextRangeCompare.class, text); | ||
|
||
int piv = 0; |
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.
Please try to avoid abbreviations a variable names. Use full length names, maybe in camelCase.
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.
Do you mean piv should be pivot or pivotElement?
In https://github.com/antalk2/jabref/blob/ff1bc8933e3b05630633ef262e8b6f7928446ba9/src/main/java/org/jabref/gui/openoffice/OOBibBase.java#L1995 I renamed text to xtext, and expanded to this.xtext
to clarifiy its scope. The local variables compare and piv seemed OK.
If there is a part of the project that could serve as an example please point me there,
it might help to pick up the conventions.
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, pivot is better. We usually also don't prefix variables with their type, so instead of mxDocCursor
documentCursor
(or textCursor
?) would be preferred. Similarily, bName
below can simply be name
or if you want to be verbose markName
.
|
@antalk2 what do you think about merging this one first, and then having the further refactoring an a second PR? |
Yes. I think this is better as a separate merge. I am doing the refactoring in a separate branch. |
@@ -2282,6 +2282,9 @@ No\ metadata\ found.\ Creating\ empty\ entry\ with\ file\ link=No metadata found | |||
Processing\ file\ %0=Processing file %0 | |||
Export\ selected=Export selected | |||
|
|||
UnCombine\ merged\ citations=UnCombine merged citations |
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.
Uncombine seems to be a proper english word. So the inword capitialization is not needed. But maybe separate
instead of uncombine and unmerge would be better?
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.
Merge citations | Unmerge citations
Join citations | Separate citations
I would like to make it clear that the two buttons correspond,
hence came Unmerge
.
To Separate
I associate Join
as the opposite.
(English is not my primary language)
Which pair (of the above, or something else) would you prefer?
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.
I'm not familiar enough with the feature, but I would say join/separate are a bit clearer / non-technical terms. Maybe @Siedlerchr has a preference.
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.
It does a bit more than just putting them in a pair of shared parentheses:
The entries under the same reference mark are sorted according to comparatorForMulticite
And there is a comment at getCitationMarker saying:
// // E.g. (Olsen, 2005a, b) should be output instead of (Olsen, 2005a; Olsen, 2005b).
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.
I've got no strong opinion, but think separate/merge is also suited
Ok, I've reopened this PR then. If you could address the small comments by @calixtus and me, then we can merge. Thanks! |
I believe I did that. Let me know if I left out something. |
Style checks (reviewdog) often ask me to make the code less readable. |
The style check is important to have consistency across the repository and to prevent merge conflicts of unrelated changes e.g. whitespaces or line breaks. You can import JabRef's code style in intellij and do a kind of |
This sounds like "follow its suggestions anyway". OK, I will try that. |
Well, we configured reviewdog to automate the suggestions, otherwise we would make. What suggestions in particular do you think makes the code less readable? |
is harder to read than
Style checker documentation says:
Apparently they support both
Inner blocks are useful in restricting scope of local variables,
Style checker seems to prefer this:
or
I know, when
|
Thanks for your answer. I think we (@JabRef/developers) maybe talk about these considerations in the next devcall. |
I'm sorry but I disagree with all of your suggestions and prefer the current JabRef code style. @JabRef/developers
|
It is OK, I do not expect or suggest to change JabRef code style, just shared my preferences.
|
Thank you for this suggestion. Installing IDEA helped a lot to find a style |
Thanks again for your contribution, I tested your feature with both an author year and the numerical style and it works. |
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.
Codewise looks good to me!
Checks are good, two approvals, @Siedlerchr confirmed its working. Thanks for your great contribution! |
Implemented "Unmerge citations" in the Openoffice/Libreoffice
integration panel.
Fixes #7454(#7454)
Change in
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)Tests created for changes (if applicable)
No, tests were not created. Do you have GUI tests?
Manually tested changed features in running JabRef (always required)
Screenshots added in PR description (for UI changes)
https://docs.jabref.org/cite/openofficeintegration does not mention the "Merge citations" button.
The most appropriate addition would probably go under the "Known issues" section,
describing the two problems above (or the original, if the proposed changes are not applied)