pulumi/pkg/codegen/docs/templates/utils.tmpl

20 lines
1.9 KiB
Cheetah

<!-- linkify_param is used to wrap constructor/function params in an anchor tag. -->
{{ define "linkify_param" }}<span class="nx">{{ if ne .Link "" }}<a href="{{ .Link }}">{{ end }}{{ if ne .DisplayName "" }}{{ .DisplayName }}{{ else }}{{ .Name }}{{ end }}{{ if ne .Link "" }}</a>{{ end }}</span>{{ end }}
<!-- linkify_go_param is used to wrap constructor/function params in an anchor tag specifically for go constructors. We are treating this as a snowflake for now. -->
{{ define "linkify_go_param" }}<span class="nx">{{ if ne .Link "" }}<a href="{{ .Link }}">{{ end }}New{{ if ne .DisplayName "" }}{{ .DisplayName }}{{ else }}{{ .Name }}{{ end }}{{ if ne .Link "" }}</a>{{ end }}</span>{{ end }}
<!-- linkify wraps any propertyType instance in an anchor tag. The display name/name is rendered as-is by passing it through the htmlSafe function
to avoid double-encoding html characters, which is typical of properties type names. -->
{{ define "linkify" }}<a href="{{ .Link }}">{{ if ne .DisplayName "" }}{{ htmlSafe .DisplayName }}{{ else }}{{ htmlSafe .Name }}{{ end }}</a>{{ end }}
<!-- linkify_constructor_args is like linkify, but will display the DescriptionName if it's present -->
{{ define "linkify_constructor_args" }}<a href="{{ .Link }}">{{ if ne .DescriptionName "" }}{{ htmlSafe .DescriptionName }}{{ else if ne .DisplayName "" }}{{ htmlSafe .DisplayName }}{{ else }}{{ htmlSafe .Name }}{{ end }}</a>{{ end }}
<!-- linkify_wo_style an wraps a propertyType with an anchor tag but retains parent styling. The display name/name is rendered as-is by
passing it through the htmlSafe function
to avoid double-encoding html characters, which is typical of properties type names. -->
{{ define "linkify_wo_style" }}
<a data-swiftype-name="resource-property" data-swiftype-type="text" href="{{ .Link }}" style="color: inherit; text-decoration: inherit;">{{ if ne .DisplayName "" }}{{ htmlSafe .DisplayName }}{{ else }}{{ htmlSafe .Name }}{{ end }}</a>
{{ end }}