From daa54c3337700ce0fa921050be90079530606cec Mon Sep 17 00:00:00 2001 From: Stefan Kolb Date: Tue, 13 Dec 2016 14:00:08 +0100 Subject: [PATCH 1/3] Resolves #2011 Preserve % sign inside BibTeX fields via cleanup --- .../logic/formatter/bibtexfields/LatexCleanupFormatter.java | 1 + .../formatter/bibtexfields/LatexCleanupFormatterTest.java | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/main/java/net/sf/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java b/src/main/java/net/sf/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java index 0f8ed28c82d..58cd51b4a17 100644 --- a/src/main/java/net/sf/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java +++ b/src/main/java/net/sf/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java @@ -32,6 +32,7 @@ public String format(String oldString) { newValue = newValue.replace(" ", " "); // Clean up newValue = newValue.replace("$$", ""); newValue = newValue.replace(" )$", ")$"); + newValue = newValue.replace("%", "\\%"); // escape % used for comments in TeX return newValue; } diff --git a/src/test/java/net/sf/jabref/logic/formatter/bibtexfields/LatexCleanupFormatterTest.java b/src/test/java/net/sf/jabref/logic/formatter/bibtexfields/LatexCleanupFormatterTest.java index d840f14f525..c6a7b009109 100644 --- a/src/test/java/net/sf/jabref/logic/formatter/bibtexfields/LatexCleanupFormatterTest.java +++ b/src/test/java/net/sf/jabref/logic/formatter/bibtexfields/LatexCleanupFormatterTest.java @@ -26,6 +26,11 @@ public void test() { formatter.format("A ${\\Delta}$${\\Sigma}$ modulator for {FPGA} {DSP}")); } + @Test + public void preservePercentSign() { + assertEquals("\\%", formatter.format("%")); + } + @Test public void formatExample() { assertEquals("{VLSI DSP}", formatter.format(formatter.getExampleInput())); From 81545e52eee3d2ad733b5c694c5d24f37e3b0f06 Mon Sep 17 00:00:00 2001 From: Stefan Kolb Date: Tue, 13 Dec 2016 14:40:11 +0100 Subject: [PATCH 2/3] Changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47f27c06510..c6d88055067 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,9 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - Replaces manual thread management with cached thread pool - Files can now be moved to subfolders named by a custom format pattern, e.g., based on `entrytype`. The pattern can be specified in the settings like the filename pattern. [#1092](https://github.com/JabRef/jabref/issues/1092) + + +- [#2375](https://github.com/JabRef/jabref/issues/2375) LaTeXCleanup action does now preserve % signs inside BibTeX fields ### Fixed - We fixed a few groups related issues: From 27a7ebaf6aa5445866dade8652974138531c3b8c Mon Sep 17 00:00:00 2001 From: Stefan Kolb Date: Thu, 15 Dec 2016 13:22:13 +0100 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6d88055067..6a725c72b64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# The pattern can be specified in the settings like the filename pattern. [#1092](https://github.com/JabRef/jabref/issues/1092) -- [#2375](https://github.com/JabRef/jabref/issues/2375) LaTeXCleanup action does now preserve % signs inside BibTeX fields +- [#2375](https://github.com/JabRef/jabref/issues/2375) 'LaTeXCleanup' action does now escape % signs inside BibTeX fields ### Fixed - We fixed a few groups related issues: