@Test public void withHyphen() { assertEquals("with-hyphen", strategy.generateId("with-hyphen")); }
@Override public String generateId(String headingText) { String id = headingText.toLowerCase(Locale.getDefault()); id = id.replaceAll("[^a-z0-9_-]", "-"); CharMatcher hyphenMatcher = CharMatcher.is('-'); id = hyphenMatcher.trimFrom(hyphenMatcher.collapseFrom(id, '-')); return id; }
GfmIdGenerationStrategy extends IdGenerationStrategy { @Override public String generateId(String headingText) { String id = headingText.toLowerCase(Locale.getDefault()); id = id.replaceAll("[^a-z0-9_-]", "-"); CharMatcher hyphenMatcher = CharMatcher.is('-'); id = hyphenMatcher.trimFrom(hyphenMatcher.collapseFrom(id, '-')); return id; } }
GfmIdGenerationStrategy extends IdGenerationStrategy { @Override public String generateId(String headingText) { String id = headingText.toLowerCase(Locale.getDefault()); id = id.replaceAll("[^a-z0-9_-]", "-"); CharMatcher hyphenMatcher = CharMatcher.is('-'); id = hyphenMatcher.trimFrom(hyphenMatcher.collapseFrom(id, '-')); return id; }  }
GfmIdGenerationStrategy extends IdGenerationStrategy { @Override public String generateId(String headingText) { String id = headingText.toLowerCase(Locale.getDefault()); id = id.replaceAll("[^a-z0-9_-]", "-"); CharMatcher hyphenMatcher = CharMatcher.is('-'); id = hyphenMatcher.trimFrom(hyphenMatcher.collapseFrom(id, '-')); return id; }  @Override String generateId(String headingText); }
GfmIdGenerationStrategy extends IdGenerationStrategy { @Override public String generateId(String headingText) { String id = headingText.toLowerCase(Locale.getDefault()); id = id.replaceAll("[^a-z0-9_-]", "-"); CharMatcher hyphenMatcher = CharMatcher.is('-'); id = hyphenMatcher.trimFrom(hyphenMatcher.collapseFrom(id, '-')); return id; }  @Override String generateId(String headingText);  }