datalog-theme 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +37 -0
- data/CITATION.cff +2 -2
- data/README.md +1 -1
- data/_data/i18n/en.yml +28 -0
- data/_data/i18n/es.yml +28 -0
- data/_data/i18n/pt.yml +28 -0
- data/_includes/components/api-function.html +1 -1
- data/_includes/components/breadcrumbs.html +6 -6
- data/_includes/components/enhanced-toc.html +3 -119
- data/_includes/components/package-install.html +76 -163
- data/_includes/components/social-share.html +10 -10
- data/_includes/footer/nav-column.html +5 -2
- data/_includes/footer.html +5 -5
- data/_includes/header/navigation.html +11 -2
- data/_includes/header.html +8 -8
- data/_includes/scripts.html +2 -1
- data/_layouts/package.html +9 -7
- data/_plugins/i18n.rb +15 -1
- data/_plugins/js_manifest_filter.rb +35 -0
- data/_sass/_package-docs.scss +57 -31
- data/assets/js/dist/core.js +1 -1
- data/assets/js/dist/math.js +1 -1
- data/assets/js/dist/sources.json +5 -3
- data/lib/datalog/cli.rb +17 -8
- data/lib/datalog/slug.rb +38 -0
- data/lib/datalog/theme/version.rb +1 -1
- metadata +4 -3
- data/_includes/components/search-facets.html +0 -307
data/_sass/_package-docs.scss
CHANGED
|
@@ -5,9 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
@use 'sass:color';
|
|
7
7
|
@use 'mixins' as *;
|
|
8
|
+
@use 'variables' as *;
|
|
8
9
|
|
|
9
10
|
// Color scheme - ReadTheDocs inspired
|
|
10
11
|
$pkg-primary: #2980b9;
|
|
12
|
+
// $pkg-primary is a brand colour for borders, gradients and rules. As text it
|
|
13
|
+
// reads at 4.08:1 on the panel, short of WCAG AA, and a single darker value
|
|
14
|
+
// would fail again on a dark surface — so text uses the theme's own accent and
|
|
15
|
+
// secondary inks, which _theme.scss defines for each mode.
|
|
16
|
+
$pkg-primary-text: var(--color-accent-text);
|
|
17
|
+
$pkg-muted-text: var(--color-text-secondary);
|
|
11
18
|
$pkg-success: #27ae60;
|
|
12
19
|
$pkg-warning: #f39c12;
|
|
13
20
|
$pkg-danger: #e74c3c;
|
|
@@ -15,8 +22,26 @@ $pkg-sidebar-bg: #343131;
|
|
|
15
22
|
$pkg-sidebar-text: #b3b3b3;
|
|
16
23
|
$pkg-sidebar-link: #9b9b9b;
|
|
17
24
|
$pkg-sidebar-link-hover: #fff;
|
|
18
|
-
$pkg-code-bg:
|
|
19
|
-
$pkg-border:
|
|
25
|
+
$pkg-code-bg: var(--color-background-secondary);
|
|
26
|
+
$pkg-border: var(--color-border);
|
|
27
|
+
|
|
28
|
+
// The tinted panels: a background and the ink that reads on it, for each
|
|
29
|
+
// mode. _theme.scss has no tokens for these, so they are defined here.
|
|
30
|
+
:root {
|
|
31
|
+
--pkg-tint-note: #e7f2fa;
|
|
32
|
+
--pkg-tint-tip: #dbf5e8;
|
|
33
|
+
--pkg-tint-warning: #fff3cd;
|
|
34
|
+
--pkg-tint-danger: #f8d7da;
|
|
35
|
+
--pkg-tint-ink: #{$color-ink-900};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
body.dark-mode {
|
|
39
|
+
--pkg-tint-note: #{rgba($dark-accent-primary, 0.16)};
|
|
40
|
+
--pkg-tint-tip: #{rgba($dark-accent-secondary, 0.16)};
|
|
41
|
+
--pkg-tint-warning: #{rgba($dark-warning, 0.16)};
|
|
42
|
+
--pkg-tint-danger: #{rgba($dark-danger-400, 0.22)};
|
|
43
|
+
--pkg-tint-ink: #{$dark-ink-900};
|
|
44
|
+
}
|
|
20
45
|
|
|
21
46
|
// Package Docs Container
|
|
22
47
|
.package-docs {
|
|
@@ -126,7 +151,7 @@ $pkg-border: #e1e4e5;
|
|
|
126
151
|
&__main {
|
|
127
152
|
flex: 1;
|
|
128
153
|
padding: 2rem 3rem;
|
|
129
|
-
background:
|
|
154
|
+
background: var(--color-surface);
|
|
130
155
|
min-width: 0;
|
|
131
156
|
}
|
|
132
157
|
|
|
@@ -179,7 +204,7 @@ $pkg-border: #e1e4e5;
|
|
|
179
204
|
}
|
|
180
205
|
|
|
181
206
|
pre {
|
|
182
|
-
background:
|
|
207
|
+
background: var(--color-background-secondary);
|
|
183
208
|
border: 1px solid $pkg-border;
|
|
184
209
|
border-radius: 4px;
|
|
185
210
|
padding: 1rem;
|
|
@@ -201,24 +226,30 @@ $pkg-border: #e1e4e5;
|
|
|
201
226
|
border-left: 4px solid;
|
|
202
227
|
border-radius: 4px;
|
|
203
228
|
|
|
229
|
+
// Tinted panels keep their own ink, so the tint and the text stay a
|
|
230
|
+
// pair whichever way the page is set.
|
|
204
231
|
&.note {
|
|
205
|
-
background:
|
|
232
|
+
background: var(--pkg-tint-note);
|
|
206
233
|
border-color: $pkg-primary;
|
|
234
|
+
color: var(--pkg-tint-ink);
|
|
207
235
|
}
|
|
208
236
|
|
|
209
237
|
&.tip {
|
|
210
|
-
background:
|
|
238
|
+
background: var(--pkg-tint-tip);
|
|
211
239
|
border-color: $pkg-success;
|
|
240
|
+
color: var(--pkg-tint-ink);
|
|
212
241
|
}
|
|
213
242
|
|
|
214
243
|
&.warning {
|
|
215
|
-
background:
|
|
244
|
+
background: var(--pkg-tint-warning);
|
|
216
245
|
border-color: $pkg-warning;
|
|
246
|
+
color: var(--pkg-tint-ink);
|
|
217
247
|
}
|
|
218
248
|
|
|
219
249
|
&.danger {
|
|
220
|
-
background:
|
|
250
|
+
background: var(--pkg-tint-danger);
|
|
221
251
|
border-color: $pkg-danger;
|
|
252
|
+
color: var(--pkg-tint-ink);
|
|
222
253
|
}
|
|
223
254
|
|
|
224
255
|
.admonition-title {
|
|
@@ -242,7 +273,7 @@ $pkg-border: #e1e4e5;
|
|
|
242
273
|
align-items: center;
|
|
243
274
|
gap: 1rem;
|
|
244
275
|
padding: 1rem;
|
|
245
|
-
background:
|
|
276
|
+
background: var(--color-background-secondary);
|
|
246
277
|
border: 1px solid $pkg-border;
|
|
247
278
|
border-radius: 6px;
|
|
248
279
|
text-decoration: none;
|
|
@@ -251,7 +282,7 @@ $pkg-border: #e1e4e5;
|
|
|
251
282
|
flex: 1;
|
|
252
283
|
|
|
253
284
|
&:hover {
|
|
254
|
-
background:
|
|
285
|
+
background: var(--color-border);
|
|
255
286
|
border-color: $pkg-primary;
|
|
256
287
|
}
|
|
257
288
|
|
|
@@ -273,14 +304,14 @@ $pkg-border: #e1e4e5;
|
|
|
273
304
|
|
|
274
305
|
&__footer-nav-label {
|
|
275
306
|
font-size: 0.8125rem;
|
|
276
|
-
color:
|
|
307
|
+
color: var(--color-text-secondary);
|
|
277
308
|
text-transform: uppercase;
|
|
278
309
|
letter-spacing: 0.05em;
|
|
279
310
|
}
|
|
280
311
|
|
|
281
312
|
&__footer-nav-title {
|
|
282
313
|
font-weight: 600;
|
|
283
|
-
color:
|
|
314
|
+
color: var(--color-text-primary);
|
|
284
315
|
}
|
|
285
316
|
}
|
|
286
317
|
|
|
@@ -368,7 +399,7 @@ $pkg-border: #e1e4e5;
|
|
|
368
399
|
.package-install {
|
|
369
400
|
margin: 2rem 0;
|
|
370
401
|
padding: 1.5rem;
|
|
371
|
-
background:
|
|
402
|
+
background: var(--color-background-secondary);
|
|
372
403
|
border: 1px solid $pkg-border;
|
|
373
404
|
border-radius: 6px;
|
|
374
405
|
|
|
@@ -393,15 +424,15 @@ $pkg-border: #e1e4e5;
|
|
|
393
424
|
margin-bottom: -2px;
|
|
394
425
|
cursor: pointer;
|
|
395
426
|
font-weight: 500;
|
|
396
|
-
color:
|
|
427
|
+
color: $pkg-muted-text;
|
|
397
428
|
transition: all 0.2s ease;
|
|
398
429
|
|
|
399
430
|
&:hover {
|
|
400
|
-
color: $pkg-primary;
|
|
431
|
+
color: $pkg-primary-text;
|
|
401
432
|
}
|
|
402
433
|
|
|
403
434
|
&--active {
|
|
404
|
-
color: $pkg-primary;
|
|
435
|
+
color: $pkg-primary-text;
|
|
405
436
|
border-bottom-color: $pkg-primary;
|
|
406
437
|
}
|
|
407
438
|
}
|
|
@@ -469,7 +500,7 @@ $pkg-border: #e1e4e5;
|
|
|
469
500
|
.api-function {
|
|
470
501
|
margin: 2rem 0;
|
|
471
502
|
padding: 1.5rem;
|
|
472
|
-
background:
|
|
503
|
+
background: var(--color-background-secondary);
|
|
473
504
|
border: 1px solid $pkg-border;
|
|
474
505
|
border-left: 4px solid $pkg-primary;
|
|
475
506
|
border-radius: 4px;
|
|
@@ -481,7 +512,7 @@ $pkg-border: #e1e4e5;
|
|
|
481
512
|
&__name {
|
|
482
513
|
margin: 0 0 0.75rem;
|
|
483
514
|
font-size: 1.5rem;
|
|
484
|
-
color: $pkg-primary;
|
|
515
|
+
color: $pkg-primary-text;
|
|
485
516
|
|
|
486
517
|
code {
|
|
487
518
|
background: none;
|
|
@@ -519,7 +550,7 @@ $pkg-border: #e1e4e5;
|
|
|
519
550
|
margin: 0 0 0.75rem;
|
|
520
551
|
font-size: 1.125rem;
|
|
521
552
|
font-weight: 600;
|
|
522
|
-
color:
|
|
553
|
+
color: var(--color-text-primary);
|
|
523
554
|
}
|
|
524
555
|
|
|
525
556
|
&__params {
|
|
@@ -550,7 +581,7 @@ $pkg-border: #e1e4e5;
|
|
|
550
581
|
|
|
551
582
|
&__param-type {
|
|
552
583
|
font-size: 0.875rem;
|
|
553
|
-
color:
|
|
584
|
+
color: var(--color-text-secondary);
|
|
554
585
|
font-style: italic;
|
|
555
586
|
font-weight: normal;
|
|
556
587
|
}
|
|
@@ -564,18 +595,18 @@ $pkg-border: #e1e4e5;
|
|
|
564
595
|
&__param-badge {
|
|
565
596
|
display: inline-block;
|
|
566
597
|
padding: 0.125rem 0.5rem;
|
|
567
|
-
background:
|
|
598
|
+
background: var(--color-border);
|
|
568
599
|
border-radius: 3px;
|
|
569
600
|
font-size: 0.75rem;
|
|
570
601
|
font-weight: 500;
|
|
571
602
|
text-transform: uppercase;
|
|
572
|
-
color:
|
|
603
|
+
color: var(--color-text-secondary);
|
|
573
604
|
}
|
|
574
605
|
|
|
575
606
|
&__param-desc {
|
|
576
607
|
margin: 0;
|
|
577
608
|
padding-left: 1rem;
|
|
578
|
-
color:
|
|
609
|
+
color: var(--color-text-primary);
|
|
579
610
|
line-height: 1.6;
|
|
580
611
|
|
|
581
612
|
p:last-child {
|
|
@@ -585,16 +616,16 @@ $pkg-border: #e1e4e5;
|
|
|
585
616
|
|
|
586
617
|
&__returns {
|
|
587
618
|
padding: 1rem;
|
|
588
|
-
background:
|
|
619
|
+
background: var(--color-surface);
|
|
589
620
|
border-radius: 4px;
|
|
590
621
|
}
|
|
591
622
|
|
|
592
623
|
&__return-type {
|
|
593
624
|
display: inline-block;
|
|
594
625
|
padding: 0.25rem 0.625rem;
|
|
595
|
-
background:
|
|
626
|
+
background: var(--pkg-tint-note);
|
|
596
627
|
border-radius: 3px;
|
|
597
|
-
color:
|
|
628
|
+
color: var(--pkg-tint-ink);
|
|
598
629
|
font-weight: 600;
|
|
599
630
|
font-size: 0.9375rem;
|
|
600
631
|
margin-bottom: 0.5rem;
|
|
@@ -602,12 +633,7 @@ $pkg-border: #e1e4e5;
|
|
|
602
633
|
|
|
603
634
|
&__examples {
|
|
604
635
|
pre {
|
|
605
|
-
background: #2d2d2d;
|
|
606
636
|
border: none;
|
|
607
|
-
|
|
608
|
-
code {
|
|
609
|
-
color: #e6e6e6;
|
|
610
|
-
}
|
|
611
637
|
}
|
|
612
638
|
}
|
|
613
639
|
|
data/assets/js/dist/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as p}from"./chunks/chunk-PATLC23F.js";var _="[data-copy-citation], [data-copy-bibliography]";var g=!1;function G(t){let e=t.getAttribute("data-target"),n=e?document.getElementById(e):null;return n?"value"in n?n.value:n.textContent||"":""}async function O(t){let e=G(t);if(!(!e||!navigator.clipboard||!navigator.clipboard.writeText)){t.dataset.originalText===void 0&&(t.dataset.originalText=t.textContent);try{await navigator.clipboard.writeText(e),t.dataset.copied="true",t.textContent="Copied!",setTimeout(()=>{t.dataset.copied="false",t.textContent=t.dataset.originalText},2e3)}catch(n){t.dataset.copied="error",t.textContent="Error"}}}function h(){g||(g=!0,document.addEventListener("click",t=>{let e=t.target instanceof Element?t.target.closest(_):null;e&&O(e)}))}var y="datalog-color-mode",l="dark-mode";function b(){try{return localStorage.getItem(y)}catch(t){return null}}function $(t){try{localStorage.setItem(y,t)}catch(e){}}function q(t){let e=b();return e==="dark"?!0:e==="light"?!1:t.matches}function E(){let t=document.querySelector("[data-toggle-dark-mode]"),e=document.body,n=window.matchMedia("(prefers-color-scheme: dark)");q(n)&&e.classList.add(l);let r=()=>{let a=e.classList.contains(l)?"dark":"light";e.dataset.theme=a,document.documentElement.dataset.theme=a},o=()=>{r(),t&&t.setAttribute("aria-pressed",e.classList.contains(l))};o(),t&&t.addEventListener("click",()=>{let a=e.classList.toggle(l);t.setAttribute("aria-pressed",String(a)),$(a?"dark":"light"),r()}),n.addEventListener("change",a=>{b()||(a.matches?e.classList.add(l):e.classList.remove(l),o())})}var H="datalog-github-";var S=Symbol("recently-failed");function f(t,e){return`${H}${t}-${e}`}function K(t,e,n){try{let r=localStorage.getItem(f(t,e));if(!r)return null;let o=JSON.parse(r);if(!o||typeof o!="object")return null;let a=o.failed?6e5:n;return Date.now()-o.timestamp>a?(localStorage.removeItem(f(t,e)),null):o.failed?S:o.data}catch(r){return null}}function L(t,e,n){try{localStorage.setItem(f(t,e),JSON.stringify(p({timestamp:Date.now()},n)))}catch(r){}}async function M(t,e,n,r){let o=K(t,e,r);if(o===S)return null;if(o)return o;try{let a=await fetch(`${n}/${t}/${e}`);if(!a.ok)throw new Error(`GitHub API error: ${a.status}`);let s=await a.json();return L(t,e,{data:s}),s}catch(a){return L(t,e,{failed:!0}),null}}function B(t,e){t.querySelectorAll("[data-github-stat]").forEach(r=>{let o=r.getAttribute("data-github-stat");if(!o)return;let a=e[o];typeof a=="number"?r.textContent=a.toLocaleString():typeof a=="string"&&a.length>0&&(r.textContent=a)})}function F(t){t.dataset.githubState="error";let e=t.getAttribute("data-github-unavailable");e&&t.querySelectorAll("[data-github-stat]").forEach(n=>{n.textContent=e})}function v(){let t=document.querySelectorAll("[data-github-owner][data-github-repo]");if(!t.length)return Promise.resolve();let n=(window.DatalogIntegrations||{}).github||{};if(n.enabled===!1)return Promise.resolve();let r=n.api_base||"https://api.github.com/repos",o=Number(n.cache_ttl||43200)*1e3,a=Array.from(t).map(s=>{let u=s.getAttribute("data-github-owner"),d=s.getAttribute("data-github-repo");return!u||!d?Promise.resolve():(s.dataset.githubState="loading",M(u,d,r,o).then(i=>{if(!i){F(s);return}B(s,i),s.dataset.githubState="ready"}))});return Promise.all(a)}var z="[data-language-filter], [data-navigate-on-change]";function U(t){if(typeof t!="string")return null;let e=Array.from(t).filter(r=>{let o=r.codePointAt(0);return o>31&&o!==127}).join("").trim();if(!e)return null;let n=/^[a-z][a-z0-9+.-]*:/i.exec(e);return n&&!/^https?:$/i.test(n[0])?null:e}function A(){let t=document.querySelectorAll(z);t.length!==0&&t.forEach(e=>{e.addEventListener("change",n=>{let r=U(n.target&&n.target.value);r&&(window.location.href=r)})})}var V="(min-width: 48rem)",T="#site-nav",k=".nav-toggle",m="nav-open";function w(t){return t.replace(/index\.html$/,"").replace(/\/$/,"")}function j(t){let e=t.getAttribute("href");if(!e)return null;try{let n=new URL(e,window.location.origin);if(!n.hash)return null;let r=new URL(window.location.href);return w(n.pathname)!==w(r.pathname)?null:n.hash.replace("#","")}catch(n){return null}}function Y(t){if(!t)return!1;let e=document.getElementById(t);return e?(e.scrollIntoView({block:"start"}),!0):!1}function x(){let t=document.querySelector(T);if(!t)return;let e=document.querySelector(k),n=document.body,r=window.matchMedia(V),o=i=>{if(i){t.dataset.open="true",n.classList.remove(m),e&&(e.setAttribute("aria-expanded","false"),e.classList.remove("is-active"));return}let c=t.dataset.open==="true";c||(t.dataset.open="false"),e&&(e.setAttribute("aria-expanded",String(c)),e.classList.toggle("is-active",c))},a=({focusToggle:i=!1}={})=>{r.matches||(t.dataset.open="false",n.classList.remove(m),e&&(e.setAttribute("aria-expanded","false"),e.classList.remove("is-active"),i&&e.focus()))},s=()=>{r.matches||(t.dataset.open="true",n.classList.add(m),e&&(e.setAttribute("aria-expanded","true"),e.classList.add("is-active")))},u=()=>{r.matches||(t.dataset.open==="true"?a():s())};r.matches||(t.dataset.open="false"),o(r.matches),r.addEventListener("change",i=>{i.matches?o(!0):(a(),t.dataset.open="false",o(!1))}),t.querySelectorAll(".nav-link").forEach(i=>{let c=j(i);i.addEventListener("click",R=>{r.matches||a(),c&&Y(c)&&R.preventDefault()})}),e&&e.addEventListener("click",()=>{u()}),document.addEventListener("keydown",i=>{i.key==="Escape"&&t.dataset.open==="true"&&a({focusToggle:!0})}),document.addEventListener("click",i=>{if(r.matches||t.dataset.open!=="true")return;let c=i.target;!c||typeof c.closest!="function"||c.closest(T)||e&&c.closest(k)||a()})}function J(t,e){let n=window.pageYOffset||document.documentElement.scrollTop,r=document.documentElement.scrollHeight-window.innerHeight,o=r>0?Math.min(n/r*100,100):0;t.tagName==="PROGRESS"?t.setAttribute("value",String(o)):t.style.setProperty("--progress",`${o}%`),e&&(e.textContent=Math.round(o))}function C(){let t=document.querySelector("[data-scroll-progress]");if(!t)return;let e=document.querySelector("[data-scroll-progress-value]"),n=()=>J(t,e);n(),window.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",n)}function I(t){if(!t)return;let e=t.querySelector("input[type='search']"),n=t.getAttribute("action");e?(e.focus(),e.select()):n&&(window.location.href=n)}function X(t){if(!t)return!1;if(t.isContentEditable)return!0;let e=t.tagName;return e==="INPUT"||e==="TEXTAREA"||e==="SELECT"}function N(){let t=document.querySelector(".site-search");t&&document.addEventListener("keydown",e=>{X(document.activeElement)||(e.key==="/"&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(e.preventDefault(),I(t)),(e.key==="k"||e.key==="K")&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),I(t)))})}function Q(t){if(!t)return;t.getAttribute("tabindex")===null&&(t.setAttribute("tabindex","-1"),t.dataset.skipLinkTempTabindex="true"),t.addEventListener("blur",()=>{t.dataset.skipLinkTempTabindex&&(t.removeAttribute("tabindex"),delete t.dataset.skipLinkTempTabindex)},{once:!0}),t.focus()}function P(){let t=document.querySelectorAll(".skip-link[href^='#']");t.length&&t.forEach(e=>{e.addEventListener("click",n=>{let o=(e.getAttribute("href")||"").slice(1);if(!o)return;let a=document.getElementById(o);a&&(n.preventDefault(),Q(a))})})}var Z=[P,x,E,A,C,N,v,h];function D(t=Z){t.forEach(e=>{try{e()}catch(n){}})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>D()):D();export{D as initializeCore};
|
|
1
|
+
import{a as T}from"./chunks/chunk-PATLC23F.js";var j="[data-copy-citation], [data-copy-bibliography], [data-copy-target]";var v=!1;function J(t){let e=t.getAttribute("data-target"),n=e?document.getElementById(e):null;return n?"value"in n?n.value:n.textContent||"":""}function X(t){let e=document.createElement("textarea");e.value=t,e.setAttribute("aria-hidden","true"),e.setAttribute("readonly","readonly"),e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();let n=!1;try{n=document.execCommand("copy")}catch(r){n=!1}return e.remove(),n}async function Q(t){if(navigator.clipboard&&navigator.clipboard.writeText)try{return await navigator.clipboard.writeText(t),!0}catch(e){}return X(t)}async function Z(t){let e=J(t);if(!e)return;t.dataset.originalText===void 0&&(t.dataset.originalText=t.textContent);let n=await Q(e);t.dataset.copied=n?"true":"error",t.textContent=n?t.dataset.copiedLabel||"Copied!":t.dataset.errorLabel||"Error",n&&setTimeout(()=>{t.dataset.copied="false",t.textContent=t.dataset.originalText},2e3)}function w(){v||(v=!0,document.addEventListener("click",t=>{let e=t.target instanceof Element?t.target.closest(j):null;e&&Z(e)}))}var x="datalog-color-mode",f="dark-mode";function k(){try{return localStorage.getItem(x)}catch(t){return null}}function W(t){try{localStorage.setItem(x,t)}catch(e){}}function tt(t){let e=k();return e==="dark"?!0:e==="light"?!1:t.matches}function I(){let t=document.querySelector("[data-toggle-dark-mode]"),e=document.body,n=window.matchMedia("(prefers-color-scheme: dark)");tt(n)&&e.classList.add(f);let r=()=>{let a=e.classList.contains(f)?"dark":"light";e.dataset.theme=a,document.documentElement.dataset.theme=a},o=()=>{r(),t&&t.setAttribute("aria-pressed",e.classList.contains(f))};o(),t&&t.addEventListener("click",()=>{let a=e.classList.toggle(f);t.setAttribute("aria-pressed",String(a)),W(a?"dark":"light"),r()}),n.addEventListener("change",a=>{k()||(a.matches?e.classList.add(f):e.classList.remove(f),o())})}var et="datalog-github-";var _=Symbol("recently-failed");function E(t,e){return`${et}${t}-${e}`}function nt(t,e,n){try{let r=localStorage.getItem(E(t,e));if(!r)return null;let o=JSON.parse(r);if(!o||typeof o!="object")return null;let a=o.failed?6e5:n;return Date.now()-o.timestamp>a?(localStorage.removeItem(E(t,e)),null):o.failed?_:o.data}catch(r){return null}}function C(t,e,n){try{localStorage.setItem(E(t,e),JSON.stringify(T({timestamp:Date.now()},n)))}catch(r){}}async function rt(t,e,n,r){let o=nt(t,e,r);if(o===_)return null;if(o)return o;try{let a=await fetch(`${n}/${t}/${e}`);if(!a.ok)throw new Error(`GitHub API error: ${a.status}`);let s=await a.json();return C(t,e,{data:s}),s}catch(a){return C(t,e,{failed:!0}),null}}function ot(t,e){t.querySelectorAll("[data-github-stat]").forEach(r=>{let o=r.getAttribute("data-github-stat");if(!o)return;let a=e[o];typeof a=="number"?r.textContent=a.toLocaleString():typeof a=="string"&&a.length>0&&(r.textContent=a)})}function at(t){t.dataset.githubState="error";let e=t.getAttribute("data-github-unavailable");e&&t.querySelectorAll("[data-github-stat]").forEach(n=>{n.textContent=e})}function N(){let t=document.querySelectorAll("[data-github-owner][data-github-repo]");if(!t.length)return Promise.resolve();let n=(window.DatalogIntegrations||{}).github||{};if(n.enabled===!1)return Promise.resolve();let r=n.api_base||"https://api.github.com/repos",o=Number(n.cache_ttl||43200)*1e3,a=Array.from(t).map(s=>{let u=s.getAttribute("data-github-owner"),d=s.getAttribute("data-github-repo");return!u||!d?Promise.resolve():(s.dataset.githubState="loading",rt(u,d,r,o).then(i=>{if(!i){at(s);return}ot(s,i),s.dataset.githubState="ready"}))});return Promise.all(a)}var it={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};function h(t,e,n,r=!1){t.forEach(o=>{let a=o===n;o.setAttribute("aria-selected",a?"true":"false"),o.tabIndex=a?0:-1,o.classList.toggle("package-install__tab-btn--active",a)}),e.forEach(o=>{o.hidden=o.dataset.tabContent!==n.dataset.tab}),r&&n.focus()}function st(t){let e=Array.from(t.querySelectorAll("[data-tab]")),n=Array.from(t.querySelectorAll("[data-tab-content]"));if(e.length===0)return null;let r=e.find(o=>o.getAttribute("aria-selected")==="true")||e[0];return h(e,n,r),e.forEach(o=>{o.addEventListener("click",()=>h(e,n,o)),o.addEventListener("keydown",a=>{if(a.key==="Home"||a.key==="End"){a.preventDefault(),h(e,n,a.key==="Home"?e[0]:e[e.length-1],!0);return}let s=it[a.key];if(!s)return;a.preventDefault();let u=(e.indexOf(o)+s+e.length)%e.length;h(e,n,e[u],!0)})}),{container:t,tabs:e,panels:n}}function D(t=document){return Array.from(t.querySelectorAll("[data-install-tabs]")).map(e=>st(e)).filter(Boolean)}var ct="[data-language-filter], [data-navigate-on-change]";function lt(t){if(typeof t!="string")return null;let e=Array.from(t).filter(r=>{let o=r.codePointAt(0);return o>31&&o!==127}).join("").trim();if(!e)return null;let n=/^[a-z][a-z0-9+.-]*:/i.exec(e);return n&&!/^https?:$/i.test(n[0])?null:e}function R(){let t=document.querySelectorAll(ct);t.length!==0&&t.forEach(e=>{e.addEventListener("change",n=>{let r=lt(n.target&&n.target.value);r&&(window.location.href=r)})})}var ut="(min-width: 48rem)",P="#site-nav",q=".nav-toggle",A="nav-open";function G(t){return t.replace(/index\.html$/,"").replace(/\/$/,"")}function dt(t){let e=t.getAttribute("href");if(!e)return null;try{let n=new URL(e,window.location.origin);if(!n.hash)return null;let r=new URL(window.location.href);return G(n.pathname)!==G(r.pathname)?null:n.hash.replace("#","")}catch(n){return null}}function ft(t){if(!t)return!1;let e=document.getElementById(t);return e?(e.scrollIntoView({block:"start"}),!0):!1}function H(){let t=document.querySelector(P);if(!t)return;let e=document.querySelector(q),n=document.body,r=window.matchMedia(ut),o=i=>{if(i){t.dataset.open="true",n.classList.remove(A),e&&(e.setAttribute("aria-expanded","false"),e.classList.remove("is-active"));return}let l=t.dataset.open==="true";l||(t.dataset.open="false"),e&&(e.setAttribute("aria-expanded",String(l)),e.classList.toggle("is-active",l))},a=({focusToggle:i=!1}={})=>{r.matches||(t.dataset.open="false",n.classList.remove(A),e&&(e.setAttribute("aria-expanded","false"),e.classList.remove("is-active"),i&&e.focus()))},s=()=>{r.matches||(t.dataset.open="true",n.classList.add(A),e&&(e.setAttribute("aria-expanded","true"),e.classList.add("is-active")))},u=()=>{r.matches||(t.dataset.open==="true"?a():s())};r.matches||(t.dataset.open="false"),o(r.matches),r.addEventListener("change",i=>{i.matches?o(!0):(a(),t.dataset.open="false",o(!1))}),t.querySelectorAll(".nav-link").forEach(i=>{let l=dt(i);i.addEventListener("click",p=>{r.matches||a(),l&&ft(l)&&p.preventDefault()})}),e&&e.addEventListener("click",()=>{u()}),document.addEventListener("keydown",i=>{i.key==="Escape"&&t.dataset.open==="true"&&a({focusToggle:!0})}),document.addEventListener("click",i=>{if(r.matches||t.dataset.open!=="true")return;let l=i.target;!l||typeof l.closest!="function"||l.closest(P)||e&&l.closest(q)||a()})}function pt(t,e){let n=window.pageYOffset||document.documentElement.scrollTop,r=document.documentElement.scrollHeight-window.innerHeight,o=r>0?Math.min(n/r*100,100):0;t.tagName==="PROGRESS"?t.setAttribute("value",String(o)):t.style.setProperty("--progress",`${o}%`),e&&(e.textContent=Math.round(o))}function K(){let t=document.querySelector("[data-scroll-progress]");if(!t)return;let e=document.querySelector("[data-scroll-progress-value]"),n=()=>pt(t,e);n(),window.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",n)}function B(t){if(!t)return;let e=t.querySelector("input[type='search']"),n=t.getAttribute("action");e?(e.focus(),e.select()):n&&(window.location.href=n)}function mt(t){if(!t)return!1;if(t.isContentEditable)return!0;let e=t.tagName;return e==="INPUT"||e==="TEXTAREA"||e==="SELECT"}function M(){let t=document.querySelector(".site-search");t&&document.addEventListener("keydown",e=>{mt(document.activeElement)||(e.key==="/"&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(e.preventDefault(),B(t)),(e.key==="k"||e.key==="K")&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),B(t)))})}function gt(t){if(!t)return;t.getAttribute("tabindex")===null&&(t.setAttribute("tabindex","-1"),t.dataset.skipLinkTempTabindex="true"),t.addEventListener("blur",()=>{t.dataset.skipLinkTempTabindex&&(t.removeAttribute("tabindex"),delete t.dataset.skipLinkTempTabindex)},{once:!0}),t.focus()}function F(){let t=document.querySelectorAll(".skip-link[href^='#']");t.length&&t.forEach(e=>{e.addEventListener("click",n=>{let o=(e.getAttribute("href")||"").slice(1);if(!o)return;let a=document.getElementById(o);a&&(n.preventDefault(),gt(a))})})}var ht="is-active",yt=".post-content h2[id], .post-content h3[id], .post-content h4[id]";function Et(t,e=100){let n=null;return t.forEach(r=>{r.getBoundingClientRect().top<=e&&(n=r)}),n}function At(t,e,n){let r=n-e;return r<=0?0:Math.min(100,Math.max(0,Math.floor(t/r*100)))}function bt(t,e={}){let n=t.ownerDocument,r=e.window||n.defaultView,o=Array.from(t.querySelectorAll(".enhanced-toc__content a")),a=t.querySelector("[data-toc-toggle]"),s=t.querySelector(".enhanced-toc__content"),u=t.querySelector("[data-toc-progress]"),d=t.querySelector("[data-progress-percent]"),i=Array.from(n.querySelectorAll(yt)),l=t.parentElement||t,p=null;a&&s&&a.addEventListener("click",()=>{let c=a.getAttribute("aria-expanded")==="true";a.setAttribute("aria-expanded",c?"false":"true"),s.hidden=c,t.classList.toggle("is-collapsed",c)});let Y=()=>{if(i.length===0)return 100;let c=parseFloat(r.getComputedStyle(i[0]).scrollMarginTop);return(Number.isFinite(c)?c:100)+8},z=()=>{let c=Et(i,Y()),L=c?`#${c.id}`:null;o.forEach(g=>{let S=L!==null&&g.getAttribute("href")===L;g.classList.toggle(ht,S),S?g.setAttribute("aria-current","location"):g.removeAttribute("aria-current")})},U=()=>{let c=At(r.scrollY,r.innerHeight,n.documentElement.scrollHeight);c!==p&&(p=c,u&&(u.style.width=`${c}%`),d&&(d.textContent=String(c)))},V=()=>{let c=l.getBoundingClientRect().top+r.scrollY;t.classList.toggle("is-sticky",r.scrollY>c-20)},y=()=>{z(),U(),V()},m=null,b=()=>{m!==null&&r.cancelAnimationFrame(m),m=r.requestAnimationFrame(()=>{m=null,y()})};return i.length>0&&(r.addEventListener("scroll",b,{passive:!0}),r.addEventListener("resize",b,{passive:!0}),y()),{toc:t,update:y,headings:i,links:o}}function O(t=document){return Array.from(t.querySelectorAll("[data-toc-enhanced]")).map(e=>bt(e))}var Lt=[F,H,I,R,K,M,N,w,O,D];function $(t=Lt){t.forEach(e=>{try{e()}catch(n){}})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>$()):$();export{$ as initializeCore};
|
data/assets/js/dist/math.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){let d={init(t){this.MathJax=t,this.displayCounter=0,this.anchorCounter=0,this.equationMap=new Map,this.editor=null,this.editorOpen=!1,this.messageTimeout=null,this.initialized=!0,this.pendingTypeset=[],this.setupEditor(),t.startup.promise.then(()=>{if(this.decorateExisting(t.startup.document.math||[]),this.updateEquationReferences(),this.pendingTypeset.length>0){let e=[...this.pendingTypeset];this.pendingTypeset=[],e.forEach(a=>{this.renderLatex(a.target,a.latex,a.options||{})})}}).catch(e=>{}),document.addEventListener("click",e=>this.handleClick(e)),document.addEventListener("keydown",e=>this.handleKeydown(e))},onPageReady(){this.updateEquationReferences()},decorateExisting(t){!t||t.length===0||(this.displayCounter=0,this.anchorCounter=0,this.equationMap.clear(),t.forEach(e=>{try{this.decorateMathItem(e)}catch(a){}}))},decorateMathItem(t){if(!t||!t.typesetRoot)return;let e=t.typesetRoot,a=t.math||"",n=e.closest("[data-math-alt]")||e,i=this.resolveAltText(n,a);e.dataset.mathLatex=a,e.setAttribute("tabindex","0"),e.setAttribute("role","math"),this.syncAltAttributes(n,e,i),t.display?this.decorateDisplay(e,a):this.decorateInline(e,a),this.exposeReferenceLinks(e)},exposeAllReferenceLinks(t){(t&&typeof t.querySelectorAll=="function"?t:document).querySelectorAll("mjx-container").forEach(a=>this.exposeReferenceLinks(a))},exposeReferenceLinks(t){if(!t||typeof t.querySelectorAll!="function")return;let e=Array.from(t.querySelectorAll("mjx-assistive-mml [href]")),a=t;t.querySelectorAll('[aria-hidden="true"] a[href]').forEach(n=>{n.setAttribute("tabindex","-1");let i=n.getAttribute("href")||"";if(!i.startsWith("#")||n.dataset.mathReferenceExposed==="true")return;n.dataset.mathReferenceExposed="true";let r=e.find(l=>l.getAttribute("href")===i),s=(r&&r.textContent||n.textContent||"").replace(/\s+/g," ").trim(),o=document.createElement("a");o.className="math-reference-link",o.href=i,o.textContent=s?`Equation ${s}`:"Equation",a.insertAdjacentElement("afterend",o),a=o})},decorateInline(t,e){t&&(t.classList.contains("math-expression__inline")||t.classList.add("math-expression__inline"),t.dataset.mathLatexClean=this.cleanLatex(e))},decorateDisplay(t,e){if(!t)return;let n=t.parentElement&&t.parentElement.classList.contains("math-expression")?t.parentElement:null;n||(n=document.createElement("figure"),n.className="math-expression math-expression--display",t.parentNode.insertBefore(n,t),n.appendChild(t));let i=this.extractEquationInfo(e);this.anchorCounter+=1;let r=`eq:auto-${this.anchorCounter}`,s=i.tag||"";i.skipNumber||(this.displayCounter+=1,s||(s=String(this.displayCounter)));let o=s?`(${s})`:"",l=this.buildAnchorId(i.label,r);if(n.dataset.mathLatex=e,n.dataset.mathLatexClean=this.cleanLatex(e),t.dataset.mathAlt&&!n.dataset.mathAlt&&(n.dataset.mathAlt=t.dataset.mathAlt),o?n.dataset.equationNumber=o:n.removeAttribute("data-equation-number"),n.dataset.equationLabel=i.label||"",l){n.id=l;let c=o||i.label||l;if((o||i.label)&&(this.setEquationReference(l,c),i.label&&i.label!==l&&this.setEquationReference(i.label,c,l),i.label&&i.label.startsWith("eq:"))){let h=i.label.replace(/^eq:/,"");this.setEquationReference(h,c,l)}}this.attachNumberBadge(n,o),this.attachToolbar(n)},extractEquationInfo(t){let e=(t||"").trim(),a=e.match(/\\tag\*?\{([^}]*)\}/),n=e.match(/\\label\{([^}]*)\}/),i=/\\notag|\\nonumber/.test(e);return{tag:a?a[1].trim():"",label:n?n[1].trim():"",skipNumber:i}},buildAnchorId(t,e){return t?t.startsWith("eq:")?t:`eq:${t}`:e||""},setEquationReference(t,e,a){if(!t)return;let n=a||t,i=e||t;this.equationMap.set(t,{anchor:n,label:t,number:i}),t.startsWith("eq:")||this.equationMap.set(`eq:${t}`,{anchor:n,label:t,number:i})},attachNumberBadge(t,e){let a=t.querySelector(".math-expression__number"),n=t.querySelector(".math-expression__sr");if(!e){a&&a.remove(),n&&n.remove();return}a||(a=document.createElement("span"),a.className="math-expression__number",a.setAttribute("aria-hidden","true"),t.appendChild(a)),a.textContent=e,n||(n=document.createElement("span"),n.className="visually-hidden math-expression__sr",t.appendChild(n)),n.textContent=`Equation ${e.replace(/[()]/g,"")}`},attachToolbar(t){let e=t.querySelector(".math-expression__toolbar");if(!e){e=document.createElement("div"),e.className="math-expression__toolbar";let a=document.createElement("button");a.type="button",a.className="math-expression__button",a.setAttribute("data-math-copy","true"),a.setAttribute("aria-label","Copy LaTeX code");let n=document.createElement("span");n.setAttribute("aria-hidden","true"),n.textContent="\u29C9";let i=document.createElement("span");i.className="visually-hidden",i.textContent="Copy equation",a.appendChild(n),a.appendChild(i);let r=document.createElement("button");r.type="button",r.className="math-expression__button",r.setAttribute("data-math-edit","true"),r.setAttribute("aria-label","Open equation editor");let s=document.createElement("span");s.setAttribute("aria-hidden","true"),s.textContent="\u270E";let o=document.createElement("span");o.className="visually-hidden",o.textContent="Edit equation",r.appendChild(s),r.appendChild(o);let l=document.createElement("span");l.className="math-expression__message",l.setAttribute("aria-live","polite"),l.hidden=!0,e.appendChild(a),e.appendChild(r),e.appendChild(l),t.appendChild(e)}},handleClick(t){let e=t.target.closest("[data-math-copy]");if(e){t.preventDefault();let s=e.closest(".math-expression"),o=s?s.dataset.mathLatexClean||s.dataset.mathLatex:null;this.copyLatex(o,s);return}let a=t.target.closest("[data-math-edit]");if(a){t.preventDefault();let s=a.closest(".math-expression"),o=s&&s.dataset.mathLatex||"";this.openEditor(o);return}if(t.target.closest("[data-math-editor-close]")){t.preventDefault(),this.closeEditor();return}if(t.target.closest("[data-math-editor-copy]")){t.preventDefault(),this.editor&&this.editor.textarea&&this.copyLatex(this.editor.textarea.value,null,this.editor.status);return}let r=t.target.closest("[data-symbol-insert]");if(r){t.preventDefault();let s=r.getAttribute("data-symbol-insert");this.insertSymbol(s||"")}},handleKeydown(t){let e=document.activeElement,a=e&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable);if((t.ctrlKey||t.metaKey)&&t.altKey&&(t.key==="e"||t.key==="E")){t.preventDefault();let n=a&&e&&e.value||"";this.openEditor(n);return}t.key==="Escape"&&this.editorOpen&&(t.preventDefault(),this.closeEditor())},copyLatex(t,e,a){if(!t)return;let n=r=>{if(a)a.hidden=!1,a.textContent=r,clearTimeout(this.messageTimeout),this.messageTimeout=window.setTimeout(()=>{a.hidden=!0,a.textContent=""},2e3);else if(e){let s=e.querySelector(".math-expression__message");s&&(s.hidden=!1,s.textContent=r,clearTimeout(this.messageTimeout),this.messageTimeout=window.setTimeout(()=>{s.hidden=!0,s.textContent=""},2e3))}},i=()=>{let r=document.createElement("textarea");r.value=t,r.setAttribute("aria-hidden","true"),r.style.position="fixed",r.style.opacity="0",document.body.appendChild(r),r.select();try{document.execCommand("copy"),n("Copied equation")}catch(s){n("Unable to copy")}document.body.removeChild(r)};navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(t).then(()=>n("Copied equation")).catch(()=>i()):i()},setupEditor(){if(this.editor)return;let t=document.createElement("div");t.id="math-tooling-panel",t.hidden=!0;let e=document.createElement("div");e.className="math-tooling",e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true"),e.setAttribute("aria-labelledby","math-tooling-title");let a=document.createElement("h2");a.id="math-tooling-title",a.className="math-tooling__title",a.textContent="Equation editor";let n=document.createElement("p");n.className="math-tooling__description",n.innerHTML="Craft LaTeX expressions with live preview, quick statistical symbols, and chemistry support.";let i=document.createElement("textarea");i.className="math-tooling__input",i.setAttribute("data-math-editor-input","true"),i.setAttribute("spellcheck","false"),i.rows=10;let r=document.createElement("div");r.className="math-tooling__actions";let s=document.createElement("div");s.className="math-tooling__preview",s.setAttribute("data-math-editor-preview","true"),s.setAttribute("aria-live","polite");let o=document.createElement("span");o.className="math-tooling__status",o.hidden=!0;let l=document.createElement("div");l.className="math-tooling__library";let c=document.createElement("h3");c.className="math-tooling__library-title",c.textContent="Quick insert";let h=document.createElement("div");h.className="math-tooling__symbols",[{label:"Mean \u03BC",value:"\\mu"},{label:"Variance \u03C3\xB2",value:"\\sigma^2"},{label:"Std. dev \u03C3",value:"\\sigma"},{label:"Probability",value:"\\mathbb{P}(A)"},{label:"Expectation",value:"\\mathbb{E}[X]"},{label:"Covariance",value:"\\mathrm{Cov}(X, Y)"},{label:"Vector",value:"\\mathbf{x}"},{label:"Norm",value:"\\lVert x \\rVert_2"},{label:"Inner product",value:"\\langle x, y \\rangle"},{label:"Derivative",value:"\\frac{\\mathrm{d}}{\\mathrm{d}t}"},{label:"Integral",value:"\\int_0^1 f(x) \\, \\mathrm{d}x"},{label:"Bayes",value:"\\mathbb{P}(A \\mid B)"},{label:"Chemical H\u2082O",value:"\\ce{H2O}"},{label:"Chemical CO\u2082",value:"\\ce{CO2}"}].forEach(g=>{let p=document.createElement("button");p.type="button",p.className="math-tooling__symbol",p.setAttribute("data-symbol-insert",g.value),p.textContent=g.label,h.appendChild(p)});let u=document.createElement("button");u.type="button",u.className="math-tooling__close",u.setAttribute("data-math-editor-close","true");let f=document.createElement("span");f.setAttribute("aria-hidden","true"),f.textContent="\u2715";let b=document.createElement("span");b.className="visually-hidden",b.textContent="Close equation editor",u.appendChild(f),u.appendChild(b);let m=document.createElement("button");m.type="button",m.className="math-tooling__copy",m.setAttribute("data-math-editor-copy","true"),m.textContent="Copy LaTeX",r.appendChild(m),r.appendChild(u),r.appendChild(o),l.appendChild(c),l.appendChild(h),e.appendChild(a),e.appendChild(n),e.appendChild(i),e.appendChild(s),e.appendChild(r),e.appendChild(l),t.appendChild(e),document.body.appendChild(t),i.addEventListener("input",()=>this.updateEditorPreview()),this.editor={overlay:t,dialog:e,textarea:i,preview:s,status:o}},openEditor(t){if(!this.editor)return;let e=(t||"").trim();this.editor.overlay.hidden=!1,document.body.classList.add("math-tooling-open"),this.editor.textarea.value=e,this.editor.textarea.focus(),this.editor.textarea.setSelectionRange(e.length,e.length),this.editorOpen=!0,this.updateEditorPreview()},closeEditor(){this.editor&&(this.editor.overlay.hidden=!0,document.body.classList.remove("math-tooling-open"),this.editorOpen=!1)},updateEditorPreview(){if(!this.editor||!this.MathJax)return;let t=this.editor.textarea.value.trim();if(!t){this.editor.preview.replaceChildren();let e=document.createElement("p");e.className="math-tooling__placeholder",e.textContent="Preview will appear here.",this.editor.preview.appendChild(e);return}this.renderLatex(this.editor.preview,t,{display:!0,enhance:!1})},insertSymbol(t){if(!this.editor||!this.editor.textarea)return;let e=this.editor.textarea,a=e.selectionStart||0,n=e.selectionEnd||0,i=e.value,r=`${i.slice(0,a)}${t}${i.slice(n)}`;e.value=r;let s=a+t.length;e.focus(),e.setSelectionRange(s,s),this.updateEditorPreview()},updateEquationReferences(){if(!this.equationMap||this.equationMap.size===0)return;document.querySelectorAll("[data-equation-ref]").forEach(a=>{let n=a.getAttribute("data-equation-ref");if(!n)return;let i=this.lookupEquation(n.replace(/^#/,""));if(!i)return;a.setAttribute("href",`#${i.anchor}`);let r=a.textContent.trim();(!r||r===n||r===i.anchor||r===`(${n})`)&&(a.textContent=i.number||i.anchor),a.classList.add("math-reference"),a.setAttribute("aria-label",`Jump to equation ${i.number||i.anchor}`)}),document.querySelectorAll('a[href^="#eq:"]').forEach(a=>{let n=a.getAttribute("href");if(!n)return;let i=n.replace(/^#/,""),r=this.lookupEquation(i);if(!r)return;a.setAttribute("href",`#${r.anchor}`);let s=a.textContent.trim();(!s||s===n||s===i)&&(a.textContent=r.number||r.anchor),a.dataset.equationRef=r.anchor,a.classList.add("math-reference")})},lookupEquation(t){if(!t)return null;if(this.equationMap.has(t))return this.equationMap.get(t);let e=t.startsWith("eq:")?t:`eq:${t}`;return this.equationMap.get(e)||null},renderLatex(t,e,a={}){if(!t)return Promise.resolve();let n=a.display!==!1;if(!this.MathJax)return t.textContent=e,this.pendingTypeset||(this.pendingTypeset=[]),this.pendingTypeset.push({target:t,latex:e,options:a}),Promise.resolve();let i=n?`\\[${e}\\]`:`\\(${e}\\)`;return t.innerHTML=i,this.MathJax.typesetPromise([t]).catch(r=>{})},cleanLatex(t){return(t||"").replace(/%\s*alt:.*$/gm,"").replace(/\\label\{[^}]*\}/g,"").replace(/\\tag\*?\{[^}]*\}/g,"").trim()},resolveAltText(t,e){let a=t||null,n=this.findDatasetAlt(a);if(n)return n;let i=this.extractAltComment(e);if(i)return i;let s=(a&&a.getAttribute?a.getAttribute("data-math-source"):null)||e;return this.generateAltFromLatex(s)},findDatasetAlt(t){let e=t;for(;e;){if(e.dataset&&e.dataset.mathAlt){let a=e.dataset.mathAlt.trim();if(a)return a}e=e.parentElement}return""},extractAltComment(t){if(!t)return"";let e=String(t).split(/\r?\n/);for(let a=0;a<e.length;a+=1){let n=e[a];if(!n)continue;let i=n.match(/%\s*alt:\s*(.+)$/i);if(i)return i[1].trim()}return""},generateAltFromLatex(t){if(!t)return"";let e=String(t).replace(/%.*$/gm,"");return e=e.replace(/\\frac\s*\{([^{}]+)\}\s*\{([^{}]+)\}/g,(a,n,i)=>{let r=this.sanitizeSegment(n),s=this.sanitizeSegment(i);return`${r} over ${s}`.trim()}),e=e.replace(/\\int(?:_\{([^}]*)\}|_([^\s^{}]+))?(?:\^\{([^}]*)\}|\^([^\s_{}]+))?/g,(a,n,i,r,s)=>{let o=this.sanitizeSegment(n||i),l=this.sanitizeSegment(r||s),c="integral";return o&&(c+=` from ${o}`),l&&(c+=` to ${l}`),c}),e=e.replace(/\\sum(?:_\{([^}]*)\}|_([^\s^{}]+))?(?:\^\{([^}]*)\}|\^([^\s_{}]+))?/g,(a,n,i,r,s)=>{let o=this.sanitizeSegment(n||i),l=this.sanitizeSegment(r||s),c="summation";return o&&(c+=` from ${o}`),l&&(c+=` to ${l}`),c}),e=e.replace(/\\sqrt\s*\{([^{}]+)\}/g,(a,n)=>`square root of ${this.sanitizeSegment(n)}`),e=e.replace(/\\mathrm\s*\{([^{}]+)\}/g,(a,n)=>this.sanitizeSegment(n)),e=e.replace(/\\operatorname\*?\s*\{([^{}]+)\}/g,(a,n)=>this.sanitizeSegment(n)),e=e.replace(/\\[a-zA-Z]+/g," "),e=e.replace(/[{}]/g," "),e=e.replace(/\s+/g," ").trim(),e||"Mathematical expression"},sanitizeSegment(t){return t?String(t).replace(/\\[a-zA-Z]+/g," ").replace(/[{}]/g," ").replace(/\s+/g," ").trim():""},syncAltAttributes(t,e,a){a&&(t&&t.setAttribute&&(t.setAttribute("aria-label",a),t.dataset&&(t.dataset.mathAlt=a)),e&&e.setAttribute&&(e.setAttribute("aria-label",a),e.dataset&&(e.dataset.mathAlt=a)))}};typeof globalThis!="undefined"&&(globalThis.__DATALOG_MATH_INTERNALS__=d),typeof document!="undefined"&&(document.addEventListener("datalog:math-ready",()=>d.exposeAllReferenceLinks(document)),d.exposeAllReferenceLinks(document)),window.DatalogMath={init(t){d.init(t)},onPageReady(){d.initialized&&d.onPageReady()},renderLatex(t,e,a){return d.renderLatex(t,e,a)}}})();
|
|
1
|
+
(function(){let d={init(e){this.MathJax=e,this.displayCounter=0,this.anchorCounter=0,this.equationMap=new Map,this.editor=null,this.editorOpen=!1,this.messageTimeout=null,this.initialized=!0,this.pendingTypeset=[],this.setupEditor(),e.startup.promise.then(()=>{if(this.decorateExisting(e.startup.document.math),this.updateEquationReferences(),this.pendingTypeset.length>0){let t=[...this.pendingTypeset];this.pendingTypeset=[],t.forEach(a=>{this.renderLatex(a.target,a.latex,a.options||{})})}}).catch(t=>{}),document.addEventListener("click",t=>this.handleClick(t)),document.addEventListener("keydown",t=>this.handleKeydown(t))},onPageReady(){this.updateEquationReferences()},decorateExisting(e){let t=e?Array.from(e):[];t.length!==0&&(this.displayCounter=0,this.anchorCounter=0,this.equationMap.clear(),t.forEach(a=>{try{this.decorateMathItem(a)}catch(i){}}))},decorateMathItem(e){if(!e||!e.typesetRoot)return;let t=e.typesetRoot,a=e.math||"",i=t.closest("[data-math-alt]")||t,n=this.resolveAltText(i,a);t.dataset.mathLatex=a,t.querySelector("a[href]")||(t.setAttribute("tabindex","0"),t.setAttribute("role","math"),this.syncAltAttributes(i,t,n)),e.display?this.decorateDisplay(t,a):this.decorateInline(t,a),this.exposeReferenceLinks(t)},exposeAllReferenceLinks(e){(e&&typeof e.querySelectorAll=="function"?e:document).querySelectorAll("mjx-container").forEach(a=>this.exposeReferenceLinks(a))},exposeReferenceLinks(e){if(!e||typeof e.querySelectorAll!="function")return;let t=Array.from(e.querySelectorAll("mjx-assistive-mml [href]")),a=e;e.querySelectorAll('[aria-hidden="true"] a[href]').forEach(i=>{i.setAttribute("tabindex","-1");let n=i.getAttribute("href")||"";if(!n.startsWith("#")||i.dataset.mathReferenceExposed==="true")return;i.dataset.mathReferenceExposed="true";let r=t.find(l=>l.getAttribute("href")===n),s=(r&&r.textContent||i.textContent||"").replace(/\s+/g," ").trim(),o=document.createElement("a");o.className="math-reference-link",o.href=n,o.textContent=s?`Equation ${s}`:"Equation",a.insertAdjacentElement("afterend",o),a=o})},decorateInline(e,t){e&&(e.classList.contains("math-expression__inline")||e.classList.add("math-expression__inline"),e.dataset.mathLatexClean=this.cleanLatex(t))},decorateDisplay(e,t){if(!e)return;let i=e.parentElement&&e.parentElement.classList.contains("math-expression")?e.parentElement:null;i||(i=document.createElement("figure"),i.className="math-expression math-expression--display",e.parentNode.insertBefore(i,e),i.appendChild(e)),i.removeAttribute("role"),i.removeAttribute("aria-label"),i.removeAttribute("tabindex");let n=this.extractEquationInfo(t);this.anchorCounter+=1;let r=`eq:auto-${this.anchorCounter}`,s=this.mathJaxNumbersEquations(),o=s?this.mathJaxNumber(e):this.ownNumber(n),l=this.buildAnchorId(n.label,r);if(i.dataset.mathLatex=t,i.dataset.mathLatexClean=this.cleanLatex(t),e.dataset.mathAlt&&!i.dataset.mathAlt&&(i.dataset.mathAlt=e.dataset.mathAlt),o?i.dataset.equationNumber=o:i.removeAttribute("data-equation-number"),i.dataset.equationLabel=n.label||"",l){i.id=l;let c=o||n.label||l;if((o||n.label)&&(this.setEquationReference(l,c),n.label&&n.label!==l&&this.setEquationReference(n.label,c,l),n.label&&n.label.startsWith("eq:"))){let h=n.label.replace(/^eq:/,"");this.setEquationReference(h,c,l)}}s||this.attachNumberBadge(i,o),this.attachToolbar(i)},mathJaxNumbersEquations(){let e=this.MathJax&&this.MathJax.config?this.MathJax.config.tex:null,t=e?e.tags:null;return!!t&&t!=="none"},mathJaxNumber(e){let t=e.querySelector("mjx-assistive-mml mlabeledtr > mtd:first-child");return t?(t.textContent||"").replace(/\s+/g," ").trim():""},ownNumber(e){let t=e.tag||"";return e.skipNumber||(this.displayCounter+=1,t||(t=String(this.displayCounter))),t?`(${t})`:""},extractEquationInfo(e){let t=(e||"").trim(),a=t.match(/\\tag\*?\{([^}]*)\}/),i=t.match(/\\label\{([^}]*)\}/),n=/\\notag|\\nonumber/.test(t);return{tag:a?a[1].trim():"",label:i?i[1].trim():"",skipNumber:n}},buildAnchorId(e,t){return e?e.startsWith("eq:")?e:`eq:${e}`:t||""},setEquationReference(e,t,a){if(!e)return;let i=a||e,n=t||e;this.equationMap.set(e,{anchor:i,label:e,number:n}),e.startsWith("eq:")||this.equationMap.set(`eq:${e}`,{anchor:i,label:e,number:n})},attachNumberBadge(e,t){let a=e.querySelector(".math-expression__number"),i=e.querySelector(".math-expression__sr");if(!t){a&&a.remove(),i&&i.remove();return}a||(a=document.createElement("span"),a.className="math-expression__number",a.setAttribute("aria-hidden","true"),e.appendChild(a)),a.textContent=t,i||(i=document.createElement("span"),i.className="visually-hidden math-expression__sr",e.appendChild(i)),i.textContent=`Equation ${t.replace(/[()]/g,"")}`},attachToolbar(e){let t=e.querySelector(".math-expression__toolbar");if(!t){t=document.createElement("div"),t.className="math-expression__toolbar";let a=document.createElement("button");a.type="button",a.className="math-expression__button",a.setAttribute("data-math-copy","true"),a.setAttribute("aria-label","Copy LaTeX code");let i=document.createElement("span");i.setAttribute("aria-hidden","true"),i.textContent="\u29C9";let n=document.createElement("span");n.className="visually-hidden",n.textContent="Copy equation",a.appendChild(i),a.appendChild(n);let r=document.createElement("button");r.type="button",r.className="math-expression__button",r.setAttribute("data-math-edit","true"),r.setAttribute("aria-label","Open equation editor");let s=document.createElement("span");s.setAttribute("aria-hidden","true"),s.textContent="\u270E";let o=document.createElement("span");o.className="visually-hidden",o.textContent="Edit equation",r.appendChild(s),r.appendChild(o);let l=document.createElement("span");l.className="math-expression__message",l.setAttribute("aria-live","polite"),l.hidden=!0,t.appendChild(a),t.appendChild(r),t.appendChild(l),e.appendChild(t)}},handleClick(e){let t=e.target.closest("[data-math-copy]");if(t){e.preventDefault();let s=t.closest(".math-expression"),o=s?s.dataset.mathLatexClean||s.dataset.mathLatex:null;this.copyLatex(o,s);return}let a=e.target.closest("[data-math-edit]");if(a){e.preventDefault();let s=a.closest(".math-expression"),o=s&&s.dataset.mathLatex||"";this.openEditor(o);return}if(e.target.closest("[data-math-editor-close]")){e.preventDefault(),this.closeEditor();return}if(e.target.closest("[data-math-editor-copy]")){e.preventDefault(),this.editor&&this.editor.textarea&&this.copyLatex(this.editor.textarea.value,null,this.editor.status);return}let r=e.target.closest("[data-symbol-insert]");if(r){e.preventDefault();let s=r.getAttribute("data-symbol-insert");this.insertSymbol(s||"")}},handleKeydown(e){let t=document.activeElement,a=t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable);if((e.ctrlKey||e.metaKey)&&e.altKey&&(e.key==="e"||e.key==="E")){e.preventDefault();let i=a&&t&&t.value||"";this.openEditor(i);return}e.key==="Escape"&&this.editorOpen&&(e.preventDefault(),this.closeEditor())},copyLatex(e,t,a){if(!e)return;let i=r=>{if(a)a.hidden=!1,a.textContent=r,clearTimeout(this.messageTimeout),this.messageTimeout=window.setTimeout(()=>{a.hidden=!0,a.textContent=""},2e3);else if(t){let s=t.querySelector(".math-expression__message");s&&(s.hidden=!1,s.textContent=r,clearTimeout(this.messageTimeout),this.messageTimeout=window.setTimeout(()=>{s.hidden=!0,s.textContent=""},2e3))}},n=()=>{let r=document.createElement("textarea");r.value=e,r.setAttribute("aria-hidden","true"),r.style.position="fixed",r.style.opacity="0",document.body.appendChild(r),r.select();try{document.execCommand("copy"),i("Copied equation")}catch(s){i("Unable to copy")}document.body.removeChild(r)};navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(e).then(()=>i("Copied equation")).catch(()=>n()):n()},setupEditor(){if(this.editor)return;let e=document.createElement("div");e.id="math-tooling-panel",e.hidden=!0;let t=document.createElement("div");t.className="math-tooling",t.setAttribute("role","dialog"),t.setAttribute("aria-modal","true"),t.setAttribute("aria-labelledby","math-tooling-title");let a=document.createElement("h2");a.id="math-tooling-title",a.className="math-tooling__title",a.textContent="Equation editor";let i=document.createElement("p");i.id="math-tooling-description",i.className="math-tooling__description",i.textContent="Craft LaTeX expressions with live preview, quick statistical symbols, and chemistry support.";let n=document.createElement("textarea");n.className="math-tooling__input",n.setAttribute("data-math-editor-input","true"),n.setAttribute("spellcheck","false"),n.setAttribute("aria-label","LaTeX source"),n.setAttribute("aria-describedby",i.id),n.rows=10;let r=document.createElement("div");r.className="math-tooling__actions";let s=document.createElement("div");s.className="math-tooling__preview",s.setAttribute("data-math-editor-preview","true"),s.setAttribute("aria-live","polite");let o=document.createElement("span");o.className="math-tooling__status",o.hidden=!0;let l=document.createElement("div");l.className="math-tooling__library";let c=document.createElement("h3");c.className="math-tooling__library-title",c.textContent="Quick insert";let h=document.createElement("div");h.className="math-tooling__symbols",[{label:"Mean \u03BC",value:"\\mu"},{label:"Variance \u03C3\xB2",value:"\\sigma^2"},{label:"Std. dev \u03C3",value:"\\sigma"},{label:"Probability",value:"\\mathbb{P}(A)"},{label:"Expectation",value:"\\mathbb{E}[X]"},{label:"Covariance",value:"\\mathrm{Cov}(X, Y)"},{label:"Vector",value:"\\mathbf{x}"},{label:"Norm",value:"\\lVert x \\rVert_2"},{label:"Inner product",value:"\\langle x, y \\rangle"},{label:"Derivative",value:"\\frac{\\mathrm{d}}{\\mathrm{d}t}"},{label:"Integral",value:"\\int_0^1 f(x) \\, \\mathrm{d}x"},{label:"Bayes",value:"\\mathbb{P}(A \\mid B)"},{label:"Chemical H\u2082O",value:"\\ce{H2O}"},{label:"Chemical CO\u2082",value:"\\ce{CO2}"}].forEach(g=>{let p=document.createElement("button");p.type="button",p.className="math-tooling__symbol",p.setAttribute("data-symbol-insert",g.value),p.textContent=g.label,h.appendChild(p)});let u=document.createElement("button");u.type="button",u.className="math-tooling__close",u.setAttribute("data-math-editor-close","true");let b=document.createElement("span");b.setAttribute("aria-hidden","true"),b.textContent="\u2715";let f=document.createElement("span");f.className="visually-hidden",f.textContent="Close equation editor",u.appendChild(b),u.appendChild(f);let m=document.createElement("button");m.type="button",m.className="math-tooling__copy",m.setAttribute("data-math-editor-copy","true"),m.textContent="Copy LaTeX",r.appendChild(m),r.appendChild(u),r.appendChild(o),l.appendChild(c),l.appendChild(h),t.appendChild(a),t.appendChild(i),t.appendChild(n),t.appendChild(s),t.appendChild(r),t.appendChild(l),e.appendChild(t),document.body.appendChild(e),n.addEventListener("input",()=>this.updateEditorPreview()),this.editor={overlay:e,dialog:t,textarea:n,preview:s,status:o}},openEditor(e){if(!this.editor)return;let t=(e||"").trim();this.editor.overlay.hidden=!1,document.body.classList.add("math-tooling-open"),this.editor.textarea.value=t,this.editor.textarea.focus(),this.editor.textarea.setSelectionRange(t.length,t.length),this.editorOpen=!0,this.updateEditorPreview()},closeEditor(){this.editor&&(this.editor.overlay.hidden=!0,document.body.classList.remove("math-tooling-open"),this.editorOpen=!1)},updateEditorPreview(){if(!this.editor||!this.MathJax)return;let e=this.editor.textarea.value.trim();if(!e){this.editor.preview.replaceChildren();let t=document.createElement("p");t.className="math-tooling__placeholder",t.textContent="Preview will appear here.",this.editor.preview.appendChild(t);return}this.renderLatex(this.editor.preview,e,{display:!0,enhance:!1})},insertSymbol(e){if(!this.editor||!this.editor.textarea)return;let t=this.editor.textarea,a=t.selectionStart||0,i=t.selectionEnd||0,n=t.value,r=`${n.slice(0,a)}${e}${n.slice(i)}`;t.value=r;let s=a+e.length;t.focus(),t.setSelectionRange(s,s),this.updateEditorPreview()},updateEquationReferences(){if(!this.equationMap||this.equationMap.size===0)return;document.querySelectorAll("[data-equation-ref]").forEach(a=>{let i=a.getAttribute("data-equation-ref");if(!i)return;let n=this.lookupEquation(i.replace(/^#/,""));if(!n)return;a.setAttribute("href",`#${n.anchor}`);let r=a.textContent.trim();(!r||r===i||r===n.anchor||r===`(${i})`)&&(a.textContent=n.number||n.anchor),a.classList.add("math-reference"),a.setAttribute("aria-label",`Jump to equation ${n.number||n.anchor}`)}),document.querySelectorAll('a[href^="#eq:"]').forEach(a=>{let i=a.getAttribute("href");if(!i)return;let n=i.replace(/^#/,""),r=this.lookupEquation(n);if(!r)return;a.setAttribute("href",`#${r.anchor}`);let s=a.textContent.trim();(!s||s===i||s===n)&&(a.textContent=r.number||r.anchor),a.dataset.equationRef=r.anchor,a.classList.add("math-reference")})},lookupEquation(e){if(!e)return null;if(this.equationMap.has(e))return this.equationMap.get(e);let t=e.startsWith("eq:")?e:`eq:${e}`;return this.equationMap.get(t)||null},renderLatex(e,t,a={}){if(!e)return Promise.resolve();let i=a.display!==!1;if(!this.MathJax)return e.textContent=t,this.pendingTypeset||(this.pendingTypeset=[]),this.pendingTypeset.push({target:e,latex:t,options:a}),Promise.resolve();let n=i?`\\[${t}\\]`:`\\(${t}\\)`;return e.innerHTML=n,this.MathJax.typesetPromise([e]).catch(r=>{})},cleanLatex(e){return(e||"").replace(/%\s*alt:.*$/gm,"").replace(/\\label\{[^}]*\}/g,"").replace(/\\tag\*?\{[^}]*\}/g,"").trim()},resolveAltText(e,t){let a=e||null,i=this.findDatasetAlt(a);if(i)return i;let n=this.extractAltComment(t);if(n)return n;let s=(a&&a.getAttribute?a.getAttribute("data-math-source"):null)||t;return this.generateAltFromLatex(s)},findDatasetAlt(e){let t=e;for(;t;){if(t.dataset&&t.dataset.mathAlt){let a=t.dataset.mathAlt.trim();if(a)return a}t=t.parentElement}return""},extractAltComment(e){if(!e)return"";let t=String(e).split(/\r?\n/);for(let a=0;a<t.length;a+=1){let i=t[a];if(!i)continue;let n=i.match(/%\s*alt:\s*(.+)$/i);if(n)return n[1].trim()}return""},generateAltFromLatex(e){if(!e)return"";let t=String(e).replace(/%.*$/gm,"");return t=t.replace(/\\frac\s*\{([^{}]+)\}\s*\{([^{}]+)\}/g,(a,i,n)=>{let r=this.sanitizeSegment(i),s=this.sanitizeSegment(n);return`${r} over ${s}`.trim()}),t=t.replace(/\\int(?:_\{([^}]*)\}|_([^\s^{}]+))?(?:\^\{([^}]*)\}|\^([^\s_{}]+))?/g,(a,i,n,r,s)=>{let o=this.sanitizeSegment(i||n),l=this.sanitizeSegment(r||s),c="integral";return o&&(c+=` from ${o}`),l&&(c+=` to ${l}`),c}),t=t.replace(/\\sum(?:_\{([^}]*)\}|_([^\s^{}]+))?(?:\^\{([^}]*)\}|\^([^\s_{}]+))?/g,(a,i,n,r,s)=>{let o=this.sanitizeSegment(i||n),l=this.sanitizeSegment(r||s),c="summation";return o&&(c+=` from ${o}`),l&&(c+=` to ${l}`),c}),t=t.replace(/\\sqrt\s*\{([^{}]+)\}/g,(a,i)=>`square root of ${this.sanitizeSegment(i)}`),t=t.replace(/\\mathrm\s*\{([^{}]+)\}/g,(a,i)=>this.sanitizeSegment(i)),t=t.replace(/\\operatorname\*?\s*\{([^{}]+)\}/g,(a,i)=>this.sanitizeSegment(i)),t=t.replace(/\\[a-zA-Z]+/g," "),t=t.replace(/[{}]/g," "),t=t.replace(/\s+/g," ").trim(),t||"Mathematical expression"},sanitizeSegment(e){return e?String(e).replace(/\\[a-zA-Z]+/g," ").replace(/[{}]/g," ").replace(/\s+/g," ").trim():""},syncAltAttributes(e,t,a){a&&(e&&e.setAttribute&&(e.setAttribute("aria-label",a),e.dataset&&(e.dataset.mathAlt=a)),t&&t.setAttribute&&(t.setAttribute("aria-label",a),t.dataset&&(t.dataset.mathAlt=a)))}};typeof globalThis!="undefined"&&(globalThis.__DATALOG_MATH_INTERNALS__=d),typeof document!="undefined"&&(document.addEventListener("datalog:math-ready",()=>d.exposeAllReferenceLinks(document)),d.exposeAllReferenceLinks(document)),window.DatalogMath={init(e){d.init(e)},onPageReady(){d.initialized&&d.onPageReady()},renderLatex(e,t,a){return d.renderLatex(e,t,a)}}})();
|
data/assets/js/dist/sources.json
CHANGED
|
@@ -6,21 +6,23 @@
|
|
|
6
6
|
"assets/js/comments/thread.js": "50684540ae6f03555ed375df46116f9f91c0c756477a2426972274ec581f18bc",
|
|
7
7
|
"assets/js/contact.js": "7b93f9f5d8f3c0852303ea22c970845072935de50fd6f765087825e60b845c69",
|
|
8
8
|
"assets/js/contact/form.js": "502c755ee72b7f6d050cd3965c25c4979586c1e5c444dd944a77767925c8c5ae",
|
|
9
|
-
"assets/js/core/copy-buttons.js": "
|
|
9
|
+
"assets/js/core/copy-buttons.js": "313e22057b56b8a3721c2d049a4fcf2b02839105ce70a9c82b570539732686b3",
|
|
10
10
|
"assets/js/core/dark-mode.js": "1d4a699f6b810c829138823e346d96fa95bb89a3247937f5ff001a476d1856f3",
|
|
11
11
|
"assets/js/core/github-cards.js": "7eb0c4f489fd838f4c62ed0e5ba59ad4c51e01c8a7ccf04c2ef26c1b47fa284e",
|
|
12
|
+
"assets/js/core/install-tabs.js": "855499d313f2f67b0df2d96e67643df495710497bb7f5ce47282b5cf27bf4e68",
|
|
12
13
|
"assets/js/core/language-filter.js": "adbe34d62cbbf77bbaab8339101f5c75d8934eed735c7279c95ab007bd56f461",
|
|
13
14
|
"assets/js/core/navigation.js": "5d8457d996c040343fdb2ba44c204cdb04dfa2f509c127f702095d720c4d3469",
|
|
14
15
|
"assets/js/core/scroll-progress.js": "9610488213fa83f9270d0f2c9026b7f3e689503f41efa0c01317a51760d44b5f",
|
|
15
16
|
"assets/js/core/search-hotkeys.js": "19881663e3db178e92ab58a382c5369aab5a3045b58410d906eb117924125186",
|
|
16
17
|
"assets/js/core/skip-links.js": "138265a3aa853bf07a798efd03d56b14a5733f6e6c1810ccf87e4cfb86d52c30",
|
|
18
|
+
"assets/js/core/toc.js": "d66665aaa7f5a6359d3d1bee259a6d0781f816782087f670de2c7fc04562789e",
|
|
17
19
|
"assets/js/corrections.js": "16010732e7d653490d7b08d8dea88616008f9ae15efbc0f42848c52a7c8a6209",
|
|
18
20
|
"assets/js/corrections/form.js": "525c281ca7c964b0415c5571360b87c7827299d870c673d87f2b1b398b240e8b",
|
|
19
21
|
"assets/js/dynamic-services/client.js": "32e9cf9ad040553b2b96c3d92733c9b7626846f6dfb0aa6072ceab9f498b90b0",
|
|
20
22
|
"assets/js/dynamic-services/form-state.js": "96bfe09e7ea789d57d50f9f36cce8f53823d650dab6e5b4cc10f17c3fbec504e",
|
|
21
23
|
"assets/js/loader.js": "4544818b74f4c34a634c58008ca3348ad0bede869ccf81af27ba4dad1cbb9283",
|
|
22
|
-
"assets/js/main.js": "
|
|
23
|
-
"assets/js/math.js": "
|
|
24
|
+
"assets/js/main.js": "ea45ab96106172ab105c96f32042af4d9587d7ae197ac854af7e95accfebdc7c",
|
|
25
|
+
"assets/js/math.js": "1b457f5dbce7ed5476f973839c21d05a1700a3ecd5933aeca238e9ec66839adb",
|
|
24
26
|
"assets/js/moderation.js": "2e9bcb00f0dcf4dd436458d99764989c9728794716dd33c59310d65206323c46",
|
|
25
27
|
"assets/js/moderation/inbox.js": "ddbe3f4c251ff4bf10bd799fbd2e43777d3d728643fd5b962dfdf258c7365993",
|
|
26
28
|
"assets/js/notebook.js": "361f716a76b398aeb564ef05ba026018b1bc083de28d75c9b8df5776a6ccb21a",
|
data/lib/datalog/cli.rb
CHANGED
|
@@ -9,6 +9,7 @@ require "tmpdir"
|
|
|
9
9
|
require "yaml"
|
|
10
10
|
require "thor"
|
|
11
11
|
|
|
12
|
+
require_relative "slug"
|
|
12
13
|
require_relative "theme/version"
|
|
13
14
|
|
|
14
15
|
module Datalog
|
|
@@ -116,19 +117,17 @@ module Datalog
|
|
|
116
117
|
gemfile = gemfile_path(root)
|
|
117
118
|
|
|
118
119
|
if File.exist?(gemfile)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
say_error "Bundler could not update datalog-theme."
|
|
122
|
-
exit 1
|
|
123
|
-
end
|
|
120
|
+
run_or_exit(:bundle, "bundle update datalog-theme", root, "Bundler could not update datalog-theme.",
|
|
121
|
+
{ "BUNDLE_GEMFILE" => gemfile })
|
|
124
122
|
else
|
|
125
123
|
say_status :skip, "No Gemfile detected—skipping Bundler update", :yellow
|
|
126
124
|
end
|
|
127
125
|
|
|
128
126
|
package_json = File.join(root, "package.json")
|
|
129
127
|
if File.exist?(package_json) && command_available?("npm")
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
# npm's exit status used to be dropped, so a failed install still ended
|
|
129
|
+
# with "Theme dependencies are up to date!".
|
|
130
|
+
run_or_exit(:npm, "npm install", root, "npm could not install the site's packages.")
|
|
132
131
|
elsif File.exist?(package_json)
|
|
133
132
|
say_status :warn, "Node.js tooling not available—skipping npm install", :yellow
|
|
134
133
|
end
|
|
@@ -157,7 +156,7 @@ module Datalog
|
|
|
157
156
|
end
|
|
158
157
|
|
|
159
158
|
def slugify(text)
|
|
160
|
-
|
|
159
|
+
Datalog::Slug.of(text)
|
|
161
160
|
end
|
|
162
161
|
|
|
163
162
|
def ask_with_default(prompt, default)
|
|
@@ -434,6 +433,16 @@ module Datalog
|
|
|
434
433
|
|
|
435
434
|
private
|
|
436
435
|
|
|
436
|
+
# Announces one dependency command, runs it, and stops the update where it
|
|
437
|
+
# fails rather than carrying on to report success.
|
|
438
|
+
def run_or_exit(label, command, root, message, env = {})
|
|
439
|
+
say_status label, command, :blue
|
|
440
|
+
return if system(env, command, chdir: root)
|
|
441
|
+
|
|
442
|
+
say_error message
|
|
443
|
+
exit 1
|
|
444
|
+
end
|
|
445
|
+
|
|
437
446
|
def site_root
|
|
438
447
|
File.expand_path(options[:root])
|
|
439
448
|
end
|
data/lib/datalog/slug.rb
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Datalog
|
|
4
|
+
# The slug `datalog new` gives a scaffolded post, notebook or project. It
|
|
5
|
+
# names the file, and through the filename the page's URL, so it follows
|
|
6
|
+
# Jekyll's own rule rather than a second one of its own.
|
|
7
|
+
module Slug
|
|
8
|
+
module_function
|
|
9
|
+
|
|
10
|
+
# "Análise de Séries" becomes "analise-de-series". The ASCII-only
|
|
11
|
+
# character class this replaced deleted every accented letter instead of
|
|
12
|
+
# carrying it across, leaving "an-lise-de-s-ries".
|
|
13
|
+
def of(text)
|
|
14
|
+
require "jekyll"
|
|
15
|
+
|
|
16
|
+
normalized = utf8(text)
|
|
17
|
+
latin = Jekyll::Utils.slugify(normalized, mode: "latin").to_s
|
|
18
|
+
# A title written in a script the transliteration table does not cover —
|
|
19
|
+
# Greek, Cyrillic, Chinese — comes back empty. Keeping its own
|
|
20
|
+
# characters beats naming the file after its date alone.
|
|
21
|
+
latin.empty? ? Jekyll::Utils.slugify(normalized).to_s : latin
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# What the console hands over is tagged with the console's encoding, which
|
|
25
|
+
# on Windows is rarely UTF-8, and transliteration raises on a string whose
|
|
26
|
+
# tag and bytes disagree. The bytes are usually UTF-8 already, so they are
|
|
27
|
+
# re-tagged when that reads, and converted when it does not.
|
|
28
|
+
def utf8(text)
|
|
29
|
+
string = text.to_s
|
|
30
|
+
return string if string.encoding == Encoding::UTF_8 && string.valid_encoding?
|
|
31
|
+
|
|
32
|
+
retagged = string.dup.force_encoding(Encoding::UTF_8)
|
|
33
|
+
return retagged if retagged.valid_encoding?
|
|
34
|
+
|
|
35
|
+
string.encode(Encoding::UTF_8, invalid: :replace, undef: :replace, replace: "")
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Datalog
|
|
4
4
|
module Theme
|
|
5
|
-
VERSION = "0.
|
|
5
|
+
VERSION = "0.10.0" unless const_defined?(:VERSION)
|
|
6
6
|
# The Ruby the gem installs on, for the gemspec and `datalog check`. The
|
|
7
7
|
# release workflow rewrites every quoted version assigned to a name ending
|
|
8
8
|
# in VERSION in this file, so this name must not end that way.
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: datalog-theme
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.10.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Diogo Ribeiro
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-09-
|
|
11
|
+
date: 2026-09-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jekyll
|
|
@@ -329,7 +329,6 @@ files:
|
|
|
329
329
|
- _includes/components/responsive-image.html
|
|
330
330
|
- _includes/components/revision-history.html
|
|
331
331
|
- _includes/components/revision-notice.html
|
|
332
|
-
- _includes/components/search-facets.html
|
|
333
332
|
- _includes/components/series-nav.html
|
|
334
333
|
- _includes/components/social-share.html
|
|
335
334
|
- _includes/components/subscribe-form.html
|
|
@@ -387,6 +386,7 @@ files:
|
|
|
387
386
|
- _plugins/front_matter_compat.rb
|
|
388
387
|
- _plugins/i18n.rb
|
|
389
388
|
- _plugins/image_optimizer.rb
|
|
389
|
+
- _plugins/js_manifest_filter.rb
|
|
390
390
|
- _plugins/licenses.rb
|
|
391
391
|
- _plugins/math_preprocessor.rb
|
|
392
392
|
- _plugins/notebook_converter.rb
|
|
@@ -481,6 +481,7 @@ files:
|
|
|
481
481
|
- lib/datalog/plugins/comments.rb
|
|
482
482
|
- lib/datalog/plugins/search.rb
|
|
483
483
|
- lib/datalog/plugins/slides.rb
|
|
484
|
+
- lib/datalog/slug.rb
|
|
484
485
|
- lib/datalog/theme/installed_files.rb
|
|
485
486
|
- lib/datalog/theme/package.rb
|
|
486
487
|
- lib/datalog/theme/repository_checkout.rb
|