type.tpl 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. {{ define "type" }}
  2. <h3 id="{{ anchorIDForType . }}">
  3. {{- .Name.Name }}
  4. {{ if eq .Kind "Alias" }}(<code>{{.Underlying}}</code> alias)</p>{{ end -}}
  5. </h3>
  6. {{ with (typeReferences .) }}
  7. <p>
  8. (<em>Appears on:</em>
  9. {{- $prev := "" -}}
  10. {{- range . -}}
  11. {{- if $prev -}}, {{ end -}}
  12. {{ $prev = . }}
  13. <a href="{{ linkForType . }}">{{ typeDisplayName . }}</a>
  14. {{- end -}}
  15. )
  16. </p>
  17. {{ end }}
  18. <p>
  19. {{ safe (renderComments .CommentLines) }}
  20. </p>
  21. {{ with (constantsOfType .) }}
  22. <table>
  23. <thead>
  24. <tr>
  25. <th>Value</th>
  26. <th>Description</th>
  27. </tr>
  28. </thead>
  29. <tbody>
  30. {{- range . -}}
  31. <tr>
  32. {{- /* renderComments implicitly creates a <p> element, so we do the
  33. same here to make the value line up nicely. */ -}}
  34. <td><p>{{ typeDisplayName . }}</p></td>
  35. <td>{{ safe (renderComments .CommentLines) }}</td>
  36. </tr>
  37. {{- end -}}
  38. </tbody>
  39. </table>
  40. {{ end }}
  41. {{ if .Members }}
  42. <table>
  43. <thead>
  44. <tr>
  45. <th>Field</th>
  46. <th>Description</th>
  47. </tr>
  48. </thead>
  49. <tbody>
  50. {{ if isExportedType . }}
  51. <tr>
  52. <td>
  53. <code>apiVersion</code></br>
  54. string</td>
  55. <td>
  56. <code>
  57. {{apiGroup .}}
  58. </code>
  59. </td>
  60. </tr>
  61. <tr>
  62. <td>
  63. <code>kind</code></br>
  64. string
  65. </td>
  66. <td><code>{{.Name.Name}}</code></td>
  67. </tr>
  68. {{ end }}
  69. {{ template "members" .}}
  70. </tbody>
  71. </table>
  72. {{ end }}
  73. {{ end }}