Skip to content

Commit

Permalink
Merge pull request #2752 from JabRef/handleSuperscripts
Browse files Browse the repository at this point in the history
Add test for ordinals
  • Loading branch information
koppor authored Apr 17, 2017
2 parents 723af6d + ae30189 commit 85377b1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static String format(String inField) {
Objects.requireNonNull(inField);

String toFormat = underscoreMatcher.matcher(inField).replaceAll(replacementChar);
toFormat = Normalizer.normalize(LaTeX2Unicode.convert(toFormat), Normalizer.Form.NFKC);
toFormat = Normalizer.normalize(LaTeX2Unicode.convert(toFormat), Normalizer.Form.NFC);
return underscorePlaceholderMatcher.matcher(toFormat).replaceAll("_");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void testFormatStripLatexCommands() {
@Test
public void testFormatTextit() {
// See #1464
assertEquals("text", formatter.format("\\textit{text}"));
assertEquals("\uD835\uDC61\uD835\uDC52\uD835\uDC65\uD835\uDC61", formatter.format("\\textit{text}"));
}


Expand Down Expand Up @@ -167,4 +167,29 @@ public void testConversionOfUnderscoreWithBraces() {
assertEquals("Lorem ipsum_(lorem ipsum)", formatter.format("Lorem ipsum_{lorem ipsum}"));
}

@Test
public void testConversionOfOrdinal1st() {
assertEquals("1ˢᵗ", formatter.format("1\\textsuperscript{st}"));
}

@Test
public void testConversionOfOrdinal2nd() {
assertEquals("2ⁿᵈ", formatter.format("2\\textsuperscript{nd}"));
}

@Test
public void testConversionOfOrdinal3rd() {
assertEquals("3ʳᵈ", formatter.format("3\\textsuperscript{rd}"));
}

@Test
public void testConversionOfOrdinal4th() {
assertEquals("4ᵗʰ", formatter.format("4\\textsuperscript{th}"));
}

@Test
public void testConversionOfOrdinal9th() {
assertEquals("9ᵗʰ", formatter.format("9\\textsuperscript{th}"));
}

}

0 comments on commit 85377b1

Please sign in to comment.