Skip to content

Commit 2c286bc

Browse files
authored
Merge branch 'main' into premake
2 parents dd503ec + 4b4357b commit 2c286bc

File tree

17 files changed

+468
-0
lines changed

17 files changed

+468
-0
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,6 +1386,9 @@
13861386
[submodule "vendor/grammars/vscode-go"]
13871387
path = vendor/grammars/vscode-go
13881388
url = https://github.com/golang/vscode-go
1389+
[submodule "vendor/grammars/vscode-go-template"]
1390+
path = vendor/grammars/vscode-go-template
1391+
url = https://github.com/jinliming2/vscode-go-template.git
13891392
[submodule "vendor/grammars/vscode-hack"]
13901393
path = vendor/grammars/vscode-hack
13911394
url = https://github.com/slackhq/vscode-hack

grammars.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,12 @@ vendor/grammars/vscode-gleam:
12301230
vendor/grammars/vscode-go:
12311231
- go.mod
12321232
- go.sum
1233+
vendor/grammars/vscode-go-template:
1234+
- source.go-template
1235+
- source.go.injection.double.go-template
1236+
- source.go.injection.raw.go-template
1237+
- text.injection.go-template
1238+
- text.markdown.go-template.codeblock
12331239
vendor/grammars/vscode-hack:
12341240
- markdown.hack.codeblock
12351241
- source.hack

lib/linguist/heuristics.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,12 @@ disambiguations:
870870
pattern: '^## |@no-lib-strip@'
871871
- language: TeX
872872
pattern: '^\\(contentsline|defcounter|beamer|boolfalse)'
873+
- extensions: ['.tpl']
874+
rules:
875+
- language: Go Template
876+
pattern: '\{\{-?\s*(\`?\"\\?\"?|\/\*\s|\w*)\b'
877+
- language: Smarty
878+
pattern: '(?<!\{)\{(\*\s|\$|\/)?\w*\b'
873879
- extensions: ['.ts']
874880
rules:
875881
- language: XML

lib/linguist/languages.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2736,6 +2736,22 @@ Go Module:
27362736
tm_scope: go.mod
27372737
ace_mode: text
27382738
language_id: 947461016
2739+
Go Template:
2740+
type: markup
2741+
color: "#00ADD8"
2742+
aliases:
2743+
- gotmpl
2744+
extensions:
2745+
- ".gohtml"
2746+
- ".gotmpl"
2747+
- ".html.tmpl"
2748+
- ".tmpl"
2749+
- ".tpl"
2750+
filenames:
2751+
- _helpers.tpl
2752+
tm_scope: source.go-template
2753+
ace_mode: text
2754+
language_id: 247918769
27392755
Go Workspace:
27402756
type: data
27412757
color: "#00ADD8"

samples/Go Template/_helpers.tpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{- /* Generate basic labels */ -}}
2+
{{- define "mychart.labels" }}
3+
labels:
4+
generator: helm
5+
date: {{ now | htmlDate }}
6+
chart: {{ .Chart.Name }}
7+
version: {{ .Chart.Version }}
8+
{{- end }}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{{- /* https://github.com/redhat-cop/helm-charts/blob/main/_templates.gotmpl */ -}}
2+
3+
{{ define "doc.header" -}}
4+
5+
{{ template "chart.header" . }}
6+
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7+
8+
{{ template "chart.versionBadge" . }}
9+
10+
{{ template "chart.deprecationWarning" . }}
11+
12+
## Description
13+
14+
{{ template "chart.description" . }}
15+
16+
{{- end }}
17+
18+
{{ define "doc.maintainer_and_sources" -}}
19+
20+
{{ template "chart.maintainersSection" . }}
21+
22+
## Sources
23+
Source: {{ template "chart.sourcesList" . }}
24+
25+
Source code: {{ template "chart.homepage" . }}
26+
27+
{{- end }}
28+
29+
30+
{{ define "doc.deps" -}}
31+
32+
## Dependencies
33+
34+
This chart has the following dependencies:
35+
36+
{{ template "chart.requirementsTable" . }}
37+
38+
{{- end }}
39+
40+
{{ define "doc.values" -}}
41+
42+
{{ template "chart.valuesSection" . }}
43+
44+
{{- end }}
45+
46+
47+
{{ define "doc.footer" -}}
48+
49+
## Installing the Chart
50+
51+
To install the chart with the release name `my-release`:
52+
53+
```console
54+
helm install my-release repo/<chart-name>>
55+
```
56+
57+
The command deploys the chart on the Kubernetes cluster in the default configuration.
58+
59+
## Uninstalling the Chart
60+
61+
To uninstall/delete the my-release deployment:
62+
63+
```console
64+
helm delete my-release
65+
```
66+
67+
The command removes all the Kubernetes components associated with the chart and deletes the release.
68+
69+
{{ template "helm-docs.versionFooter" . }}
70+
71+
{{- end }}

