@Test public void computeResourcePath() { assertEquals("styles/main.css", markupToEclipseHelp.computeResourcePath("styles/main.css", "")); assertEquals("../styles/main.css", markupToEclipseHelp.computeResourcePath("styles/main.css", "one")); assertEquals("../../styles/main.css", markupToEclipseHelp.computeResourcePath("styles/main.css", "one/two")); assertEquals("/styles/main.css", markupToEclipseHelp.computeResourcePath("/styles/main.css", "prefix")); assertEquals("http: markupToEclipseHelp.computeResourcePath("http: }
protected String computeResourcePath(String resourcePath, String relativePath) { if (resourcePath.startsWith("/") || isAbsoluteUri(resourcePath)) { return resourcePath; } String path = resourcePath; String prefix = relativePath.replaceAll("[^\\\\/]+", "..").replace('\\', '/'); if (prefix.length() > 0) { if (!resourcePath.startsWith("/")) { prefix += '/'; } path = prefix + resourcePath; } return path; }
MarkupToEclipseHelpMojo extends AbstractMojo { protected String computeResourcePath(String resourcePath, String relativePath) { if (resourcePath.startsWith("/") || isAbsoluteUri(resourcePath)) { return resourcePath; } String path = resourcePath; String prefix = relativePath.replaceAll("[^\\\\/]+", "..").replace('\\', '/'); if (prefix.length() > 0) { if (!resourcePath.startsWith("/")) { prefix += '/'; } path = prefix + resourcePath; } return path; } }
MarkupToEclipseHelpMojo extends AbstractMojo { protected String computeResourcePath(String resourcePath, String relativePath) { if (resourcePath.startsWith("/") || isAbsoluteUri(resourcePath)) { return resourcePath; } String path = resourcePath; String prefix = relativePath.replaceAll("[^\\\\/]+", "..").replace('\\', '/'); if (prefix.length() > 0) { if (!resourcePath.startsWith("/")) { prefix += '/'; } path = prefix + resourcePath; } return path; }  }
MarkupToEclipseHelpMojo extends AbstractMojo { protected String computeResourcePath(String resourcePath, String relativePath) { if (resourcePath.startsWith("/") || isAbsoluteUri(resourcePath)) { return resourcePath; } String path = resourcePath; String prefix = relativePath.replaceAll("[^\\\\/]+", "..").replace('\\', '/'); if (prefix.length() > 0) { if (!resourcePath.startsWith("/")) { prefix += '/'; } path = prefix + resourcePath; } return path; }  void execute(); }
MarkupToEclipseHelpMojo extends AbstractMojo { protected String computeResourcePath(String resourcePath, String relativePath) { if (resourcePath.startsWith("/") || isAbsoluteUri(resourcePath)) { return resourcePath; } String path = resourcePath; String prefix = relativePath.replaceAll("[^\\\\/]+", "..").replace('\\', '/'); if (prefix.length() > 0) { if (!resourcePath.startsWith("/")) { prefix += '/'; } path = prefix + resourcePath; } return path; }  void execute();  }