add Package Index and Class Index files to each library's root path
(instead of at the reference/ root location), and add links to
these files in the left nav.
stage:
http://smain.mtv.corp.google.com:8080/reference/android/support/constraint/classes.html
Note: This depends on some style changes to enable highlighting these
new pages in the left nav: https://critique.corp.google.com/#review/147165269
TODO: Cleanupa all these 'wearableSupportPath' style hard-coded paths
and instead pass those paths as a doclava argument.
Change-Id: I13b4b441b46055551d36f0729de9b91ec98a0496
diff --git a/res/assets/templates-sdk/yaml_navtree.cs b/res/assets/templates-sdk/yaml_navtree.cs
index e5a6404..25b3fa6 100644
--- a/res/assets/templates-sdk/yaml_navtree.cs
+++ b/res/assets/templates-sdk/yaml_navtree.cs
@@ -5,6 +5,14 @@
?>
reference:<?cs
+if:docs.packages.link ?>
+- title: Class Index
+ path: /<?cs var:docs.classes.link ?>
+ status_text: no-toggle
+- title: Package Index
+ path: /<?cs var:docs.packages.link ?>
+ status_text: no-toggle<?cs
+/if ?><?cs
each:page = docs.pages?><?cs
if:page.type == "package"?>
- title: <?cs var:page.label ?>
diff --git a/res/assets/templates/index.cs b/res/assets/templates/index.cs
index 15a6a59..1a48e38 100644
--- a/res/assets/templates/index.cs
+++ b/res/assets/templates/index.cs
@@ -1,6 +1,6 @@
<html>
<head>
-<meta http-equiv="refresh" content="0;url=packages.html">
+<meta http-equiv="refresh" content="0;url=classes.html">
</head>
<body>
<?cs include:"analytics.cs" ?>
diff --git a/src/com/google/doclava/Doclava.java b/src/com/google/doclava/Doclava.java
index a43ca62..6929f21 100644
--- a/src/com/google/doclava/Doclava.java
+++ b/src/com/google/doclava/Doclava.java
@@ -445,7 +445,7 @@
}
// Packages Pages
- writePackages(javadocDir + refPrefix + "packages" + htmlExtension);
+ writePackages(refPrefix + "packages" + htmlExtension);
// Classes
writeClassLists();
@@ -459,9 +459,6 @@
writeKeepList(keepListFile);
}
- // Index page
- writeIndex();
-
Proofread.finishProofread(proofreadFile);
if (sdkValuePath != null) {
@@ -492,9 +489,9 @@
return !Errors.hadError;
}
- private static void writeIndex() {
+ private static void writeIndex(String dir) {
Data data = makeHDF();
- ClearPage.write(data, "index.cs", javadocDir + "index" + htmlExtension);
+ ClearPage.write(data, "index.cs", dir + "index" + htmlExtension);
}
private static boolean readTemplateSettings() {
@@ -1332,8 +1329,20 @@
TagInfo.makeHDF(data, "root.descr", Converter.convertTags(root.inlineTags(), null));
- ClearPage.write(data, "packages.cs", filename);
- ClearPage.write(data, "package-list.cs", javadocDir + "package-list");
+ String packageDir = javadocDir;
+ if (USE_DEVSITE_LOCALE_OUTPUT_PATHS) {
+ if (testSupportRef) {
+ packageDir = packageDir + testSupportPath;
+ } else if (wearableSupportRef) {
+ packageDir = packageDir + wearableSupportPath;
+ } else if (androidSupportRef) {
+ packageDir = packageDir + androidSupportPath;
+ } else if (constraintSupportRef) {
+ packageDir = packageDir + constraintSupportPath;
+ }
+ }
+ ClearPage.write(data, "packages.cs", packageDir + filename);
+ ClearPage.write(data, "package-list.cs", packageDir + "package-list");
Proofread.writePackages(filename, Converter.convertTags(root.inlineTags(), null));
}
@@ -1415,8 +1424,24 @@
cl.makeShortDescrHDF(data, "docs.classes." + first + '.' + i);
}
+ String packageDir = javadocDir;
+ if (USE_DEVSITE_LOCALE_OUTPUT_PATHS) {
+ if (testSupportRef) {
+ packageDir = packageDir + testSupportPath;
+ } else if (wearableSupportRef) {
+ packageDir = packageDir + wearableSupportPath;
+ } else if (androidSupportRef) {
+ packageDir = packageDir + androidSupportPath;
+ } else if (constraintSupportRef) {
+ packageDir = packageDir + constraintSupportPath;
+ }
+ }
+
setPageTitle(data, "Class Index");
- ClearPage.write(data, "classes.cs", javadocDir + "classes" + htmlExtension);
+ ClearPage.write(data, "classes.cs", packageDir + "classes" + htmlExtension);
+
+ // Index page redirects to the classes.html page, so use the same directory
+ writeIndex(packageDir);
}
// we use the word keywords because "index" means something else in html land
diff --git a/src/com/google/doclava/NavTree.java b/src/com/google/doclava/NavTree.java
index 2b230d0..cebb247 100644
--- a/src/com/google/doclava/NavTree.java
+++ b/src/com/google/doclava/NavTree.java
@@ -92,6 +92,7 @@
}
data = makeYamlHDF(sorted, "docs.pages", data);
+
if ((Doclava.USE_DEVSITE_LOCALE_OUTPUT_PATHS) && (Doclava.testSupportRef)) {
dir = Doclava.ensureSlash(dir) + Doclava.testSupportPath;
} else if ((Doclava.USE_DEVSITE_LOCALE_OUTPUT_PATHS) && (Doclava.wearableSupportRef)) {
@@ -101,6 +102,10 @@
} else if ((Doclava.USE_DEVSITE_LOCALE_OUTPUT_PATHS) && (Doclava.constraintSupportRef)) {
dir = Doclava.ensureSlash(dir) + Doclava.constraintSupportPath;
}
+
+ data.setValue("docs.classes.link", Doclava.ensureSlash(dir) + "classes.html");
+ data.setValue("docs.packages.link", Doclava.ensureSlash(dir) + "packages.html");
+
ClearPage.write(data, "yaml_navtree.cs", Doclava.ensureSlash(dir) + fileName);
}
@@ -133,6 +138,7 @@
i++;
}
+
return data;
}