samples/Go Template/base.tpl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{{ /* Example from https://github.com/go-echarts/go-echarts/blob/master/templates/base.tpl */ }}
2+
{{- define "base_element" -}}
3+
<div class="container">
4+
<div class="item" id="{{ .ChartID }}" style="width:{{ .Initialization.Width }};height:{{ .Initialization.Height }};"></div>
5+
</div>
6+
{{- end -}}
7+
8+
{{- define "base_script" -}}
9+
<script type="text/javascript">
10+
"use strict";
11+
let goecharts_{{ .ChartID | safeJS }} = echarts.init(document.getElementById('{{ .ChartID | safeJS }}'), "{{ .Theme }}", { renderer: "{{ .Initialization.Renderer }}" });
12+
let option_{{ .ChartID | safeJS }} = {{ template "base_option" . }}
13+
goecharts_{{ .ChartID | safeJS }}.setOption(option_{{ .ChartID | safeJS }});
14+
15+
{{- range $listener := .EventListeners }}
16+
{{if .Query }}
17+
goecharts_{{ $.ChartID | safeJS }}.on({{ $listener.EventName }}, {{ $listener.Query | safeJS }}, {{ injectInstance $listener.Handler "%MY_ECHARTS%" $.ChartID | safeJS }});
18+
{{ else }}
19+
goecharts_{{ $.ChartID | safeJS }}.on({{ $listener.EventName }}, {{ injectInstance $listener.Handler "%MY_ECHARTS%" $.ChartID | safeJS }})
20+
{{ end }}
21+
{{- end }}
22+
23+
{{- range .JSFunctions.Fns }}
24+
{{ injectInstance . "%MY_ECHARTS%" $.ChartID | safeJS }}
25+
{{- end }}
26+
</script>
27+
{{- end -}}
28+
29+
{{- define "base_option" }}
30+
{{- .JSONNotEscaped | safeJS }}
31+
{{- end }};
32+
33+
{{- define "base" }}
34+
{{- template "base_element" . }}
35+
{{- template "base_script" . }}
36+
{{- end }}

samples/Go Template/batch.gohtml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{{- /* https://github.com/ncruces/RethinkRAW/blob/master/assets/batch.gohtml */ -}}
2+
<!doctype html>
3+
<html lang=en>
4+
5+
<head>
6+
<meta charset="utf-8">
7+
<title>RethinkRAW: Batch processing {{len .Photos}} photos</title>
8+
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials">
9+
<link rel="shortcut icon" href="/favicon.ico">
10+
<link rel="stylesheet" href="/main.css">
11+
<link rel="stylesheet" href="/batch.css">
12+
<link rel="stylesheet" href="/raw-editor.css">
13+
<link rel="stylesheet" href="/dialog-polyfill.css">
14+
<link rel="preload" as="style" href="/normalize.css">
15+
<link rel="preload" as="style" href="/fontawesome.css">
16+
<link rel="preload" as="font" type="font/woff2" crossorigin href="/fa-solid-900.woff2">
17+
<script src="/dialog-polyfill.js" defer></script>
18+
<script src="/main.js" defer></script>
19+
<script src="/batch.js" defer></script>
20+
<script src="/raw-editor.js" defer></script>
21+
<noscript><meta http-equiv="refresh" content="0;url=/browser.html"></noscript>
22+
</head>
23+
24+
<body>
25+
{{- template "raw-editor.gohtml" "hidden"}}
26+
27+
<div id=menu-sticker>
28+
<div id=menu>
29+
<div class="toolbar">
30+
<button type=button title="Go back" class="minimal-ui" onclick="back()"><i class="fas fa-arrow-left"></i></button>
31+
<button type=button title="Reload photos" class="minimal-ui" onclick="location.reload()"><i class="fas fa-sync"></i></button>
32+
<button type=button title="S̲ave changes" accesskey="s" onclick="saveFile()" id=save disabled><i class="fas fa-save"></i></button>
33+
{{- if .Export}}
34+
<button type=button title="Ex̲port JPEGs (⌥-click for options)" accesskey="x" class="alt-off" onclick="exportFile()"><i class="fas fa-file-image"></i></button>
35+
<button type=button title="Export…" class="alt-on" onclick="exportFile('dialog')"><i class="fas fa-file-download"></i></button>
36+
{{- end}}
37+
<button type=button title="Edit photos…" onclick="toggleEdit()" id=edit><i class="fas fa-sliders-h"></i></button>
38+
</div>
39+
</div>
40+
</div>
41+
<div id=gallery>
42+
{{- range .Photos}}
43+
<a href="/photo/{{.Path}}" onclick="return popup(this, event)">
44+
<img loading=lazy title="{{.Name}}" alt="{{.Name}}" src="/thumb/{{.Path}}" onerror="parentNode.hidden=true">
45+
</a>
46+
{{- else}}
47+
<span>No RAW photos here.</span>
48+
{{- end}}
49+
</div>
50+
51+
<dialog id=progress-dialog>
52+
Lorem ipsum<br>
53+
<progress></progress>
54+
</dialog>
55+
</body>
56+
57+
</html>

