Skip to content

Commit

Permalink
Use relative path as execution name (when possible)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcphilipp committed Dec 7, 2024
1 parent 1d0d175 commit 0b2c819
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,21 @@ private List<Execution> extractData(List<Path> xmlFiles, Path htmlFile) throws E

for (Path xmlFile : xmlFiles) {
var rootElement = parseDom(xmlFile);
var name = String.format(xmlFile.getFileName().toString());
var name = String.format(tryRelativize(htmlFile, xmlFile).toString());
executions.add(
extractData(idGenerator, rootElement, name, element -> new DefaultContext(element, xmlFile, htmlFile)));
}
return executions;
}

private static Path tryRelativize(Path htmlFile, Path xmlFile) {
try {
return htmlFile.getParent().relativize(xmlFile);
} catch (IllegalArgumentException e) {
return xmlFile;
}
}

private static void appendScriptTag(List<Execution> executions, String indent, BufferedWriter out)
throws IOException {
out.append(indent).append("<script>");
Expand Down

0 comments on commit 0b2c819

Please sign in to comment.