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
38
38
* - Adds the deprecated status to ktx sections in _toc.yaml files
39
39
* - Fixes broken hyperlinks in `@see` blocks
40
40
* - Removes the prefix path from book_path
41
+ * - Removes the `com.google` package prefix from _toc.yaml files
41
42
*
42
43
* **Please note:** This task is idempotent- meaning it can safely be ran multiple times on the same
43
44
* set of files.
@@ -77,10 +78,35 @@ abstract class FiresiteTransformTask : DefaultTask() {
77
78
}
78
79
79
80
private fun File.fixYamlFile () {
80
- val fixedContent = readText().removeClassHeader().removeIndexHeader().addDeprecatedStatus()
81
+ val fixedContent =
82
+ readText().removeClassHeader().removeIndexHeader().addDeprecatedStatus().removePackagePrefix()
81
83
writeText(fixedContent)
82
84
}
83
85
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
+
84
110
/* *
85
111
* Fixes broken hyperlinks in the rendered HTML
86
112
*
You can’t perform that action at this time.
0 commit comments