-
Notifications
You must be signed in to change notification settings - Fork 4
/
glossary.html
298 lines (262 loc) · 13.3 KB
/
glossary.html
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
<!DOCTYPE html>
<html lang="en">
<head>
<title>Glossary</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="generator" content="https://glossary.page/template" />
<link rel="preconnect" href="https://glstatic.net" crossorigin>
<link rel="apple-touch-icon" sizes="180x180" href="https://glstatic.net/glossary-page-template-favicons/apple-touch-icon.png?v=2">
<link rel="icon" type="image/png" sizes="32x32" href="https://glstatic.net/glossary-page-template-favicons/favicon-32x32.png?v=2">
<link rel="icon" type="image/png" sizes="16x16" href="https://glstatic.net/glossary-page-template-favicons/favicon-16x16.png?v=2">
<link rel="manifest" href="https://glstatic.net/glossary-page-template-favicons/site.webmanifest">
<link rel="mask-icon" href="https://glstatic.net/glossary-page-template-favicons/safari-pinned-tab.svg?v=2" color="#5bbad5">
<link rel="shortcut icon" href="https://glstatic.net/glossary-page-template-favicons/favicon.ico?v=2">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-config" content="https://glstatic.net/glossary-page-template-favicons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<script type="text/javascript">
// Prevent FOUC
document.documentElement.className = 'invisible';
</script>
<!-- Uncomment the lines below to add support for math typesetting using KaTeX. -->
<!--
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.10/dist/katex.min.css" integrity="sha384-wcIxkf4k558AjM3Yz3BBFQUbk/zgIYC2R0QpeeYb+TwlBVMrlgLqwRjRtGZiK7ww" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.10/dist/katex.min.js" integrity="sha384-hIoBPJpTUs74ddyc4bFZSM1TVlQDA60VBbJS0oA934VSz82sBx1X7kSx2ATBDIyd" crossorigin="anonymous"></script>
-->
<script type="module" src="./glossary.ts"></script>
</head>
<body>
<div id="glossary-page-container" data-enable-help-for-making-changes="true" data-enable-export-menu="true" data-enable-order-items-buttons="true" data-enable-last-updated-dates="true" data-card-width="intermediate" data-default-theme="system">
<header>
<h1 id="glossary-page-title">
Glossary Page Template
</h1>
</header>
<main>
<div id="glossary-page-about">
<p>This is a template for a glossary page. It contains a few example items that show how things work.</p>
<ul>
</ul>
</div>
<div id="glossary-page-tags">
Tags:
<dl>
<div data-id="d1e8582a-81fd-47c7-8812-e87381b6b3fe">
<dt>Computer Science</dt>
<dd>These are items about computer science — the study of computation, information, and automation.</dd>
</div>
<div data-id="0ee79935-fb73-44f8-94f0-cdc7db6987d1">
<dt>Finance</dt>
<dd>These are items about finance — the study and discipline of money, currency and capital assets.</dd>
</div>
</dl>
</div>
<article id="glossary-page-items">
<dl>
<div data-id="def3f840-163c-4171-91e1-48fcf909335a" data-last-updated="2023-09-15T19:58:59.573Z">
<dt>
<dfn id="Default_(Computer_Science)">
<a href="#Default_(Computer_Science)">
<span>Default</span>
<span class="disambiguation">(Computer Science)</span>
</a>
</dfn>
</dt>
<dt>
<dfn>
Preset
</dfn>
</dt>
<dt>
<dfn>
Factory preset
</dfn>
</dt>
<dd class="tags">
<button type="button">Computer Science</button>
</dd>
<dd>The preexisting value of a user-configurable setting that is assigned to a software application, computer program or device. Such settings are also called presets or factory presets, especially for electronic devices.</dd>
</div>
<div data-id="903bec65-572b-46bb-912b-f032dc08e1d5" data-last-updated="2023-10-30T08:25:24.765Z">
<dt>
<dfn id="Default_(Finance)">
<a href="#Default_(Finance)">
<span>Default</span>
<span class="disambiguation">(Finance)</span>
</a>
</dfn>
</dt>
<dd class="tags">
<button type="button">Finance</button>
</dd>
<dd>In finance, default is failure to meet the legal obligations (or conditions) of a loan, for example when a home buyer fails to make a mortgage payment, or when a corporation or government fails to pay a bond which has reached maturity. A national or sovereign default is the failure or refusal of a government to repay its national debt.</dd>
<dd class="related-terms">See also: <a href="#Loan">Loan</a></dd>
</div>
<div data-id="2ad48999-92e1-468f-9149-0f2a7e2dbcfb" data-last-updated="2023-09-16T07:09:19.630Z">
<dt>
<dfn id="Information_retrieval">
<a href="#Information_retrieval">
Information retrieval
</a>
</dfn>
</dt>
<dt>
<dfn>
<abbr>
IR
</abbr>
</dfn>
</dt>
<dd class="tags">
<button type="button">Computer Science</button>
</dd>
<dd>Information retrieval (IR) in computing and information science is the process of obtaining information system resources that are relevant to an information need from a collection of those resources. Searches can be based on full-text or other content-based indexing.</dd>
</div>
<div data-id="a6eb19d3-cade-4713-95d1-89a879503154" data-last-updated="2023-10-30T08:25:30.335Z">
<dt>
<dfn id="Interest_rate">
<a href="#Interest_rate">
Interest rate
</a>
</dfn>
</dt>
<dt>
<dfn>
<abbr>
IR
</abbr>
</dfn>
</dt>
<dd class="tags">
<button type="button">Finance</button>
</dd>
<dd>An interest rate is the amount of interest due per period, as a proportion of the amount lent, deposited, or borrowed (called the principal sum). The total interest on an amount lent or borrowed depends on the principal sum, the interest rate, the compounding frequency, and the length of time over which it is lent, deposited, or borrowed.</dd>
<dd class="related-terms">See also: <a href="#Loan">Loan</a></dd>
</div>
<div data-id="a7a13643-abce-4d03-9f8c-e8c569a3dc26" data-last-updated="2023-10-30T08:26:18.523Z">
<dt>
<dfn id="Loan">
<a href="#Loan">
Loan
</a>
</dfn>
</dt>
<dd class="tags">
<button type="button">Finance</button>
</dd>
<dd>The transfer of money by one party to another with an agreement to pay it back. The recipient, or borrower, incurs a debt and is usually required to pay interest for the use of the money.</dd>
<dd class="related-terms">See also: <a href="#Interest_rate">Interest rate</a></dd>
</div>
<div data-id="493dee3f-c2a7-4019-9616-bcca6c8c3a13" data-last-updated="2023-08-09T18:32:16.191Z">
<dt>
<dfn id="Markdown">
<a href="#Markdown">
Markdown
</a>
</dfn>
</dt>
<dd>A lightweight markup language for creating formatted text. You can use this to do relatively simple things like
* making text _italic_ or **bold**
* creating [links](https://en.wikipedia.org/wiki/Hyperlink)
or even include images or tables as below.
<img src="https://glstatic.net/glossary-page-template-favicons/safari-pinned-tab.svg?v=2" style="background-color: white; opacity: 0.85; padding: 0.125rem; border-radius: 0.375rem" width="50" alt="Example image" />
| Thousands | Hundreds | Tens | Units |
| --- | --- | --- | ---|
| M | C | X | I |
| MM | CC | XX | II |
| MMM | CCC | XXX | III |
See [Markdown Reference](https://commonmark.org/help/) for more information.</dd>
</div>
</dl>
</article>
</main>
<footer>
Built using
<a target="_blank" href="https://glossary.page/template">Glossary Page Template</a>
.
</footer>
</div>
</body>
</html>
<!--
#!/usr/bin/env node
/* START OF editor.js
This script starts a simple server listening on localhost.
* GET requests are served by local HTML/JS/CSS files.
* PATCH requests to / expect to receive an HTML fragment string in the body.
This string is used to update the glossary file, replacing
<div id="glossary-page-container"
...
</div>.
This allows the editor to save any updates made in the UI.
*/
const http = require('http');
const fs = require('fs');
const path = require('path');
const HOST = process.env['HOST'] || 'localhost';
const PORT = process.env['PORT'] || 3003;
const FILE = process.env['FILE'] || './glossary.html';
const mimeTypes = {
'.html': 'text/html',
'.js': 'text/javascript',
'.css': 'text/css'
};
const server = http.createServer(async (req, res) => {
if (req.url === '/' && req.method === 'PATCH') {
const buffers = [];
for await (const chunk of req) {
buffers.push(chunk);
}
const body = Buffer.concat(buffers).toString();
replaceGlossaryElementInFile(body);
res.writeHead(204).end();
} else {
serveLocalFile(req, res);
}
});
server.listen(PORT, HOST, () => {
console.log(`Server started at http://${HOST}:${PORT}`);
});
function serveLocalFile(req, res) {
var filePath = '.' + req.url.replace(/\?.*$/g, '');
if (filePath === './') filePath = FILE;
const extname = String(path.extname(filePath)).toLowerCase();
const contentType = mimeTypes[extname] || 'application/octet-stream';
fs.readFile(filePath, 'utf-8', (err, fileContents) => {
if (err) {
serveErrorPage(err, res);
} else {
if (filePath === FILE)
fileContents = fileContents.replace(
/<div id="glossary-page-container"/,
`<div id="glossary-page-container" data-editor-is-running="true"`
);
res.writeHead(200, { 'Content-Type': contentType });
res.end(fileContents, 'utf-8');
}
});
}
function serveErrorPage(err, res) {
if (err.code == 'ENOENT') {
res.writeHead(404, { 'Content-Type': 'text/html' });
res.end('<html><body>Page not found</body></html>');
} else {
res.writeHead(500, { 'Content-Type': 'text/html' });
res.end('<html><body>Internal server error</body></html>');
}
}
function replaceGlossaryElementInFile(newElementString) {
fs.readFile(FILE, 'utf8', (err, fileContents) => {
if (err) return console.log(err);
const regex = /\n[ \t]*<div id="glossary-page-container".*<\/div>\n/s;
if (!fileContents.replace(regex, 'replacing-worked').includes('replacing-worked')) {
return console.log(`Unable to save changes using the regex ${regex}`);
}
const updatedFileContents = fileContents.replace(regex, "\n" + newElementString + "\n");
fs.writeFile(FILE, updatedFileContents, 'utf8', (err) => {
if (err) return console.log(err);
});
});
}
// -->