File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed
plugins/src/main/java/com/google/firebase/gradle/plugins Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ import org.gradle.api.tasks.TaskAction
3838 * - Adds the deprecated status to ktx sections in _toc.yaml files
3939 * - Fixes broken hyperlinks in `@see` blocks
4040 * - Removes the prefix path from book_path
41+ * - Removes the `com.google` package prefix from _toc.yaml files
4142 *
4243 * **Please note:** This task is idempotent- meaning it can safely be ran multiple times on the same
4344 * set of files.
@@ -77,10 +78,35 @@ abstract class FiresiteTransformTask : DefaultTask() {
7778 }
7879
7980 private fun File.fixYamlFile () {
80- val fixedContent = readText().removeClassHeader().removeIndexHeader().addDeprecatedStatus()
81+ val fixedContent =
82+ readText().removeClassHeader().removeIndexHeader().addDeprecatedStatus().removePackagePrefix()
8183 writeText(fixedContent)
8284 }
8385
86+ /* *
87+ * Removes the `com.google.` prefix from the package titles in the table of contents.
88+ *
89+ * The prefix pollutes the TOC, especially on smaller screen sizes; so we opt to removed it
90+ * entirely.
91+ *
92+ * Example input:
93+ * ```
94+ * toc:
95+ * - title: "com.google.firebase.functions"
96+ * path: "/docs/reference/android/com/google/firebase/functions/package-summary.html"
97+ * ```
98+ *
99+ * Example output:
100+ * ```
101+ * toc:
102+ * - title: "firebase.functions"
103+ * path: "/docs/reference/android/com/google/firebase/functions/package-summary.html"
104+ * ```
105+ *
106+ * TODO(b/378717454): Migrate to the param packagePrefixToRemoveInToc in dackka when fixed
107+ */
108+ private fun String.removePackagePrefix () = remove(Regex (" (?<=title: \" )(com\\ .google\\ .)" ))
109+
84110 /* *
85111 * Fixes broken hyperlinks in the rendered HTML
86112 *
You can’t perform that action at this time.
0 commit comments