diff --git a/buildSrc/src/main/java/com/google/firebase/gradle/plugins/FiresiteTransformTask.kt b/buildSrc/src/main/java/com/google/firebase/gradle/plugins/FiresiteTransformTask.kt
index b889a140798..e648f6cfa1a 100644
--- a/buildSrc/src/main/java/com/google/firebase/gradle/plugins/FiresiteTransformTask.kt
+++ b/buildSrc/src/main/java/com/google/firebase/gradle/plugins/FiresiteTransformTask.kt
@@ -21,6 +21,7 @@ import org.gradle.api.tasks.TaskAction
* - Deletes unnecessary files
* - Removes Class and Index headers from _toc.yaml files
* - Changes links to be appropriate for Firesite versus normal Devsite behavior
+ * - Fixes broken hyperlinks in `@see` blocks
* - Removes the prefix path from book_path
* - Removes the google groupId for Javadocs
* - Changes the path for _reference-head-tags at the top of html files
@@ -73,7 +74,7 @@ abstract class FiresiteTransformTask : DefaultTask() {
}
private fun File.fixHTMLFile() {
- val fixedContent = readText().fixBookPath().fixReferenceHeadTagsPath().fixLinks()
+ val fixedContent = readText().fixBookPath().fixReferenceHeadTagsPath().fixLinks().fixHyperlinksInSeeBlocks()
writeText(fixedContent)
}
@@ -92,16 +93,48 @@ abstract class FiresiteTransformTask : DefaultTask() {
* groupId. This makes the output look weird, as not all SDKs line up. So this method exists
* to correct Javadoc nav files, so that they align with internally generated docs.
*
+ * Example input:
+ * ```
+ * "com.google.firebase.appcheck"
+ * ```
* Example output:
* ```
- * removeGoogleGroupId("com.google.firebase.appcheck")
- * --> "firebase.appcheck"
+ * "firebase.appcheck"
* ```
*/
// TODO(b/257293594): Remove when dackka exposes configuration for this
private fun String.removeGoogleGroupId() =
remove(Regex("(?<=\")com.google.(?=firebase.)"))
+ /**
+ * Fixes broken hyperlinks in the rendered HTML
+ *
+ * Links in Dockka are currently broken in `@see` tags. This transform destructures those
+ * broken links and reconstructs them as they're expected to be.
+ *
+ * Example input:
+ * ```
+ * // Generated from @see TimestampThe ref timestamp definition
+ * <a href="git.page.link/timestamp-proto">Timestamp</a>The ref timestamp definition
+ *
Timestamp
+ * <a href="(?.*)">(?.*)</a>(?.*)
\\s*$link
+