@Test public void calculateId_X_space_y_is__converted_to_underscore_x_underscore_y() { assertEquals("_x_y",AsciiDoctorHeadline.calculateId("X y")); }
static String calculateId(String name) { if (name==null){ return ""; } String id = REGEXP.matcher(name).replaceAll("_"); id= "_"+id.toLowerCase(); while(id.length()>1 && id.endsWith("_")){ id=id.substring(0,id.length()-1); } while(id.indexOf("__")!=-1){ id=id.replaceAll("__", "_"); } return id; }
AsciiDoctorHeadline implements AsciidoctorTextSelectable { static String calculateId(String name) { if (name==null){ return ""; } String id = REGEXP.matcher(name).replaceAll("_"); id= "_"+id.toLowerCase(); while(id.length()>1 && id.endsWith("_")){ id=id.substring(0,id.length()-1); } while(id.indexOf("__")!=-1){ id=id.replaceAll("__", "_"); } return id; } }
AsciiDoctorHeadline implements AsciidoctorTextSelectable { static String calculateId(String name) { if (name==null){ return ""; } String id = REGEXP.matcher(name).replaceAll("_"); id= "_"+id.toLowerCase(); while(id.length()>1 && id.endsWith("_")){ id=id.substring(0,id.length()-1); } while(id.indexOf("__")!=-1){ id=id.replaceAll("__", "_"); } return id; } AsciiDoctorHeadline(int deep, String name, int position, int end, int lengthTonNameEnd); }
AsciiDoctorHeadline implements AsciidoctorTextSelectable { static String calculateId(String name) { if (name==null){ return ""; } String id = REGEXP.matcher(name).replaceAll("_"); id= "_"+id.toLowerCase(); while(id.length()>1 && id.endsWith("_")){ id=id.substring(0,id.length()-1); } while(id.indexOf("__")!=-1){ id=id.replaceAll("__", "_"); } return id; } AsciiDoctorHeadline(int deep, String name, int position, int end, int lengthTonNameEnd); String getCalculatedId(); int getLengthToNameEnd(); @Override int getSelectionStart(); @Override int getSelectionLength(); int getDeep(); String getName(); @Override int getPosition(); int getEnd(); String getId(); @Override String toString(); }
AsciiDoctorHeadline implements AsciidoctorTextSelectable { static String calculateId(String name) { if (name==null){ return ""; } String id = REGEXP.matcher(name).replaceAll("_"); id= "_"+id.toLowerCase(); while(id.length()>1 && id.endsWith("_")){ id=id.substring(0,id.length()-1); } while(id.indexOf("__")!=-1){ id=id.replaceAll("__", "_"); } return id; } AsciiDoctorHeadline(int deep, String name, int position, int end, int lengthTonNameEnd); String getCalculatedId(); int getLengthToNameEnd(); @Override int getSelectionStart(); @Override int getSelectionLength(); int getDeep(); String getName(); @Override int getPosition(); int getEnd(); String getId(); @Override String toString();  }