Skip to content
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

Add unprotect_terms to the list of modifiers for bracketed patterns #7960

Merged
merged 3 commits into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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