src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Tue Sep 18 21:46:17 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Wed Sep 19 12:14:53 2018 +0530
@@ -29,6 +29,7 @@
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import java.util.*;
+import java.util.function.Supplier;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -2105,4 +2106,20 @@
Script getMainBodyScript() {
return mainBodyScript;
}
+
+ /**
+ * Creates the HTML tag if the tag is supported by this specific HTML version
+ * otherwise return the Content instance provided by Supplier ifNotSupported.
+ * @param tag the HTML tag
+ * @param ifSupported create this instance if HTML tag is supported
+ * @param ifNotSupported create this instance if HTML tag is not supported
+ * @return
+ */
+ protected Content createTagIfAllowed(HtmlTag tag, Supplier<Content> ifSupported, Supplier<Content> ifNotSupported) {
+ if (configuration.allowTag(tag)) {
+ return ifSupported.get();
+ } else {
+ return ifNotSupported.get();
+ }
+ }
}