Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for row and column span; propagate rendering error information to the output #1097

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -20,13 +20,11 @@
import java.util.Arrays;
import java.util.Deque;
import java.util.List;
import java.util.StringJoiner;
import java.util.stream.Collectors;

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,9 +45,22 @@ 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) {
return errors.stream()
.map(RenderingException::cascadeMessages)
.collect(Collectors.joining());
}

private static String cascadeMessages(Throwable error){
StringJoiner result = new StringJoiner(System.lineSeparator());
while (error != null) {
result.add(error.getMessage());
error = error.getCause();
}
return result.toString();
}

/**
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