Skip to content

Commit

Permalink
Add unprotect_terms to the list of modifiers for bracketed patterns (
Browse files Browse the repository at this point in the history
  • Loading branch information
k3KAW8Pnf7mkmdSMPHz27 authored Aug 2, 2021
1 parent 47f3f5d commit 5d67695
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve

- We added the option to copy the DOI of an entry directly from the context menu copy submenu. [#7826](https://github.com/JabRef/jabref/issues/7826)
- We added a fulltext search feature. [#2838](https://github.com/JabRef/jabref/pull/2838)
- We added unprotect_terms to the list of bracketed pattern modifiers [#7826](https://github.com/JabRef/jabref/pull/7960)

### Changed

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/jabref/logic/formatter/Formatters.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.jabref.logic.formatter.casechanger.LowerCaseFormatter;
import org.jabref.logic.formatter.casechanger.SentenceCaseFormatter;
import org.jabref.logic.formatter.casechanger.TitleCaseFormatter;
import org.jabref.logic.formatter.casechanger.UnprotectTermsFormatter;
import org.jabref.logic.formatter.casechanger.UpperCaseFormatter;
import org.jabref.logic.formatter.minifier.MinifyNameListFormatter;
import org.jabref.logic.formatter.minifier.TruncateFormatter;
Expand Down Expand Up @@ -74,7 +75,8 @@ public static List<Formatter> getOthers() {
new UnitsToLatexFormatter(),
new EscapeUnderscoresFormatter(),
new EscapeAmpersandsFormatter(),
new ShortenDOIFormatter()
new ShortenDOIFormatter(),
new UnprotectTermsFormatter()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,13 @@ void expandBracketsWithTestCasesFromRegExpBasedFileFinder() {
BracketedPattern.expandBrackets("[author] have published [title] in [journal].", ',', entry, database));
}

@Test
void expandBracketsWithoutProtectiveBracesUsingUnprotectTermsModifier() {
BibEntry bibEntry = new BibEntry()
.withField(StandardField.JOURNAL, "{ACS} Medicinal Chemistry Letters");
assertEquals("ACS Medicinal Chemistry Letters", BracketedPattern.expandBrackets("[JOURNAL:unprotect_terms]", null, bibEntry, null));
}

@ParameterizedTest
@MethodSource("provideArgumentsForFallback")
void expandBracketsWithFallback(String expandResult, String pattern) {
Expand Down

0 comments on commit 5d67695

Please sign in to comment.