8227416: Add a "Table Of Contents" to HTML version of man pages
Reviewed-by: mchung
diff --git a/make/Docs.gmk b/make/Docs.gmk
index 3c28fe1..b0618ce 100644
--- a/make/Docs.gmk
+++ b/make/Docs.gmk
@@ -626,7 +626,7 @@
FILTER := $(PANDOC_HTML_MANPAGE_FILTER), \
CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
REPLACEMENTS := @@VERSION_SHORT@@ => $(VERSION_SHORT), \
- OPTIONS := -V include-before='$(SPECS_TOP)' -V include-after='$(SPECS_BOTTOM_1)', \
+ OPTIONS := --toc -V include-before='$(SPECS_TOP)' -V include-after='$(SPECS_BOTTOM_1)', \
POST_PROCESS := $(TOOL_FIXUPPANDOC), \
EXTRA_DEPS := $(PANDOC_HTML_MANPAGE_FILTER) \
$(PANDOC_HTML_MANPAGE_FILTER_JAVASCRIPT), \
diff --git a/make/data/docs-resources/resources/jdk-default.css b/make/data/docs-resources/resources/jdk-default.css
index 2a0dbcd..0db25df 100644
--- a/make/data/docs-resources/resources/jdk-default.css
+++ b/make/data/docs-resources/resources/jdk-default.css
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -162,3 +162,22 @@
font-style: italic;
font-size: 80%;
}
+
+nav#TOC {
+ border: 1px solid gray;
+ border-radius: 10px;
+ padding: 5px 10px;
+ margin-bottom: 15px;
+}
+
+nav#TOC ul ul {
+ font-size:smaller;
+}
+
+nav#TOC ul ul li {
+ display: inline-block
+}
+
+nav#TOC ul ul li::before {
+ content: " \2022 "
+}
diff --git a/make/jdk/src/classes/build/tools/fixuppandoc/Main.java b/make/jdk/src/classes/build/tools/fixuppandoc/Main.java
index 9159fd8..c790f0f 100644
--- a/make/jdk/src/classes/build/tools/fixuppandoc/Main.java
+++ b/make/jdk/src/classes/build/tools/fixuppandoc/Main.java
@@ -81,6 +81,10 @@
*
* Update the content string, to indicate it has been processed by this program.
*
+ * <h2>{@code <nav id="TOC">}</h2>
+ *
+ * Set attribute {@code title="Table Of Contents"}
+ *
*/
public class Main {
/**
@@ -273,6 +277,11 @@
}
// <main> is not permitted within these elements
allowMain = false;
+ if (name.equals("nav") && Objects.equals(attrs.get("id"), "TOC")) {
+ out.write(buffer.toString()
+ .replaceAll(">$", " title=\"Table Of Contents\">"));
+ buffer.setLength(0);
+ }
break;
case "body":