108 lines
3.2 KiB
Plaintext
108 lines
3.2 KiB
Plaintext
---
|
|
import SiteNav from "../components/SiteNav.astro";
|
|
import LevelToggle from "../components/LevelToggle.astro";
|
|
import BuildStamp from "../components/BuildStamp.astro";
|
|
import "../styles/global.css";
|
|
|
|
const {
|
|
title,
|
|
editionLabel,
|
|
editionKey,
|
|
statusLabel,
|
|
statusKey,
|
|
level,
|
|
version
|
|
} = Astro.props;
|
|
|
|
const lvl = level ?? 1;
|
|
|
|
const canonical = Astro.site
|
|
? new URL(Astro.url.pathname, Astro.site).href
|
|
: Astro.url.href;
|
|
---
|
|
<!doctype html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title>{title ? `${title} — Archicratie` : "Archicratie"}</title>
|
|
|
|
<link rel="canonical" href={canonical} />
|
|
<link rel="sitemap" href="/sitemap-index.xml" />
|
|
|
|
<meta data-pagefind-filter="edition[content]" content={String(editionKey ?? editionLabel)} />
|
|
<meta data-pagefind-filter="level[content]" content={String(lvl)} />
|
|
<meta data-pagefind-filter="status[content]" content={String(statusKey ?? statusLabel)} />
|
|
|
|
<meta data-pagefind-meta={`edition:${String(editionKey ?? editionLabel)}`} />
|
|
<meta data-pagefind-meta={`level:${String(lvl)}`} />
|
|
<meta data-pagefind-meta={`status:${String(statusKey ?? statusLabel)}`} />
|
|
<meta data-pagefind-meta={`version:${String(version ?? "")}`} />
|
|
</head>
|
|
|
|
<body data-doc-title={title} data-doc-version={version}>
|
|
<header>
|
|
<SiteNav />
|
|
<div class="edition-bar">
|
|
<span class="badge"><strong>Édition</strong> : {editionLabel}</span>
|
|
<span class="badge"><strong>Statut</strong> : {statusLabel}</span>
|
|
<span class="badge"><strong>Niveau</strong> : {lvl}</span>
|
|
<span class="badge"><strong>Version</strong> : {version}</span>
|
|
<LevelToggle initialLevel={lvl} />
|
|
</div>
|
|
</header>
|
|
|
|
<main>
|
|
<article class="reading" data-pagefind-body>
|
|
<slot />
|
|
<BuildStamp />
|
|
</article>
|
|
</main>
|
|
|
|
<script is:inline>
|
|
(() => {
|
|
const title = document.body.dataset.docTitle || document.title;
|
|
const version = document.body.dataset.docVersion || "";
|
|
|
|
const paras = Array.from(document.querySelectorAll(".reading p[id]"));
|
|
for (const p of paras) {
|
|
if (p.querySelector(".para-tools")) continue;
|
|
|
|
const tools = document.createElement("span");
|
|
tools.className = "para-tools";
|
|
|
|
const a = document.createElement("a");
|
|
a.className = "para-anchor";
|
|
a.href = `#${p.id}`;
|
|
a.setAttribute("aria-label", "Lien vers ce paragraphe");
|
|
a.textContent = "¶";
|
|
|
|
const btn = document.createElement("button");
|
|
btn.type = "button";
|
|
btn.className = "para-cite";
|
|
btn.textContent = "Citer";
|
|
|
|
btn.addEventListener("click", async () => {
|
|
const url = new URL(window.location.href);
|
|
url.hash = p.id;
|
|
const cite = `${title}${version ? ` (v${version})` : ""} — ${url.toString()}`;
|
|
|
|
try {
|
|
await navigator.clipboard.writeText(cite);
|
|
const prev = btn.textContent;
|
|
btn.textContent = "Copié";
|
|
setTimeout(() => (btn.textContent = prev), 900);
|
|
} catch {
|
|
window.prompt("Copiez la citation :", cite);
|
|
}
|
|
});
|
|
|
|
tools.appendChild(a);
|
|
tools.appendChild(btn);
|
|
p.appendChild(tools);
|
|
}
|
|
})();
|
|
</script>
|
|
</body>
|
|
</html>
|