samples/Go Template/crd.tmpl

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{{- /* https://github.com/grafana/k6-operator/blob/main/docs/crd.tmpl */ -}}
2+
---
3+
title: {{or .Metadata.Title "API Reference"}}
4+
weight: {{or .Metadata.Weight 1 }}
5+
{{- if .Metadata.Description}}
6+
description: {{.Metadata.Description}}
7+
{{- end}}
8+
---
9+
10+
11+
Packages:
12+
{{range .Groups}}
13+
- [{{.Group}}/{{.Version}}](#{{ anchorize (printf "%s/%s" .Group .Version) }})
14+
{{- end -}}{{/* range .Groups */}}
15+
16+
{{- range .Groups }}
17+
{{- $group := . }}
18+
19+
# {{.Group}}/{{.Version}}
20+
21+
Resource Types:
22+
{{range .Kinds}}
23+
- [{{.Name}}](#{{ anchorize .Name }})
24+
{{end}}{{/* range .Kinds */}}
25+
26+
{{range .Kinds}}
27+
{{$kind := .}}
28+
## {{.Name}}
29+
<sup><sup>[↩ Parent](#{{ anchorize (printf "%s/%s" $group.Group $group.Version) }} )</sup></sup>
30+
31+
{{range .Types}}
32+
33+
{{if not .IsTopLevel}}
34+
### {{.Name}}
35+
{{if .ParentKey}}<sup><sup>[↩ Parent](#{{.ParentKey}})</sup></sup>{{end}}
36+
{{end}}
37+
38+
39+
{{.Description}}
40+
41+
<table>
42+
<thead>
43+
<tr>
44+
<th>Name</th>
45+
<th>Type</th>
46+
<th>Description</th>
47+
<th>Required</th>
48+
</tr>
49+
</thead>
50+
<tbody>
51+
{{- if .IsTopLevel -}}
52+
<tr>
53+
<td><b>apiVersion</b></td>
54+
<td>string</td>
55+
<td>{{$group.Group}}/{{$group.Version}}</td>
56+
<td>true</td>
57+
</tr>
58+
<tr>
59+
<td><b>kind</b></td>
60+
<td>string</td>
61+
<td>{{$kind.Name}}</td>
62+
<td>true</td>
63+
</tr>
64+
<tr>
65+
<td><b><a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#objectmeta-v1-meta">metadata</a></b></td>
66+
<td>object</td>
67+
<td>Refer to the Kubernetes API documentation for the fields of the `metadata` field.</td>
68+
<td>true</td>
69+
</tr>
70+
{{- end -}}
71+
{{- range .Fields -}}
72+
<tr>
73+
<td><b>{{if .TypeKey}}<a href="#{{.TypeKey}}">{{.Name}}</a>{{else}}{{.Name}}{{end}}</b></td>
74+
<td>{{.Type}}</td>
75+
<td>
76+
{{.Description}}<br/>
77+
{{- if or .Schema.XValidations .Schema.Format .Schema.Enum .Schema.Default .Schema.Minimum .Schema.Maximum }}
78+
<br/>
79+
{{- end}}
80+
{{- if .Schema.XValidations }}
81+
<i>Validations</i>:
82+
{{- range .Schema.XValidations -}}
83+
<li>{{ .Rule }}: {{ .Message }}</li>
84+
{{- end -}}
85+
{{- end }}
86+
{{- if .Schema.Format }}
87+
<i>Format</i>: {{ .Schema.Format }}<br/>
88+
{{- end }}
89+
{{- if .Schema.Enum }}
90+
<i>Enum</i>: {{ .Schema.Enum | toStrings | join ", " }}<br/>
91+
{{- end }}
92+
{{- if .Schema.Default }}
93+
<i>Default</i>: {{ .Schema.Default }}<br/>
94+
{{- end }}
95+
{{- if .Schema.Minimum }}
96+
<i>Minimum</i>: {{ .Schema.Minimum }}<br/>
97+
{{- end }}
98+
{{- if .Schema.Maximum }}
99+
<i>Maximum</i>: {{ .Schema.Maximum }}<br/>
100+
{{- end }}
101+
</td>
102+
<td>{{.Required}}</td>
103+
</tr>
104+
{{- end -}}
105+
</tbody>
106+
</table>
107+
108+
{{- end}}{{/* range .Types */}}
109+
{{- end}}{{/* range .Kinds */}}
110+
{{- end}}{{/* range .Groups */}}

samples/Go Template/letter.tmpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Dear {{.Name}},
2+
{{if .Attended}}
3+
It was a pleasure to see you at the wedding.
4+
{{- else}}
5+
It is a shame you couldn't make it to the wedding.
6+
{{- end}}
7+
{{with .Gift -}}
8+
Thank you for the lovely {{.}}.
9+
{{end}}
10+
Best wishes,
11+
Josie

0 commit comments

Comments
 (0)