Skip to content

Commit

Permalink
Add support for row and column span; propagate rendering error inform…
Browse files Browse the repository at this point in the history
…ation to the output

Signed-off-by: Tim Quinn <[email protected]>
  • Loading branch information
tjquinno committed Jan 7, 2025
1 parent 9603d8a commit 521932e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2022 Oracle and/or its affiliates.
* Copyright (c) 2018, 2025 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,8 @@

package io.helidon.build.maven.sitegen;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
Expand All @@ -24,9 +26,6 @@

import freemarker.template.TemplateException;

import static java.lang.System.lineSeparator;
import static java.util.stream.Collectors.joining;

/**
* An exception to represent any error occurring as part of site processing.
*/
Expand All @@ -47,11 +46,16 @@ public RenderingException(String msg) {
* @param errors exceptions to aggregate
*/
public RenderingException(List<RenderingException> errors) {
this(errors.stream()
.map(Throwable::getMessage)
.collect(joining(lineSeparator())));
this(allErrorInfo(errors));
}

private static String allErrorInfo(List<RenderingException> errors) {
StringWriter sw = new StringWriter();
try (PrintWriter pw = new PrintWriter(sw)) {
errors.forEach(t -> t.printStackTrace(pw));
return sw.toString();
}
}
/**
* Create a new instance.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<#--
Copyright (c) 2018, 2022 Oracle and/or its affiliates.
Copyright (c) 2018, 2025 Oracle and/or its affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -50,8 +50,14 @@ TODO:
<tr>
<#list row.cells as cell>
<#if cell.content?is_enumerable>
<#list cell.content as cellcontent><td class="${cell_classes}">${cellcontent}</td></#list>
<#else><td class="${cell_classes}">${cell.content}</td>
<#list cell.content as cellcontent><td class="${cell_classes}"
<#if cell.rowspan??> rowspan="${cell.rowspan}"</#if>
<#if cell.colspan??> colspan="${cell.colspan}"</#if>
>${cellcontent}</td></#list>
<#else><td class="${cell_classes}"
<#if cell.rowspan??> rowspan="${cell.rowspan}"</#if>
<#if cell.colspan??> colspan="${cell.colspan}"</#if>
>${cell.content}</td>
</#if>
</#list>
</tr>
Expand Down

0 comments on commit 521932e

Please sign in to comment.