use of com.vladsch.flexmark.ext.typographic.TypographicSmarts in project flexmark-java by vsch.
the class SmartsInlineParser method parse.
@Override
public boolean parse(final InlineParser inlineParser) {
BasedSequence match = inlineParser.match(parsing.SMARTS);
if (match != null) {
BasedSequence input = inlineParser.getInput();
inlineParser.flushTextNode();
String typographicSmarts;
if (match.matches(parsing.ELIPSIS))
typographicSmarts = "…";
else if (match.matches(parsing.ELIPSIS_SPACED))
typographicSmarts = "…";
else if (match.matches(parsing.EN_DASH))
typographicSmarts = "–";
else if (match.matches(parsing.EM_DASH))
typographicSmarts = "—";
else
return false;
TypographicSmarts smarts = new TypographicSmarts(match, typographicSmarts);
inlineParser.getBlock().appendChild(smarts);
return true;
}
return false;
}
Aggregations