xref: /aosp_15_r20/external/bazelbuild-rules_go/docs/rule_body.vm (revision 9bb1b549b6a84214c53be0924760be030e66b93a)
1#**
2This template is used for including rule definitions as top-level sections in generated stardoc docstrings.
3*#
4#*
5Workaround for markdownCellFormat() not allowing HTML (specifically lists) to be rendered in attribute table cells.
6
7TODO: Once https://github.com/bazelbuild/bazel/pull/14230 is merged, remove this macro and replace with call to
8      util.markdownCellFormatWithHtml($attribute.docString, true)
9*#
10#macro( markdownCellFormatNoEscapeHtml $docString )#*
11  *##if ($docString.contains("<ul>"))#*
12      *#${docString.trim().replaceAll("\n(\\s*\n)+", "<br><br>").replaceAll("\n", " ")}#*
13  *##else#*
14      *#${util.markdownCellFormat($docString)}#*
15  *##end#*
16*##end
17
18<a id="#${ruleName}"></a>
19
20#[[##]]# ${ruleName}
21
22<pre>
23${util.ruleSummary($ruleName, $ruleInfo)}
24</pre>
25
26${ruleInfo.docString}
27
28#[[###]]# **Attributes**
29
30#if (!$ruleInfo.getAttributeList().isEmpty())
31
32| Name  | Description | Type | Mandatory | Default |
33| :------------- | :------------- | :------------- | :------------- | :------------- |
34#foreach ($attribute in $ruleInfo.getAttributeList())
35| <a id="${ruleName}-${attribute.name}"></a>$attribute.name | #if(!$attribute.docString.isEmpty()) #markdownCellFormatNoEscapeHtml( $attribute.docString ) #else - #end  | ${util.attributeTypeString($attribute)} | ${util.mandatoryString($attribute)} | $attribute.defaultValue |
36#end
37#end
38