use of com.m2mobi.markymark.item.inline.MarkDownString in project MarkyMark-Android by M2Mobi.
the class BoldRule method toMarkDownString.
@Override
public MarkDownString toMarkDownString(String pContent) {
Matcher matcher = getRegex().matcher(pContent);
String content = "";
if (matcher.find()) {
content = matcher.group(2);
}
return new BoldString(content, true);
}
use of com.m2mobi.markymark.item.inline.MarkDownString in project MarkyMark-Android by M2Mobi.
the class ItalicRule method toMarkDownString.
@Override
public MarkDownString toMarkDownString(String pContent) {
Matcher matcher = getRegex().matcher(pContent);
String content = "";
if (matcher.find()) {
content = matcher.group(2);
}
return new ItalicString(content, true);
}
use of com.m2mobi.markymark.item.inline.MarkDownString in project MarkyMark-Android by M2Mobi.
the class StrikeRule method toMarkDownString.
@Override
public MarkDownString toMarkDownString(final String pContent) {
Matcher matcher = getRegex().matcher(pContent);
String content = "";
if (matcher.find()) {
content = matcher.group(1);
}
return new StrikeString(content, true);
}
use of com.m2mobi.markymark.item.inline.MarkDownString 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;
}
Aggregations