com.softicar.platform.common.ui.wiki.token.matcher.WikiTableRowMatcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.ui.wiki.token.matcher;
import com.softicar.platform.common.ui.wiki.token.WikiTableRowToken;
import com.softicar.platform.common.ui.wiki.tokenizer.IWikiTokenizer;
public class WikiTableRowMatcher implements IWikiTokenMatcher {
@Override
public boolean match(IWikiTokenizer tokenizer) {
if (tokenizer.getCharAt(-1, '\n') == '\n') {
if (tokenizer.startsWith("^") || tokenizer.startsWith("|")) {
int end = tokenizer//
.findIndexOf("\n")
.map(index -> index + 1)
.orElse(tokenizer.getLength());
String text = tokenizer.getSubstring(0, end);
tokenizer.addToken(new WikiTableRowToken(text));
return true;
}
}
return false;
}
}