Skip to content

Commit

Permalink
Merge pull request #343 from commonmark/issue-342
Browse files Browse the repository at this point in the history
Adopt vendoring changes from OpenJDK
  • Loading branch information
robinst authored Sep 21, 2024
2 parents 8ce24de + 1dacdcb commit f82f1e6
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ private void renderBackrefs(Node def, ReferencedDefinition referencedDefinition)
html.tag("/sup");
}
// U+21A9 LEFTWARDS ARROW WITH HOOK
html.raw("");
html.raw("\u21A9");
html.tag("/a");
if (i + 1 < refs.size()) {
html.raw(" ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public BlockStart tryStart(ParserState state, MatchedBlockParser matchedBlockPar
}

// spec: An ATX heading consists of a string of characters, parsed as inline content, between an opening sequence of
// 16 unescaped # characters and an optional closing sequence of any number of unescaped # characters. The opening
// 1-6 unescaped # characters and an optional closing sequence of any number of unescaped # characters. The opening
// sequence of # characters must be followed by a space or by the end of line. The optional closing sequence of #s
// must be preceded by a space and may be followed by spaces only.
private static HeadingParser getAtxHeading(SourceLine line) {
Expand Down Expand Up @@ -140,10 +140,12 @@ private static int getSetextHeadingLevel(CharSequence line, int index) {
if (isSetextHeadingRest(line, index + 1, '=')) {
return 1;
}
break;
case '-':
if (isSetextHeadingRest(line, index + 1, '-')) {
return 2;
}
break;
}
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private static ListMarkerData parseListMarker(CharSequence line, int index) {
}
}

// spec: An ordered list marker is a sequence of 19 arabic digits (0-9), followed by either a `.` character or a
// spec: An ordered list marker is a sequence of 1-9 arabic digits (0-9), followed by either a `.` character or a
// `)` character.
private static ListMarkerData parseOrderedList(CharSequence line, int index) {
int digits = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ public static String percentEncodeUrl(String s) {
public static String normalizeLabelContent(String input) {
String trimmed = input.trim();

// This is necessary to correctly case fold "ẞ" to "SS":
// "".toLowerCase(Locale.ROOT) -> "ß"
// "ß".toUpperCase(Locale.ROOT) -> "SS"
// This is necessary to correctly case fold "\u1E9E" (LATIN CAPITAL LETTER SHARP S) to "SS":
// "\u1E9E".toLowerCase(Locale.ROOT) -> "\u00DF" (LATIN SMALL LETTER SHARP S)
// "\u00DF".toUpperCase(Locale.ROOT) -> "SS"
// Note that doing upper first (or only upper without lower) wouldn't work because:
// "".toUpperCase(Locale.ROOT) -> ""
// "\u1E9E".toUpperCase(Locale.ROOT) -> "\u1E9E"
String caseFolded = trimmed.toLowerCase(Locale.ROOT).toUpperCase(Locale.ROOT);

return WHITESPACE.matcher(caseFolded).replaceAll(" ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class Html5Entities {

private static final Map<String, String> NAMED_CHARACTER_REFERENCES = readEntities();
private static final String ENTITY_PATH = "/org/commonmark/internal/util/entities.properties";
private static final String ENTITY_PATH = "/org/commonmark/internal/util/entities.txt";

public static String entityToString(String input) {
if (!input.startsWith("&") || !input.endsWith(";")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ public void visit(Document document) {

@Override
public void visit(BlockQuote blockQuote) {
textContent.write('«');
// LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
textContent.write('\u00AB');
visitChildren(blockQuote);
textContent.write('»');
// RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
textContent.write('\u00BB');

writeEndOfLineIfNeeded(blockQuote, null);
}
Expand Down

0 comments on commit f82f1e6

Please sign in to comment.