@Test public void include_subfolder1() { String text = "include::subfolder1/"; int index = text.length(); String result = toTest.resolveReferenceTextOrNull(text, index); assertEquals("include::subfolder1/", result); }
public String resolveReferenceTextOrNull(String fullSource, int posBeforeCtrlSpace) { int index = posBeforeCtrlSpace-1; if (fullSource.length()<=index) { index = fullSource.length()-1; } StringBuilder sb = new StringBuilder(); while (index>=0) { char c= fullSource.charAt(index--); if (Character.isWhitespace(c)) { break; } sb.insert(0, c); } String inspected = sb.toString(); if (inspected.startsWith(getPrefix())) { return inspected; } return null; }
AsciidocReferenceExistingTextCalculator { public String resolveReferenceTextOrNull(String fullSource, int posBeforeCtrlSpace) { int index = posBeforeCtrlSpace-1; if (fullSource.length()<=index) { index = fullSource.length()-1; } StringBuilder sb = new StringBuilder(); while (index>=0) { char c= fullSource.charAt(index--); if (Character.isWhitespace(c)) { break; } sb.insert(0, c); } String inspected = sb.toString(); if (inspected.startsWith(getPrefix())) { return inspected; } return null; } }
AsciidocReferenceExistingTextCalculator { public String resolveReferenceTextOrNull(String fullSource, int posBeforeCtrlSpace) { int index = posBeforeCtrlSpace-1; if (fullSource.length()<=index) { index = fullSource.length()-1; } StringBuilder sb = new StringBuilder(); while (index>=0) { char c= fullSource.charAt(index--); if (Character.isWhitespace(c)) { break; } sb.insert(0, c); } String inspected = sb.toString(); if (inspected.startsWith(getPrefix())) { return inspected; } return null; } AsciidocReferenceExistingTextCalculator(String prefix); }
AsciidocReferenceExistingTextCalculator { public String resolveReferenceTextOrNull(String fullSource, int posBeforeCtrlSpace) { int index = posBeforeCtrlSpace-1; if (fullSource.length()<=index) { index = fullSource.length()-1; } StringBuilder sb = new StringBuilder(); while (index>=0) { char c= fullSource.charAt(index--); if (Character.isWhitespace(c)) { break; } sb.insert(0, c); } String inspected = sb.toString(); if (inspected.startsWith(getPrefix())) { return inspected; } return null; } AsciidocReferenceExistingTextCalculator(String prefix); String resolveReferenceTextOrNull(String fullSource, int posBeforeCtrlSpace); String getPrefix(); }
AsciidocReferenceExistingTextCalculator { public String resolveReferenceTextOrNull(String fullSource, int posBeforeCtrlSpace) { int index = posBeforeCtrlSpace-1; if (fullSource.length()<=index) { index = fullSource.length()-1; } StringBuilder sb = new StringBuilder(); while (index>=0) { char c= fullSource.charAt(index--); if (Character.isWhitespace(c)) { break; } sb.insert(0, c); } String inspected = sb.toString(); if (inspected.startsWith(getPrefix())) { return inspected; } return null; } AsciidocReferenceExistingTextCalculator(String prefix); String resolveReferenceTextOrNull(String fullSource, int posBeforeCtrlSpace); String getPrefix();  }