Implemented text-transform=capitalize

pull/214/head
M66B 7 months ago
parent 0853694aa2
commit 3a2130dc3c

@ -924,7 +924,18 @@ public class HtmlHelper {
String text = tnode.getWholeText();
switch (value) {
case "capitalize":
// TODO: capitalize
for (int i = 0; i < text.length(); ) {
int codepoint = text.codePointAt(i);
if (Character.isLetter(codepoint)) {
tnode.text(text.substring(0, i) +
text.substring(i, i + 1).toUpperCase(Locale.ROOT) +
text.substring(i + 1));
break;
} else if (!Character.isWhitespace(codepoint))
break;
else
i += Character.charCount(codepoint);
}
break;
case "uppercase":
tnode.text(text.toUpperCase(Locale.ROOT));

Loading…
Cancel
Save