@Test public void canStart() { assertCanStart(true, "<!-- a comment -->"); assertCanStart(true, "<!-- <"); assertCanStart(true, "<!--"); assertCanStart(true, "<!-- <-"); assertCanStart(true, "<!--<-"); assertCanStart(false, "<!-->"); assertCanStart(false, "<!--->"); assertCanStart(true, "<!-- ->"); assertCanStart(false, "<!-- -- -->"); }
@Override public boolean canStart(LineSequence lineSequence) { Line line = lineSequence.getCurrentLine(); if (line != null) { String text = line.getText(); Matcher matcher = startPattern().matcher(text); if (matcher.matches()) { int end = matcher.end(1); if (end < text.length() - 1) { Matcher doubleHyphenMatcher = doubleHyphen.matcher(text); doubleHyphenMatcher.region(end, text.length()); if (doubleHyphenMatcher.find()) { return false; } } return true; } } return false; }
HtmlCommentBlock extends AbstractHtmlBlock { @Override public boolean canStart(LineSequence lineSequence) { Line line = lineSequence.getCurrentLine(); if (line != null) { String text = line.getText(); Matcher matcher = startPattern().matcher(text); if (matcher.matches()) { int end = matcher.end(1); if (end < text.length() - 1) { Matcher doubleHyphenMatcher = doubleHyphen.matcher(text); doubleHyphenMatcher.region(end, text.length()); if (doubleHyphenMatcher.find()) { return false; } } return true; } } return false; } }
HtmlCommentBlock extends AbstractHtmlBlock { @Override public boolean canStart(LineSequence lineSequence) { Line line = lineSequence.getCurrentLine(); if (line != null) { String text = line.getText(); Matcher matcher = startPattern().matcher(text); if (matcher.matches()) { int end = matcher.end(1); if (end < text.length() - 1) { Matcher doubleHyphenMatcher = doubleHyphen.matcher(text); doubleHyphenMatcher.region(end, text.length()); if (doubleHyphenMatcher.find()) { return false; } } return true; } } return false; }  }
HtmlCommentBlock extends AbstractHtmlBlock { @Override public boolean canStart(LineSequence lineSequence) { Line line = lineSequence.getCurrentLine(); if (line != null) { String text = line.getText(); Matcher matcher = startPattern().matcher(text); if (matcher.matches()) { int end = matcher.end(1); if (end < text.length() - 1) { Matcher doubleHyphenMatcher = doubleHyphen.matcher(text); doubleHyphenMatcher.region(end, text.length()); if (doubleHyphenMatcher.find()) { return false; } } return true; } } return false; }  @Override boolean canStart(LineSequence lineSequence); }
HtmlCommentBlock extends AbstractHtmlBlock { @Override public boolean canStart(LineSequence lineSequence) { Line line = lineSequence.getCurrentLine(); if (line != null) { String text = line.getText(); Matcher matcher = startPattern().matcher(text); if (matcher.matches()) { int end = matcher.end(1); if (end < text.length() - 1) { Matcher doubleHyphenMatcher = doubleHyphen.matcher(text); doubleHyphenMatcher.region(end, text.length()); if (doubleHyphenMatcher.find()) { return false; } } return true; } } return false; }  @Override boolean canStart(LineSequence lineSequence);  }