Add syntax for referencing docs in other rule families.
This CL implements a new `${link rule.attribute}` syntax which can be used to
reference the documentation of rules and attributes of other rule families. For
example, `${link cc_library.deps}` will generate a link to the documentation for
the `deps` attribute of the `cc_library` rule. Similarly, this syntax can also
be used to reference sections of static documentation, for example
`${link common-definitions.label-expansion}`.
--
MOS_MIGRATED_REVID=115492361
diff --git a/src/main/java/com/google/devtools/build/docgen/DocgenConsts.java b/src/main/java/com/google/devtools/build/docgen/DocgenConsts.java
index c0e2639..d50a299 100644
--- a/src/main/java/com/google/devtools/build/docgen/DocgenConsts.java
+++ b/src/main/java/com/google/devtools/build/docgen/DocgenConsts.java
@@ -93,6 +93,16 @@
}
/**
+ * Reference to another rule or Build Encyclopedia section.
+ *
+ * <p>The format of a link reference is rule.attribute (e.g. cc_library.deps). In the case of
+ * static pages such as common definitions the format is page.heading
+ * (e.g. common-definitions.label-expansion).
+ */
+ public static final Pattern BLAZE_RULE_LINK = Pattern.compile(
+ "\\$\\{link (([a-z_-]+)(\\.([a-z_-]+))?)\\}");
+
+ /**
* i.e. <!-- #BLAZE_RULE(NAME = RULE_NAME, TYPE = RULE_TYPE, FAMILY = RULE_FAMILY) -->
* i.e. <!-- #BLAZE_RULE(...)[DEPRECATED] -->
*/