Skip to content

Introduce formatter to remove word-enclosing braces #11222

@koppor

Description

@koppor

We have RemoveBracesFormatter, which removes the outer braces. See org.jabref.logic.formatter.bibtexfields.RemoveBracesFormatterTest for examples.

We have org.jabref.model.entry.Author#removeStartAndEndBraces, which also removes inner braces enclosing complete words:

  • {Vall{\'e}e} {Poussin} -> Vall{\'e}e Poussin <-- here, {Poussin} is changed to Poussin. This is not available to users (in the cleanup entry dialogue)
  • {Vall{\'e}e Poussin} -> Vall{\'e}e Poussin <-- here, the outer braces are removed
  • Vall{\'e}e Poussin -> Vall{\'e}e Poussin <-- here, everything is kept as is

We should make this formatter "globally" available:

  1. Rename RemoveBracesFormatter to RemoveEnclosingBracesFormatter.
    • Also rename all used fields.
  2. Introduce RemoveWordEnclosingAndOuterEnclosingBracesFormatter by moving the code of org.jabref.model.entry.Author#removeStartAndEndBraces to here
    • Introduce class
    • Create test cases (similar to RemoveBracesFormatterTest)
    • Replace call to removeStartAndEndBraces in Author to call to RemoveWordEnclosingAndOuterEnclosingBracesFormatter.format. The RemoveWordEnclosingAndOuterEnclosingBracesFormatter needs to be initialized as class constant in Author
    • Name the formatter "Remove word enclosing braces"
    • Use description "Removes braces encapsulating a complete word and the complete field content."
  3. Create a pull request for the user documentation (update the page https://docs.jabref.org/finding-sorting-and-cleaning-entries/saveactions#remove-enclosing-braces).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done
    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions