-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathheader.include
More file actions
179 lines (157 loc) · 5.81 KB
/
header.include
File metadata and controls
179 lines (157 loc) · 5.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>[TITLE]</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style data-fill-with="stylesheet"></style>
<style>
:root {
--semic-blue: #005ea8;
--heading-text: #005a9c;
--semic-text: #1f1f1f;
--semic-muted: #555;
--semic-border: #d9d9d9;
}
#semic-logo {
display: block;
height: auto;
max-width: 154px;
}
.head dl {
margin-top: 1rem;
}
.semic-footer {
border-top: 1px solid var(--semic-border);
color: var(--semic-muted);
font-size: 0.9rem;
margin-top: 3rem;
padding-top: 1rem;
}
</style>
<!-- Matomo -->
<script bs-macros include-if="text macro: SEMICMATOMOID">
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//health.semic.eu/matomo/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '[SEMICMATOMOID?]']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
<script>
(() => {
const siteBase = "https://w3id.org/ldes/";
const releasesBase = "https://w3id.org/ldes/releases/";
const currentPath = new URL(window.location.href).pathname;
const pathSegments = currentPath.split("/").filter(Boolean);
const documentSlug = getDocumentSlug(currentPath, pathSegments);
const latestPath = getLatestPath(documentSlug);
const linkTargets = {
thisVersion: getThisVersionPath(pathSegments, latestPath),
latest: `${siteBase}${latestPath}`,
archivedVersions: releasesBase,
workingDraft: `${siteBase}workingdraft/${getWorkingDraftPath(documentSlug)}`,
};
function getDocumentSlug(path, segments) {
if (path.endsWith("/")) return "index";
if (segments[segments.length - 1] === "workingdraft") return "index";
const releasesIndex = segments.indexOf("releases");
if (releasesIndex !== -1 && releasesIndex === segments.length - 2) {
return "index";
}
const lastSegment = segments[segments.length - 1] || "index";
return lastSegment.replace(/\.html$/, "");
}
function getLatestPath(documentSlug) {
const paths = {
index: "specification",
vocabulary: "vocabulary",
"server-primer": "server-primer",
};
return paths[documentSlug] || documentSlug;
}
function getWorkingDraftPath(documentSlug) {
return documentSlug === "index" ? "" : getLatestPath(documentSlug);
}
function getThisVersionPath(segments, latestPath) {
const workingDraftIndex = segments.indexOf("workingdraft");
if (workingDraftIndex !== -1) {
return `workingdraft/${getWorkingDraftPath(documentSlug)}`;
}
const releasesIndex = segments.indexOf("releases");
if (releasesIndex !== -1 && segments[releasesIndex + 1]) {
const release = segments[releasesIndex + 1];
return `releases/${release}/${getWorkingDraftPath(documentSlug)}`;
}
return latestPath;
}
function setVersionLinks() {
const metadata = document.querySelector('[data-fill-with="spec-metadata"] dl');
if (!metadata) return;
metadata.classList.add("ldes-version-links");
removeVersionRows(metadata);
const rows = [
createVersionRow("This version:", `${siteBase}${linkTargets.thisVersion}`, true),
createVersionRow("Latest version:", linkTargets.latest),
createVersionRow("Archived versions:", linkTargets.archivedVersions),
createVersionRow("Working draft:", linkTargets.workingDraft),
];
metadata.prepend(...rows.flat());
}
function createVersionRow(label, href, isThisVersion = false) {
const term = document.createElement("dt");
term.textContent = label;
const definition = document.createElement("dd");
const link = document.createElement("a");
link.href = href;
link.textContent = href;
if (isThisVersion) {
link.classList.add("u-url");
}
definition.append(link);
return [term, definition];
}
function removeVersionRows(metadata) {
const versionLabels = new Set([
"This version:"
]);
for (const term of [...metadata.querySelectorAll("dt")]) {
if (!versionLabels.has(term.textContent.trim())) continue;
for (const definition of getRowDefinitions(term)) {
definition.remove();
}
term.remove();
}
}
function getRowDefinitions(term) {
const definitions = [];
for (let node = term.nextElementSibling; node && node.tagName.toLowerCase() === "dd"; node = node.nextElementSibling) {
definitions.push(node);
}
return definitions;
}
window.addEventListener("DOMContentLoaded", setVersionLinks);
})();
</script>
</head>
<body class="h-entry">
<div class="head">
<p data-fill-with="logo"></p>
<h1 id="title" class="p-name no-ref">[SPECTITLE]</h1>
<h2 id="profile-and-date" class="no-num no-toc no-ref heading">
<time class="dt-updated" datetime="[ISODATE]">[DATE]</time>
</h2>
<div data-fill-with="spec-metadata"></div>
<div data-fill-with="warning"></div>
<p class="copyright" data-fill-with="copyright"></p>
</div>
<section class="p-summary" data-fill-with="abstract"></section>
<div data-fill-with="at-risk"></div>
<nav data-fill-with="table-of-contents" id="toc"></nav>
<main>