internal/components/optionDetail.templ (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | package components
import "go.alanpearce.eu/searchix/internal/nix"
templ OptionDetail(option nix.Option) {
<h2>{ option.Name }</h2>
@markdown(option.Description)
<dl>
if option.Type != "" {
<dt>Type</dt>
<dd><code>{ option.Type }</code></dd>
}
if option.Default != nil {
if option.Default.Text != "" || option.Default.Markdown != "" {
<dt>Default</dt>
<dd>
if option.Default.Markdown != "" {
@markdown(option.Default.Markdown)
} else {
<pre><code>{ option.Default.Text }</code></pre>
}
</dd>
}
}
if option.Example != nil {
if option.Example.Text != "" || option.Example.Markdown != "" {
<dt>Example</dt>
<dd>
if option.Example.Markdown != "" {
@markdown(option.Example.Markdown)
} else {
<pre><code>{ option.Example.Text }</code></pre>
}
</dd>
}
}
if option.RelatedPackages != "" {
<dt>Related Packages</dt>
<dd>
@markdown(option.RelatedPackages)
</dd>
}
if len(option.Declarations) > 0 {
<dt>Declared</dt>
for _, d := range option.Declarations {
<dd>
<a href={ templ.SafeURL(d.URL) }>{ d.Name }</a>
</dd>
}
}
</dl>
}
templ OptionDetailPage(tdata TemplateData, option nix.Option) {
@Page(tdata) {
@OptionDetail(option)
}
}
|