Skip to content

Copy cite command should respect preferences #10615

@koppor

Description

@koppor

#10303 introduced a new cite command:

image

It is parsed at org.jabref.gui.push.AbstractPushToApplication#dissectCiteCommand.

However, in org.jabref.gui.edit.CopyMoreAction#copyCiteKey, this pattern is not used.

This leads to \cite{key1,key2}{Khalaf2007} for key Khalaf2007.

284869839-992b6afe-6efc-4a6d-811f-0641c392a50d

Implementation

  1. Rename org.jabref.logic.citationkeypattern.CitationKeyPatternPreferences to CitationKeyGenerationPreferences.
  2. Modify org.jabref.preferences.ExternalApplicationsPreferences#getCiteCommand to return a record having prefix, delimiter, suffix as string. There, the value is constructed based on the code at org.jabref.gui.push.AbstractPushToApplication#dissectCiteCommand. - No need to introduce caching there. That could be done as next step. (This code does not run for a long time, so no performance issues expected). Name the record CitationCommandStringPreferences.
  3. Add test cases testing (wrong) preference \cite. It should work nevertheless. It should use , as delimiter and { as prefix, and } as suffix (as fallback if nothing was provided). Adapt the code of CitationKeyGenerationPreferences accordingly. If this is successfully done, The command "Push entries to external application" adds a "null" prefix and suffix to an existing Citationkey in LaTeX. #10568 is fixed.
  4. Adapt getCitePrefix(), getDelimiter(), and getCiteSuffix() to use the introduced CitationStringPreferences.
  5. Remove org.jabref.gui.push.AbstractPushToApplication#dissectCiteCommand.
  6. Remove org.jabref.gui.push.PushToApplication#getDelimiter
    • Remove method
    • Change parameter at org.jabref.gui.push.PushToApplicationCommand#pushEntries to use CitationCommandStringPreferencess delimiter This is wrong; since application's delimiter has higher precedence than the one of the citaton command.
  7. Adapt org.jabref.gui.edit.CopyMoreAction#copyCiteKey to use the new preference

Metadata

Metadata

Assignees

No one assigned

    Labels

    [outdated] type: bugConfirmed bugs or reports that are very likely to be bugscomponent: preferencesgood first issueAn issue intended for project-newcomers. Varies in difficulty.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done
    Status
    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions