@Test public void isLeftFlanking() { assertLeftFlanking(true, "**a", 0, 2); assertLeftFlanking(false, "** a", 0, 2); assertLeftFlanking(true, " **a", 1, 2); assertLeftFlanking(true, ".**a", 1, 2); assertLeftFlanking(false, "**", 0, 2); assertLeftFlanking(true, "***abc", 0, 3); assertLeftFlanking(true, " _abc", 2, 1); assertLeftFlanking(true, "**\"abc\"", 0, 2); assertLeftFlanking(true, " _\"abc\"", 1, 1); assertLeftFlanking(false, "abc***", 3, 3); assertLeftFlanking(false, " abc_", 5, 1); assertLeftFlanking(false, "\"abc\"**", 5, 2); assertLeftFlanking(false, "\"abc\"_", 5, 1); assertLeftFlanking(true, "abc**def", 3, 2); assertLeftFlanking(true, "\"abc\"_\"def\"", 5, 1); assertLeftFlanking(false, "abc *** def", 4, 3); assertLeftFlanking(false, "a _ b", 2, 1); }
boolean isLeftFlanking(Cursor cursor, int length) { char charBefore = charBefore(cursor); char charAfter = charAfter(cursor, length); return !isWhitespace(charAfter) && !(isPunctuation(charAfter) && !isWhitespace(charBefore) && !isPunctuation(charBefore)); }
PotentialEmphasisSpan extends SourceSpan { boolean isLeftFlanking(Cursor cursor, int length) { char charBefore = charBefore(cursor); char charAfter = charAfter(cursor, length); return !isWhitespace(charAfter) && !(isPunctuation(charAfter) && !isWhitespace(charBefore) && !isPunctuation(charBefore)); } }
PotentialEmphasisSpan extends SourceSpan { boolean isLeftFlanking(Cursor cursor, int length) { char charBefore = charBefore(cursor); char charAfter = charAfter(cursor, length); return !isWhitespace(charAfter) && !(isPunctuation(charAfter) && !isWhitespace(charBefore) && !isPunctuation(charBefore)); }  }
PotentialEmphasisSpan extends SourceSpan { boolean isLeftFlanking(Cursor cursor, int length) { char charBefore = charBefore(cursor); char charAfter = charAfter(cursor, length); return !isWhitespace(charAfter) && !(isPunctuation(charAfter) && !isWhitespace(charBefore) && !isPunctuation(charBefore)); }  @Override Optional<? extends Inline> createInline(Cursor cursor); }
PotentialEmphasisSpan extends SourceSpan { boolean isLeftFlanking(Cursor cursor, int length) { char charBefore = charBefore(cursor); char charAfter = charAfter(cursor, length); return !isWhitespace(charAfter) && !(isPunctuation(charAfter) && !isWhitespace(charBefore) && !isPunctuation(charBefore)); }  @Override Optional<? extends Inline> createInline(Cursor cursor);  }