use of com.m2mobi.markymark.item.inline.TextString in project MarkyMark-Android by M2Mobi.
the class InlineConverter method parseContent.
/**
* TODO: Documentation
* TODO: consider moving this to a more suitable class?
*/
public List<MarkDownString> parseContent(final String pContent) {
final List<MarkDownString> markDownStrings = new ArrayList<>();
String toCheck = pContent;
while (!toCheck.isEmpty()) {
MatchedRule matchedRule = findFirstMatch(toCheck);
if (matchedRule != null) {
if (matchedRule.mStart > 0) {
markDownStrings.add(new TextString(toCheck.substring(0, matchedRule.mStart), false));
}
String content = toCheck.substring(matchedRule.mStart, matchedRule.mEnd);
markDownStrings.add(matchedRule.mInlineRule.toMarkDownString(content));
toCheck = toCheck.substring(matchedRule.mEnd, toCheck.length());
} else if (!toCheck.isEmpty()) {
markDownStrings.add(new TextString(toCheck, false));
break;
}
}
return markDownStrings;
}
use of com.m2mobi.markymark.item.inline.TextString in project MarkyMark-Android by M2Mobi.
the class TextDisplayItem method create.
@Override
public Spanned create(final InlineConverter<Spanned> pInlineConverter, final TextString pMarkDownString) {
final Spannable spannable = SpannableUtils.createSpannable(pInlineConverter, pMarkDownString);
final String result = StringEscapeUtils.unescapeHtml4(String.valueOf(spannable));
return new SpannedString(result);
}
Aggregations