jabref
jabref copied to clipboard
Fix 11102 by allowing users to add local bst files to preview layout list
I've tried to fix #11102 by adding a button which may be used to add the selected bst files to the available styles and tested it to work although I think for preview to function well bstvm should be used not sure how. Would like some guidance . After it works as expected may be documentation can be modified.
Mandatory checks
- [x] Change in
CHANGELOG.md
described in a way that is understandable for the average user (if applicable) - [ ] Tests created for changes (if applicable)
- [x] Manually tested changed features in running JabRef (always required)
- [ ] Screenshots added in PR description (for UI changes)
- [ ] Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
- [ ] Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.
No need to close the PR and reopen. Just continue committing and pushing. The PR will be updated automatically
think for preview to function well bstvm should be used not sure how
I am not quite sure I understand you correctly, but the BstPreviewLayout itself already handles the bstVm:, so it should work out of the box
https://github.com/JabRef/jabref/blob/94bc5c2c74adb7f034855bc4a362433bd2523294/src/main/java/org/jabref/logic/bst/BstPreviewLayout.java#L44-L54
@Siedlerchr thanks I didn't really understand the mechanism of updating pull request (i.e. just committing to my branch automatically updates the pr and runs tests again.
Thanks for the PR! We refactored the code a bit and found an issue with the BST rendering itself, (not your fault, but we would like to continue here, so please leave the PR open).
Intermediate result:
- Running
IEEEtran.bst
with this branch leads to a failure - Running
IEEEtran.bst
with ANTLR4, works (see https://github.com/koppor/jabref/pull/685) - Thus, I assume that https://github.com/JabRef/jabref/pull/8934 broke our VM.
Tested some other styles that work:
https://raw.githubusercontent.com/CarlOrff/apalike-german/master/apalike-german.bst https://ctan.org/pkg/alphanumb https://github.com/wacv-pcs/WACV-2023-Author-Kit/blob/main/ieee.bst https://www.ctan.org/tex-archive/biblio/bibtex/base/acm.bst Apalike: https://www.ctan.org/tex-archive/biblio/bibtex/base
interestingly, the IEEEtr.bst from the base style sworks as well https://mirrors.ctan.org/biblio/bibtex/base/ieeetr.bst
Current state:
The t
is a function which is "not found", but t
seems to be string or a variable.
Maybe, the whole new interpretation mixes up parsing of the .bst
file and the real execution.
Other than that, I find following code strange - this seems to mix parsing and execution
@Override
public Integer visitBstFunction(BstParser.BstFunctionContext ctx) {
String name = ctx.getChild(0).getText();
if (bstVMContext.functions().containsKey(name)) {
LOGGER.trace("Function '{}' found", name);
bstVMContext.functions().get(name).execute(this, ctx, selectedBstEntry);
} else {
LOGGER.trace("Function '{}' not found", name);
visit(ctx.getChild(0));
}
return BstVM.TRUE;
}
Other than that, I find following code strange - this seems to mix parsing and execution
Parsing is all done in the constructor of the VM. Execution is done by the visitor.
Parsing is all done in the constructor of the VM. Execution is done by the visitor.
I don't fully understand. The code above reads that visit
is doing some semantic interpretation. First hit of a function: Visit it using the visitor. Second hit of a function: Execute it. This is what I meant with "mix". -- In other words: First, there is a "syntax analysis". Then, the visit
function seems to do some semantic analysis and also a semantic execution.
(I found the article at https://medium.com/@shivanivikhar3775/know-more-about-compiler-phases-601680cf48fd a good overview)
Maybe, it's "just" about logging the steps in the ANTLR3 version and the steps at the ANTLR4 version and comparing them. When do they diverge for IEEE? (In other words: create traces and compare the traces). I hope, it will be "easy" to do so.
If I recall correctly, the it just checks if a built-in function is present, otherwise it looks for custom functions.
Strange git error:
error: Authentication error: Authentication required: You must have push access to verify locks
error: failed to push some refs to 'https://github.com/sahilsekr42/jabref.git'
Pushed to koppor
.
something with git lfs stuff
We identified that there is an endless loop happening in following bst function
% Converts all single dashes "-" to double dashes "--".
FUNCTION {n.dashify}
{ large.number.separate
't :=
""
{ t empty$ not }
{ t #1 #1 substring$ "-" =
{ t #1 #2 substring$ "--" = not
{ "--" *
t #2 global.max$ substring$ 't :=
}
{ { t #1 #1 substring$ "-" = }
{ "-" *
t #2 global.max$ substring$ 't :=
}
while$
}
if$
}
{ t #1 #1 substring$ *
t #2 global.max$ substring$ 't :=
}
if$
}
while$
}
(And we fixed the lookup)
Storing in the prefs now works as well