Move all bergamot partials and shortcodes into theme
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
parent
378a6f2ae1
commit
dde3fb61ae
17
layouts/partials/bergamotparseinputmodes.js
Normal file
17
layouts/partials/bergamotparseinputmodes.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
{{ if . }}
|
||||||
|
{{ range $name := split . ";" }}
|
||||||
|
{{ if eq $name "query" }}
|
||||||
|
"Query": "query",
|
||||||
|
{{ else }}
|
||||||
|
{{ $pieces := split $name ":" }}
|
||||||
|
{{ $name := index $pieces 0 }}
|
||||||
|
{{ $modestring := index $pieces 1 }}
|
||||||
|
"{{ $name }}": { "custom": "{{ $modestring }}" },
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ else }}
|
||||||
|
"Languge Term": { "custom": "Bergamot Object Language" },
|
||||||
|
"Query": "query",
|
||||||
|
{{ end }}
|
||||||
|
}
|
21
layouts/shortcodes/bergamot_exercise.html
Normal file
21
layouts/shortcodes/bergamot_exercise.html
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<div class="bergamot-exercise">
|
||||||
|
<details open>
|
||||||
|
<summary>
|
||||||
|
<span class="bergamot-exercise-label">
|
||||||
|
<span class="bergamot-exercise-number"></span>
|
||||||
|
{{ if or (eq (.Get "label") "") (eq (.Get "label") nil) }}{{ else }}({{ .Get "label" }}){{ end }}:
|
||||||
|
</span>
|
||||||
|
</summary>
|
||||||
|
{{ transform.Markdownify .Inner }}
|
||||||
|
|
||||||
|
<div class="bergamot-button-group">
|
||||||
|
{{ if or (eq (.Get "preset") "") (eq (.Get "preset") nil) }}
|
||||||
|
{{ else }}
|
||||||
|
<button class="bergamot-button bergamot-play" onclick='window.Bergamot.runPreset(this.parentElement, "bergamot-widget-container-{{ .Get "id" }}", "{{ .Get "preset" }}")'>{{ partial "icon.html" "play" }}Start Bergamot</button>
|
||||||
|
<button class="bergamot-button bergamot-close bergamot-hidden" onclick='window.Bergamot.close(this.parentElement, "bergamot-widget-container-{{ .Get "id" }}")'>{{ partial "icon.html" "x" }}Close Bergamot</button>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="bergamot-widget-container-{{ .Get "id" }}"></div>
|
||||||
|
</details>
|
||||||
|
</div>
|
8
layouts/shortcodes/bergamot_widget.html
Normal file
8
layouts/shortcodes/bergamot_widget.html
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<div id="{{ .Get "id" }}"></div>
|
||||||
|
<script>
|
||||||
|
window.addEventListener('load', function() {
|
||||||
|
window.Bergamot.run(null, '{{ .Get "id" }}',
|
||||||
|
{{ partial "bergamotparseinputmodes.js" (.Get "modes") | safeJS }},
|
||||||
|
'{{ .Get "prompt" }}', '{{ .Inner }}', '{{ default "default" (.Get "rendering") }}', '{{ .Get "query" }}');
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Reference in New Issue
Block a user