package com.ephox.example; import java.util.regex.Matcher; import java.util.regex.Pattern; import com.ephox.editlive.ELJBean; import com.ephox.editlive.SourceFilter; /** * A very simple source filter for EditLive! that * simply changes the format of the code output, * ensuring that list items appear on a single line by default. * @author Robert.Dawson * */ public class SimpleSourceFilter implements SourceFilter{ public SimpleSourceFilter(ELJBean bean){ if (bean !=null){ bean.setFilter(this); } } public String filterIn(String source) { return source; } public String filterOut(String source) { Pattern pattern = Pattern.compile("
  • \\s*([^\n]*)\\s*
  • ", Pattern.DOTALL+Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(source); source = matcher.replaceAll("
  • $1
  • "); return source; } }