2
0
Fork 0
mirror of https://github.com/bazel-contrib/bazel-lib synced 2024-11-30 01:41:21 +00:00
bazel-lib/docs/templates/rule_html.vm

38 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

#**
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