This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new 9e342cae4b ISIS-3071: dom ready utility: java-doc
9e342cae4b is described below
commit 9e342cae4bd4dadb9645f178aff2d590406c3c68
Author: Andi Huber <[email protected]>
AuthorDate: Sat Nov 12 06:22:02 2022 +0100
ISIS-3071: dom ready utility: java-doc
---
.../viewer/wicket/ui/util/OnDomReadyHeaderContributor.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git
a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/util/OnDomReadyHeaderContributor.java
b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/util/OnDomReadyHeaderContributor.java
index 0c9419afca..f8e9d367d1 100644
---
a/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/util/OnDomReadyHeaderContributor.java
+++
b/viewers/wicket/ui/src/main/java/org/apache/causeway/viewer/wicket/ui/util/OnDomReadyHeaderContributor.java
@@ -25,6 +25,7 @@ import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
import org.apache.wicket.markup.html.IHeaderContributor;
+import org.apache.causeway.commons.internal.base._Strings;
import org.apache.causeway.commons.internal.base._Text;
import lombok.NonNull;
@@ -37,18 +38,26 @@ implements IHeaderContributor {
// -- FACTORIES
+ /**
+ * Reading JS from source, it skips 18 license header lines
+ * and any single line comments as well as empty lines.
+ * @apiNote that could be done by the yui-compressor maven plugin as well,
+ * but at the time of writing did not look into it
+ */
public static OnDomReadyHeaderContributor forScriptReference(
final @NonNull Class<?> resourceLocation,
final @NonNull String resourceName) {
return new
OnDomReadyHeaderContributor(readJsResource(resourceLocation, resourceName));
}
+ /** skips 18 license header lines and any single line comments as well as
empty lines */
@SneakyThrows
private static String readJsResource(
final @NonNull Class<?> resourceLocation,
final @NonNull String resourceName) {
return _Text.readLinesFromResource(
resourceLocation, resourceName, StandardCharsets.UTF_8)
+ .filter(_Strings::isNotEmpty)
.filter(line->!line.trim().startsWith("//"))
.stream()
.skip(18) // skip license header