All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.softicar.platform.common.ui.wiki.token.matcher.WikiListItemMatcher Maven / Gradle / Ivy

Go to download

The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.

There is a newer version: 50.0.0
Show newest version
package com.softicar.platform.common.ui.wiki.token.matcher;

import com.softicar.platform.common.ui.wiki.token.WikiToken;
import com.softicar.platform.common.ui.wiki.token.WikiTokenType;
import com.softicar.platform.common.ui.wiki.tokenizer.IWikiTokenizer;

public class WikiListItemMatcher implements IWikiTokenMatcher {

	@Override
	public boolean match(IWikiTokenizer tokenizer) {

		if (tokenizer.startsWith("  ")) {
			int end = tokenizer.findIndexOfOther(' ', 2);
			char c = tokenizer.getCharAt(end, ' ');
			if (c == '*' || c == '-') {
				String tokenText = tokenizer.getSubstring(0, end + 1);
				tokenizer.addToken(new WikiToken(WikiTokenType.LIST_ITEM, tokenText));
				return true;
			}
		}
		return false;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy