2
0
Fork 0
mirror of https://github.com/bazel-contrib/bazel-lib synced 2024-11-28 21:33:48 +00:00
bazel-lib/docs/templates/rule_html.vm
Alex Eagle 1df2becc7a chore: turn on more basic precommit checks
In particular this makes our bazelrc presets more compliant with client codebases, ensuring they can copy these files and not trip on their own pre-commit check
2023-02-17 11:00:00 -08:00

38 lines
1.3 KiB
Plaintext

#**
This rule template is used for rendering HTML in attribute table cells
*#
#*
Workaround for markdownCellFormat() not allowing HTML (specifically lists) to be rendered in attribute table cells.
TODO: Once https://github.com/bazelbuild/bazel/pull/14230 is merged, remove this macro and replace with call to
util.markdownCellFormatWithHtml($attribute.docString, true)
*#
#macro( markdownCellFormatNoEscapeHtml $docString )#*
*##if ($docString.contains("<ul>") || $docString.contains("<ol>"))#*
*#${docString.trim().replaceAll("\n(\\s*\n)+", "<br><br>").replaceAll("\n", " ")}#*
*##else#*
*#${util.markdownCellFormat($docString)}#*
*##end#*
*##end
<a id="#${ruleName}"></a>
#[[##]]# ${ruleName}
<pre>
${util.ruleSummary($ruleName, $ruleInfo)}
</pre>
${ruleInfo.docString}
#[[###]]# **Attributes**
#if (!$ruleInfo.getAttributeList().isEmpty())
| Name | Description | Type | Mandatory | Default |
| :------------- | :------------- | :------------- | :------------- | :------------- |
#foreach ($attribute in $ruleInfo.getAttributeList())
| <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 |
#end
#end