Compare commits

..

No commits in common. "77dade1d1dbdd819ce5b7e0d71950c0eda69acf4" and "0ba5799c75fa66ff38665360b2cb9bce225b9af8" have entirely different histories.

8 changed files with 78 additions and 1 deletions

View File

@ -44,6 +44,9 @@ defaultContentLanguage = 'en'
languageCode = "en-us"
[params]
bergamotJsUrl = "https://static.danilafe.com/bergamot/bergamot.js"
bergamotObjectLanguageJsUrl = "https://static.danilafe.com/bergamot/objectlang.js"
katexJsUrl = "https://static.danilafe.com/katex/katex.min.js"
plausibleAnalyticsDomain = "danilafe.com"
githubUsername = "DanilaFe"
siteSourceUrl = "https://dev.danilafe.com/Web-Projects/blog-static/src/branch/master"

View 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>

View File

@ -0,0 +1,10 @@
<script>
window.addEventListener('load', function() {
window.Bergamot.presets['{{ .Get "name" }}'] = {
rules: '{{ .Inner }}',
inputPrompt: '{{ .Get "prompt" }}',
query: '{{ .Get "query" }}',
renderPreset: '{{ default "default" (.Get "rendering") }}'
};
});
</script>

View File

@ -0,0 +1,3 @@
<script>
window.Bergamot.renderPresets['{{ .Get "name" }}'] = '{{ .Inner }}';
</script>

View File

@ -0,0 +1,6 @@
<div id="{{ .Get "id" }}"></div>
<script>
window.addEventListener('load', function() {
window.Bergamot.run(null, '{{ .Get "id" }}', '{{ .Get "prompt" }}', '{{ .Inner }}', '{{ default "default" (.Get "rendering") }}', '{{ .Get "query" }}');
});
</script>

View File

@ -0,0 +1,34 @@
<script defer src="{{ .Site.Params.katexJsUrl }}" crossorigin="anonymous"></script>
<script defer>
class KatexExpressionShim extends HTMLElement {
static observedAttributes = ["expression", "katex-options"];
targetSpan;
constructor() {
super();
}
doRender() {
if (!this.targetSpan) return;
const options = this.hasAttribute("katex-options") ?
this.getAttribute("katex-options") : {};
katex.render(
this.getAttribute("expression"),
this.targetSpan,
JSON.parse(options)
);
}
connectedCallback() {
this.targetSpan = document.createElement('span');
this.appendChild(this.targetSpan);
this.doRender();
}
attributeChangedCallback(name, oldValue, newValue) {
this.doRender();
}
}
customElements.define("katex-expression", KatexExpressionShim);
</script>

@ -1 +1 @@
Subproject commit dde3fb61aec70675a84b196dc437cb68783b5550
Subproject commit 84278b2e91c9bcfcc08b34c08daa355e7c8f336a