-
-
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
feature request: Markdown [@key] cite command #10133
Comments
Hi Branon,
When you push citation(s) to an external application (e.g. Emacs/Vim/Sublime Text) it is being send as: The Hope this helps. |
Hi Adam, I can understand your problem now. Honestly, this is one of my first few PRs, and I'm a little bit confused about how to set the protected String getCiteCommand() {
return preferencesService.getExternalApplicationsPreferences().getCiteCommand();
} And //*************************************************************************************************************
// ExternalApplicationsPreferences
//*************************************************************************************************************
@Override
public PushToApplicationPreferences getPushToApplicationPreferences() {
if (Objects.nonNull(pushToApplicationPreferences)) {
return pushToApplicationPreferences;
}
Map<String, String> applicationCommands = new HashMap<>();
applicationCommands.put(PushToApplications.EMACS, get(PUSH_EMACS_PATH));
applicationCommands.put(PushToApplications.LYX, get(PUSH_LYXPIPE));
applicationCommands.put(PushToApplications.TEXMAKER, get(PUSH_TEXMAKER_PATH));
applicationCommands.put(PushToApplications.TEXSTUDIO, get(PUSH_TEXSTUDIO_PATH));
applicationCommands.put(PushToApplications.VIM, get(PUSH_VIM));
applicationCommands.put(PushToApplications.WIN_EDT, get(PUSH_WINEDT_PATH));
applicationCommands.put(PushToApplications.SUBLIME_TEXT, get(PUSH_SUBLIME_TEXT_PATH));
pushToApplicationPreferences = new PushToApplicationPreferences(
get(PUSH_TO_APPLICATION),
applicationCommands,
get(PUSH_EMACS_ADDITIONAL_PARAMETERS),
get(PUSH_VIM_SERVER)
);
EasyBind.listen(pushToApplicationPreferences.activeApplicationNameProperty(), (obs, oldValue, newValue) -> put(PUSH_TO_APPLICATION, newValue));
pushToApplicationPreferences.getCommandPaths().addListener((obs, oldValue, newValue) -> storePushToApplicationPath(newValue));
EasyBind.listen(pushToApplicationPreferences.emacsArgumentsProperty(), (obs, oldValue, newValue) -> put(PUSH_EMACS_ADDITIONAL_PARAMETERS, newValue));
EasyBind.listen(pushToApplicationPreferences.vimServerProperty(), (obs, oldValue, newValue) -> put(PUSH_VIM_SERVER, newValue));
return pushToApplicationPreferences;
}
private void storePushToApplicationPath(Map<String, String> commandPair) {
commandPair.forEach((key, value) -> {
switch (key) {
case PushToApplications.EMACS ->
put(PUSH_EMACS_PATH, value);
case PushToApplications.LYX ->
put(PUSH_LYXPIPE, value);
case PushToApplications.TEXMAKER ->
put(PUSH_TEXMAKER_PATH, value);
case PushToApplications.TEXSTUDIO ->
put(PUSH_TEXSTUDIO_PATH, value);
case PushToApplications.VIM ->
put(PUSH_VIM, value);
case PushToApplications.WIN_EDT ->
put(PUSH_WINEDT_PATH, value);
case PushToApplications.SUBLIME_TEXT ->
put(PUSH_SUBLIME_TEXT_PATH, value);
}
});
}
@Override
public ExternalApplicationsPreferences getExternalApplicationsPreferences() {
if (Objects.nonNull(externalApplicationsPreferences)) {
return externalApplicationsPreferences;
}
externalApplicationsPreferences = new ExternalApplicationsPreferences(
get(EMAIL_SUBJECT),
getBoolean(OPEN_FOLDERS_OF_ATTACHED_FILES),
get(CITE_COMMAND),
!getBoolean(USE_DEFAULT_CONSOLE_APPLICATION), // mind the !
get(CONSOLE_COMMAND),
!getBoolean(USE_DEFAULT_FILE_BROWSER_APPLICATION), // mind the !
get(FILE_BROWSER_COMMAND),
get(KINDLE_EMAIL));
EasyBind.listen(externalApplicationsPreferences.eMailSubjectProperty(),
(obs, oldValue, newValue) -> put(EMAIL_SUBJECT, newValue));
EasyBind.listen(externalApplicationsPreferences.autoOpenEmailAttachmentsFolderProperty(),
(obs, oldValue, newValue) -> putBoolean(OPEN_FOLDERS_OF_ATTACHED_FILES, newValue));
EasyBind.listen(externalApplicationsPreferences.citeCommandProperty(),
(obs, oldValue, newValue) -> put(CITE_COMMAND, newValue));
EasyBind.listen(externalApplicationsPreferences.useCustomTerminalProperty(),
(obs, oldValue, newValue) -> putBoolean(USE_DEFAULT_CONSOLE_APPLICATION, !newValue)); // mind the !
EasyBind.listen(externalApplicationsPreferences.customTerminalCommandProperty(),
(obs, oldValue, newValue) -> put(CONSOLE_COMMAND, newValue));
EasyBind.listen(externalApplicationsPreferences.useCustomFileBrowserProperty(),
(obs, oldValue, newValue) -> putBoolean(USE_DEFAULT_FILE_BROWSER_APPLICATION, !newValue)); // mind the !
EasyBind.listen(externalApplicationsPreferences.customFileBrowserCommandProperty(),
(obs, oldValue, newValue) -> put(FILE_BROWSER_COMMAND, newValue));
EasyBind.listen(externalApplicationsPreferences.kindleEmailProperty(),
(obs, oldValue, newValue) -> put(KINDLE_EMAIL, newValue));
return externalApplicationsPreferences;
} ==Just don't know how to set the cite command. I'm gonna ask someone for help== I've looked at Thanks for the swift response, Adam. Cheers, |
Could I be assigned to this issue, maybe? |
Sure |
@Brandon-Lu737 Okay:
A bit about the overall architecture: All UI in JabRef follows MVVM (Model View ViewModel) These need to be stored in the settings as well. Also happens via observables/Bindings so that changes are directly stored in the preferences. We have an Abstract class containing the central method for building the string that gets pushed to the external application Feel free to ask if you have more questions! |
@HoussemNasri, when you assign somebody, please also set the corresponding status for the project pages. Unless there is a pull-request, the status is "reserved". |
@Brandon-Lu737 What is the status here? Are you still working on this? |
Could someone tell me why it is not present in the most recent 5.11 release? |
@AdamWysokinski You can just modify the pattern to |
It does, thank you! :) |
I use Pandoc for processing Markdown manuscripts to ODT format. Markdown cite command is
[@key]
instead of LaTeX\cite{key}
. In case of multiple citations this is[@key1; @key2]
. Currently the preference for cite command does not include the{
and}
characters, making it impossible to change it to another cite command that does not use curly brackets. Also, the separating character (,
) cannot be modified.It would be great if this was more configurable:
The text was updated successfully, but these errors were encountered: