t-doc-common 0.6.dev2__tar.gz → 0.8__tar.gz
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.
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/.gitignore +1 -1
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/.hgignore +1 -1
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/.hgtags +3 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/LICENSES.deps.txt +49 -49
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/PKG-INFO +1 -1
- t_doc_common-0.8/docs/demo/people.sql +11 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/docs/demo/sql.md +50 -18
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/docs/install.md +8 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/package-lock.json +20 -17
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/package.json +7 -3
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/pyproject.toml +6 -2
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/rollup.config.mjs +9 -15
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/tdoc/common/__init__.py +45 -19
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/tdoc/common/cli.py +9 -8
- t_doc_common-0.8/tdoc/common/scripts/tdoc-editor.js +103 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/tdoc/common/static/styles/t-doc.css +30 -5
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/tdoc/common/static/tdoc-sql.js +94 -44
- {t_doc_common-0.6.dev2/ext/sqlite-wasm/sqlite-wasm/jswasm → t_doc_common-0.8/tdoc/common/static.gen}/sqlite3-bundler-friendly.mjs +19 -10
- {t_doc_common-0.6.dev2/ext/sqlite-wasm/sqlite-wasm/jswasm → t_doc_common-0.8/tdoc/common/static.gen}/sqlite3-node.mjs +7 -7
- {t_doc_common-0.6.dev2/ext/sqlite-wasm/sqlite-wasm/jswasm → t_doc_common-0.8/tdoc/common/static.gen}/sqlite3-opfs-async-proxy.js +14 -147
- {t_doc_common-0.6.dev2/ext/sqlite-wasm/sqlite-wasm/jswasm → t_doc_common-0.8/tdoc/common/static.gen}/sqlite3.js +19 -10
- {t_doc_common-0.6.dev2/ext/sqlite-wasm/sqlite-wasm/jswasm → t_doc_common-0.8/tdoc/common/static.gen}/sqlite3.mjs +19 -10
- {t_doc_common-0.6.dev2/ext/sqlite-wasm/sqlite-wasm/jswasm → t_doc_common-0.8/tdoc/common/static.gen}/sqlite3.wasm +0 -0
- t_doc_common-0.8/tdoc/common/static.gen/tdoc-editor.js +30270 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/tools/hatch_hooks.py +6 -2
- t_doc_common-0.6.dev2/.gitmodules +0 -3
- t_doc_common-0.6.dev2/.hgsub +0 -1
- t_doc_common-0.6.dev2/.hgsubstate +0 -1
- t_doc_common-0.6.dev2/ext/sqlite-wasm/.gitignore +0 -43
- t_doc_common-0.6.dev2/ext/sqlite-wasm/.prettierrc +0 -20
- t_doc_common-0.6.dev2/ext/sqlite-wasm/README.md +0 -234
- t_doc_common-0.6.dev2/ext/sqlite-wasm/bin/index.js +0 -61
- t_doc_common-0.6.dev2/ext/sqlite-wasm/demo/index.html +0 -19
- t_doc_common-0.6.dev2/ext/sqlite-wasm/demo/main-thread.js +0 -53
- t_doc_common-0.6.dev2/ext/sqlite-wasm/demo/module-workers-polyfill.min.js +0 -218
- t_doc_common-0.6.dev2/ext/sqlite-wasm/demo/script.js +0 -42
- t_doc_common-0.6.dev2/ext/sqlite-wasm/demo/worker.js +0 -56
- t_doc_common-0.6.dev2/ext/sqlite-wasm/demo/wrapped-worker.js +0 -72
- t_doc_common-0.6.dev2/ext/sqlite-wasm/index.d.ts +0 -8073
- t_doc_common-0.6.dev2/ext/sqlite-wasm/index.mjs +0 -7
- t_doc_common-0.6.dev2/ext/sqlite-wasm/package-lock.json +0 -1993
- t_doc_common-0.6.dev2/ext/sqlite-wasm/package.json +0 -65
- t_doc_common-0.6.dev2/tdoc/common/scripts/tdoc-editor.js +0 -27
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/.github/workflows/deploy-github-pages.yml +0 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/.github/workflows/publish.yml +0 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/LICENSE.txt +0 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/README.md +0 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/docs/conf.py +0 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/docs/demo/index.md +0 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/docs/development.md +0 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/docs/edit.md +0 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/docs/index.md +0 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/serve.bat +0 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/serve.desktop +0 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/tdoc/common/components/copyright.html +0 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/tdoc/common/defaults.py +0 -0
- {t_doc_common-0.6.dev2/ext/sqlite-wasm/sqlite-wasm/jswasm → t_doc_common-0.8/tdoc/common/static.gen}/sqlite3-worker1-bundler-friendly.mjs +0 -0
- {t_doc_common-0.6.dev2/ext/sqlite-wasm/sqlite-wasm/jswasm → t_doc_common-0.8/tdoc/common/static.gen}/sqlite3-worker1-promiser.js +0 -0
- {t_doc_common-0.6.dev2/ext/sqlite-wasm/sqlite-wasm/jswasm → t_doc_common-0.8/tdoc/common/static.gen}/sqlite3-worker1-promiser.mjs +0 -0
- {t_doc_common-0.6.dev2/ext/sqlite-wasm/sqlite-wasm/jswasm → t_doc_common-0.8/tdoc/common/static.gen}/sqlite3-worker1.js +0 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/tdoc/common/theme.toml +0 -0
- {t_doc_common-0.6.dev2 → t_doc_common-0.8}/tdoc/common/util.py +0 -0
|
@@ -2,3 +2,6 @@
|
|
|
2
2
|
ea2973414a3779c7ffbed73279ab8d811c795268 0.3
|
|
3
3
|
dcb01efb897d0e04063b92998c17b02b587761c7 0.4
|
|
4
4
|
e4ac6c10dd9194ff48c95d82e462e45bbd651ef1 0.5
|
|
5
|
+
145a6ae1f8e1a445a9a13c687c17bf587b48522f 0.6
|
|
6
|
+
f5adc3e31d10e2b5478fe2e041b936159dd5c1c0 0.7
|
|
7
|
+
23e15db6feceb801732e75bd5de0a56a7c4b06d0 0.8
|
|
@@ -233,12 +233,12 @@ THE SOFTWARE.
|
|
|
233
233
|
|
|
234
234
|
---
|
|
235
235
|
|
|
236
|
-
Name: @codemirror/
|
|
237
|
-
Version: 6.
|
|
236
|
+
Name: @codemirror/autocomplete
|
|
237
|
+
Version: 6.18.0
|
|
238
238
|
License: MIT
|
|
239
239
|
Private: false
|
|
240
|
-
Description:
|
|
241
|
-
Repository: https://github.com/codemirror/
|
|
240
|
+
Description: Autocompletion for the CodeMirror code editor
|
|
241
|
+
Repository: https://github.com/codemirror/autocomplete.git
|
|
242
242
|
Author: Marijn Haverbeke <marijn@haverbeke.berlin> (http://marijnhaverbeke.nl)
|
|
243
243
|
License Copyright:
|
|
244
244
|
===
|
|
@@ -267,18 +267,19 @@ THE SOFTWARE.
|
|
|
267
267
|
|
|
268
268
|
---
|
|
269
269
|
|
|
270
|
-
Name:
|
|
271
|
-
Version:
|
|
270
|
+
Name: @codemirror/commands
|
|
271
|
+
Version: 6.6.1
|
|
272
272
|
License: MIT
|
|
273
273
|
Private: false
|
|
274
|
-
Description:
|
|
275
|
-
Repository:
|
|
276
|
-
|
|
277
|
-
Author: Marijn Haverbeke <marijn@haverbeke.berlin>
|
|
274
|
+
Description: Collection of editing commands for the CodeMirror code editor
|
|
275
|
+
Repository: https://github.com/codemirror/commands.git
|
|
276
|
+
Author: Marijn Haverbeke <marijn@haverbeke.berlin> (http://marijnhaverbeke.nl)
|
|
278
277
|
License Copyright:
|
|
279
278
|
===
|
|
280
279
|
|
|
281
|
-
|
|
280
|
+
MIT License
|
|
281
|
+
|
|
282
|
+
Copyright (C) 2018-2021 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
|
|
282
283
|
|
|
283
284
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
284
285
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -300,19 +301,18 @@ THE SOFTWARE.
|
|
|
300
301
|
|
|
301
302
|
---
|
|
302
303
|
|
|
303
|
-
Name:
|
|
304
|
-
Version:
|
|
304
|
+
Name: crelt
|
|
305
|
+
Version: 1.0.6
|
|
305
306
|
License: MIT
|
|
306
307
|
Private: false
|
|
307
|
-
Description:
|
|
308
|
-
Repository: https://github.com/
|
|
309
|
-
|
|
308
|
+
Description: Tiny DOM-element-creation utility
|
|
309
|
+
Repository: git+https://github.com/marijnh/crelt.git
|
|
310
|
+
Homepage: https://github.com/marijnh/crelt#readme
|
|
311
|
+
Author: Marijn Haverbeke <marijn@haverbeke.berlin>
|
|
310
312
|
License Copyright:
|
|
311
313
|
===
|
|
312
314
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
Copyright (C) 2018-2021 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
|
|
315
|
+
Copyright (C) 2020 by Marijn Haverbeke <marijn@haverbeke.berlin>
|
|
316
316
|
|
|
317
317
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
318
318
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -334,12 +334,12 @@ THE SOFTWARE.
|
|
|
334
334
|
|
|
335
335
|
---
|
|
336
336
|
|
|
337
|
-
Name: @codemirror/
|
|
338
|
-
Version: 6.
|
|
337
|
+
Name: @codemirror/lint
|
|
338
|
+
Version: 6.8.1
|
|
339
339
|
License: MIT
|
|
340
340
|
Private: false
|
|
341
|
-
Description:
|
|
342
|
-
Repository: https://github.com/codemirror/
|
|
341
|
+
Description: Linting support for the CodeMirror code editor
|
|
342
|
+
Repository: https://github.com/codemirror/lint.git
|
|
343
343
|
Author: Marijn Haverbeke <marijn@haverbeke.berlin> (http://marijnhaverbeke.nl)
|
|
344
344
|
License Copyright:
|
|
345
345
|
===
|
|
@@ -368,12 +368,12 @@ THE SOFTWARE.
|
|
|
368
368
|
|
|
369
369
|
---
|
|
370
370
|
|
|
371
|
-
Name: @codemirror/
|
|
372
|
-
Version: 6.
|
|
371
|
+
Name: @codemirror/search
|
|
372
|
+
Version: 6.5.6
|
|
373
373
|
License: MIT
|
|
374
374
|
Private: false
|
|
375
|
-
Description:
|
|
376
|
-
Repository: https://github.com/codemirror/
|
|
375
|
+
Description: Search functionality for the CodeMirror code editor
|
|
376
|
+
Repository: https://github.com/codemirror/search.git
|
|
377
377
|
Author: Marijn Haverbeke <marijn@haverbeke.berlin> (http://marijnhaverbeke.nl)
|
|
378
378
|
License Copyright:
|
|
379
379
|
===
|
|
@@ -402,19 +402,19 @@ THE SOFTWARE.
|
|
|
402
402
|
|
|
403
403
|
---
|
|
404
404
|
|
|
405
|
-
Name: codemirror
|
|
406
|
-
Version: 6.
|
|
405
|
+
Name: @codemirror/theme-one-dark
|
|
406
|
+
Version: 6.1.2
|
|
407
407
|
License: MIT
|
|
408
408
|
Private: false
|
|
409
|
-
Description:
|
|
410
|
-
Repository: https://github.com/codemirror/
|
|
411
|
-
Author: Marijn Haverbeke <
|
|
409
|
+
Description: One Dark theme for the CodeMirror code editor
|
|
410
|
+
Repository: https://github.com/codemirror/theme-one-dark.git
|
|
411
|
+
Author: Marijn Haverbeke <marijn@haverbeke.berlin> (http://marijnhaverbeke.nl)
|
|
412
412
|
License Copyright:
|
|
413
413
|
===
|
|
414
414
|
|
|
415
415
|
MIT License
|
|
416
416
|
|
|
417
|
-
Copyright (C) 2018-2021 by Marijn Haverbeke <
|
|
417
|
+
Copyright (C) 2018-2021 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
|
|
418
418
|
|
|
419
419
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
420
420
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -572,19 +572,19 @@ THE SOFTWARE.
|
|
|
572
572
|
|
|
573
573
|
---
|
|
574
574
|
|
|
575
|
-
Name: @
|
|
576
|
-
Version:
|
|
575
|
+
Name: @lezer/javascript
|
|
576
|
+
Version: 1.4.17
|
|
577
577
|
License: MIT
|
|
578
578
|
Private: false
|
|
579
|
-
Description:
|
|
580
|
-
Repository: https://github.com/
|
|
581
|
-
Author: Marijn Haverbeke <marijn@haverbeke.berlin>
|
|
579
|
+
Description: lezer-based JavaScript grammar
|
|
580
|
+
Repository: https://github.com/lezer-parser/javascript.git
|
|
581
|
+
Author: Marijn Haverbeke <marijn@haverbeke.berlin>
|
|
582
582
|
License Copyright:
|
|
583
583
|
===
|
|
584
584
|
|
|
585
585
|
MIT License
|
|
586
586
|
|
|
587
|
-
Copyright (C) 2018
|
|
587
|
+
Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
|
|
588
588
|
|
|
589
589
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
590
590
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -606,19 +606,19 @@ THE SOFTWARE.
|
|
|
606
606
|
|
|
607
607
|
---
|
|
608
608
|
|
|
609
|
-
Name: @
|
|
610
|
-
Version:
|
|
609
|
+
Name: @codemirror/lang-javascript
|
|
610
|
+
Version: 6.2.2
|
|
611
611
|
License: MIT
|
|
612
612
|
Private: false
|
|
613
|
-
Description:
|
|
614
|
-
Repository: https://github.com/
|
|
615
|
-
Author: Marijn Haverbeke <marijn@haverbeke.berlin>
|
|
613
|
+
Description: JavaScript language support for the CodeMirror code editor
|
|
614
|
+
Repository: https://github.com/codemirror/lang-javascript.git
|
|
615
|
+
Author: Marijn Haverbeke <marijn@haverbeke.berlin> (http://marijnhaverbeke.nl)
|
|
616
616
|
License Copyright:
|
|
617
617
|
===
|
|
618
618
|
|
|
619
619
|
MIT License
|
|
620
620
|
|
|
621
|
-
Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
|
|
621
|
+
Copyright (C) 2018-2021 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
|
|
622
622
|
|
|
623
623
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
624
624
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -640,12 +640,12 @@ THE SOFTWARE.
|
|
|
640
640
|
|
|
641
641
|
---
|
|
642
642
|
|
|
643
|
-
Name: @codemirror/lang-
|
|
644
|
-
Version: 6.
|
|
643
|
+
Name: @codemirror/lang-html
|
|
644
|
+
Version: 6.4.9
|
|
645
645
|
License: MIT
|
|
646
646
|
Private: false
|
|
647
|
-
Description:
|
|
648
|
-
Repository: https://github.com/codemirror/lang-
|
|
647
|
+
Description: HTML language support for the CodeMirror code editor
|
|
648
|
+
Repository: https://github.com/codemirror/lang-html.git
|
|
649
649
|
Author: Marijn Haverbeke <marijn@haverbeke.berlin> (http://marijnhaverbeke.nl)
|
|
650
650
|
License Copyright:
|
|
651
651
|
===
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
create table people (
|
|
2
|
+
first_name text not null,
|
|
3
|
+
last_name text not null,
|
|
4
|
+
height real,
|
|
5
|
+
favorite_food text
|
|
6
|
+
);
|
|
7
|
+
insert into people values
|
|
8
|
+
('Joe', 'Bar', 1.83, null),
|
|
9
|
+
('Jack', 'Smith', 1.55, 'burgers'),
|
|
10
|
+
('Jim', 'Davis', null, 'pizza'),
|
|
11
|
+
('Anthony', 'Miller', 1.78, null);
|
|
@@ -15,16 +15,24 @@ described below.
|
|
|
15
15
|
|
|
16
16
|
{.rubric}
|
|
17
17
|
Options
|
|
18
|
-
```{rst:directive:option} after: name
|
|
18
|
+
```{rst:directive:option} after: name [name...]
|
|
19
19
|
:type: text
|
|
20
|
-
References
|
|
21
|
-
environment. The referenced
|
|
22
|
-
a
|
|
20
|
+
References one or more `{exec}` blocks to be executed before this block, in the
|
|
21
|
+
same environment. The referenced blocks can themselves have an `:after:` option,
|
|
22
|
+
forming a tree of blocks to execute in the environment. If a block appears on
|
|
23
|
+
more than one tree branch, only the first occurrence is executed.
|
|
24
|
+
```
|
|
25
|
+
```{rst:directive:option} editable
|
|
26
|
+
When set, the `{exec}` block is made editable.
|
|
27
|
+
```
|
|
28
|
+
```{rst:directive:option} include: path [path...]
|
|
29
|
+
:type: relative paths
|
|
30
|
+
When set, prepend the content of one or more files to the block's content.
|
|
23
31
|
```
|
|
24
32
|
```{rst:directive:option} when: value
|
|
25
33
|
:type: click | load | never
|
|
26
|
-
Determines when the block's code is executed: on
|
|
27
|
-
when the page loads (`load`) or not at all (`never`).
|
|
34
|
+
Determines when the block's code is executed: on user request (`click`, the
|
|
35
|
+
default), when the page loads (`load`) or not at all (`never`).
|
|
28
36
|
```
|
|
29
37
|
````
|
|
30
38
|
|
|
@@ -37,20 +45,20 @@ A database can be defined as a named `{exec} sql` block, to be referenced in the
|
|
|
37
45
|
:name: sql-countries
|
|
38
46
|
:when: never
|
|
39
47
|
create table countries (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
country text not null,
|
|
49
|
+
country_code text not null,
|
|
50
|
+
dial_code text not null,
|
|
51
|
+
capital text not null,
|
|
52
|
+
population int not null,
|
|
53
|
+
food text
|
|
46
54
|
);
|
|
47
55
|
insert into countries values
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
('Switzerland', 'CH', '+41', 'Bern', 8776000, 'fondue!'),
|
|
57
|
+
('France', 'FR', '+33', 'Paris', 67970000, null),
|
|
58
|
+
('Germany', 'DE', '+49', 'Berlin', 83800000, null),
|
|
59
|
+
('Italy', 'IT', '+39', 'Rome', 58940000, null),
|
|
60
|
+
('Austria', 'AT', '+43', 'Vienna', 9042000, 'Kaiserschmarrn'),
|
|
61
|
+
('Lichtenstein', 'LI', '+423', 'Vaduz', 39327, null);
|
|
54
62
|
```
|
|
55
63
|
|
|
56
64
|
## Queries
|
|
@@ -110,3 +118,27 @@ select * from countries where country_code = 'LI';
|
|
|
110
118
|
They can also be executed immediately on load (`:when: load`) or not at all
|
|
111
119
|
(`:when: never`, useful for database definitions that are referenced by other
|
|
112
120
|
blocks). In these cases, no controls aren displayed.
|
|
121
|
+
|
|
122
|
+
## Editable blocks
|
|
123
|
+
|
|
124
|
+
Blocks can be made editable with the `:editable:` option.
|
|
125
|
+
|
|
126
|
+
```{exec} sql
|
|
127
|
+
:after: sql-countries
|
|
128
|
+
:when: load
|
|
129
|
+
:editable:
|
|
130
|
+
select * from countries
|
|
131
|
+
where population > 10000000
|
|
132
|
+
order by country_code;
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Include file content
|
|
136
|
+
|
|
137
|
+
Blocks can reference one or more external files to be included. The content of
|
|
138
|
+
the files is prepended to the block's content.
|
|
139
|
+
|
|
140
|
+
```{exec} sql
|
|
141
|
+
:include: people.sql
|
|
142
|
+
:when: load
|
|
143
|
+
select * from people;
|
|
144
|
+
```
|
|
@@ -114,6 +114,14 @@ t-doc requires the following software to be installed:
|
|
|
114
114
|
```{code-block} shell-session
|
|
115
115
|
python -m pip install --upgrade t-doc-common
|
|
116
116
|
```
|
|
117
|
+
If you get the following error, then a [local server](edit.md#edit-documents)
|
|
118
|
+
is running. Stop it with {kbd}`Ctrl+C` or by closing its terminal window, then
|
|
119
|
+
try again.
|
|
120
|
+
```
|
|
121
|
+
ERROR: Could not install packages due to an OSError: [WinError 32] The process
|
|
122
|
+
cannot access the file because it is being used by another process:
|
|
123
|
+
'c:\\users\\...\\scripts\\tdoc.exe'
|
|
124
|
+
```
|
|
117
125
|
````
|
|
118
126
|
````{tab-item} macOS
|
|
119
127
|
:sync: macos
|
|
@@ -6,15 +6,21 @@
|
|
|
6
6
|
"": {
|
|
7
7
|
"name": "t-doc-common",
|
|
8
8
|
"devDependencies": {
|
|
9
|
+
"@codemirror/autocomplete": "^6.18.0",
|
|
10
|
+
"@codemirror/commands": "^6.6.1",
|
|
9
11
|
"@codemirror/lang-css": "^6.2.1",
|
|
10
12
|
"@codemirror/lang-html": "^6.4.9",
|
|
11
13
|
"@codemirror/lang-javascript": "^6.2.2",
|
|
12
14
|
"@codemirror/lang-python": "^6.1.6",
|
|
13
15
|
"@codemirror/lang-sql": "^6.7.1",
|
|
16
|
+
"@codemirror/language": "^6.10.2",
|
|
17
|
+
"@codemirror/lint": "^6.8.1",
|
|
18
|
+
"@codemirror/search": "^6.5.6",
|
|
19
|
+
"@codemirror/state": "^6.4.1",
|
|
20
|
+
"@codemirror/theme-one-dark": "^6.1.2",
|
|
14
21
|
"@codemirror/view": "^6.33.0",
|
|
15
22
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
16
23
|
"@sqlite.org/sqlite-wasm": "^3.46.1-build1",
|
|
17
|
-
"codemirror": "^6.0.1",
|
|
18
24
|
"rollup": "^4.21.2",
|
|
19
25
|
"rollup-plugin-license": "^3.5.2"
|
|
20
26
|
}
|
|
@@ -174,6 +180,19 @@
|
|
|
174
180
|
"dev": true,
|
|
175
181
|
"license": "MIT"
|
|
176
182
|
},
|
|
183
|
+
"node_modules/@codemirror/theme-one-dark": {
|
|
184
|
+
"version": "6.1.2",
|
|
185
|
+
"resolved": "https://registry.npmjs.org/@codemirror/theme-one-dark/-/theme-one-dark-6.1.2.tgz",
|
|
186
|
+
"integrity": "sha512-F+sH0X16j/qFLMAfbciKTxVOwkdAS336b7AXTKOZhy8BR3eH/RelsnLgLFINrpST63mmN2OuwUt0W2ndUgYwUA==",
|
|
187
|
+
"dev": true,
|
|
188
|
+
"license": "MIT",
|
|
189
|
+
"dependencies": {
|
|
190
|
+
"@codemirror/language": "^6.0.0",
|
|
191
|
+
"@codemirror/state": "^6.0.0",
|
|
192
|
+
"@codemirror/view": "^6.0.0",
|
|
193
|
+
"@lezer/highlight": "^1.0.0"
|
|
194
|
+
}
|
|
195
|
+
},
|
|
177
196
|
"node_modules/@codemirror/view": {
|
|
178
197
|
"version": "6.33.0",
|
|
179
198
|
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.33.0.tgz",
|
|
@@ -588,22 +607,6 @@
|
|
|
588
607
|
"url": "https://github.com/sponsors/sindresorhus"
|
|
589
608
|
}
|
|
590
609
|
},
|
|
591
|
-
"node_modules/codemirror": {
|
|
592
|
-
"version": "6.0.1",
|
|
593
|
-
"resolved": "https://registry.npmjs.org/codemirror/-/codemirror-6.0.1.tgz",
|
|
594
|
-
"integrity": "sha512-J8j+nZ+CdWmIeFIGXEFbFPtpiYacFMDR8GlHK3IyHQJMCaVRfGx9NT+Hxivv1ckLWPvNdZqndbr/7lVhrf/Svg==",
|
|
595
|
-
"dev": true,
|
|
596
|
-
"license": "MIT",
|
|
597
|
-
"dependencies": {
|
|
598
|
-
"@codemirror/autocomplete": "^6.0.0",
|
|
599
|
-
"@codemirror/commands": "^6.0.0",
|
|
600
|
-
"@codemirror/language": "^6.0.0",
|
|
601
|
-
"@codemirror/lint": "^6.0.0",
|
|
602
|
-
"@codemirror/search": "^6.0.0",
|
|
603
|
-
"@codemirror/state": "^6.0.0",
|
|
604
|
-
"@codemirror/view": "^6.0.0"
|
|
605
|
-
}
|
|
606
|
-
},
|
|
607
610
|
"node_modules/commenting": {
|
|
608
611
|
"version": "1.1.0",
|
|
609
612
|
"resolved": "https://registry.npmjs.org/commenting/-/commenting-1.1.0.tgz",
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"dependencies": {
|
|
3
|
-
},
|
|
4
2
|
"devDependencies": {
|
|
3
|
+
"@codemirror/autocomplete": "^6.18.0",
|
|
4
|
+
"@codemirror/commands": "^6.6.1",
|
|
5
5
|
"@codemirror/lang-css": "^6.2.1",
|
|
6
6
|
"@codemirror/lang-html": "^6.4.9",
|
|
7
7
|
"@codemirror/lang-javascript": "^6.2.2",
|
|
8
8
|
"@codemirror/lang-python": "^6.1.6",
|
|
9
9
|
"@codemirror/lang-sql": "^6.7.1",
|
|
10
|
+
"@codemirror/language": "^6.10.2",
|
|
11
|
+
"@codemirror/lint": "^6.8.1",
|
|
12
|
+
"@codemirror/search": "^6.5.6",
|
|
13
|
+
"@codemirror/state": "^6.4.1",
|
|
14
|
+
"@codemirror/theme-one-dark": "^6.1.2",
|
|
10
15
|
"@codemirror/view": "^6.33.0",
|
|
11
16
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
12
17
|
"@sqlite.org/sqlite-wasm": "^3.46.1-build1",
|
|
13
|
-
"codemirror": "^6.0.1",
|
|
14
18
|
"rollup": "^4.21.2",
|
|
15
19
|
"rollup-plugin-license": "^3.5.2"
|
|
16
20
|
},
|
|
@@ -53,10 +53,14 @@ path = "tools/hatch_hooks.py"
|
|
|
53
53
|
path = "tools/hatch_hooks.py"
|
|
54
54
|
|
|
55
55
|
[tool.hatch.build.targets.sdist]
|
|
56
|
+
artifacts = [
|
|
57
|
+
"/tdoc/common/static.gen/",
|
|
58
|
+
]
|
|
56
59
|
|
|
57
60
|
[tool.hatch.build.targets.wheel]
|
|
58
61
|
only-include = [
|
|
59
|
-
"ext/sqlite-wasm/sqlite-wasm/jswasm",
|
|
60
62
|
"tdoc",
|
|
61
63
|
]
|
|
62
|
-
|
|
64
|
+
artifacts = [
|
|
65
|
+
"/tdoc/common/static.gen/",
|
|
66
|
+
]
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copyright 2024 Remy Blank <remy@c-space.org>
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import url from 'node:url';
|
|
4
|
+
import * as path from 'node:path';
|
|
5
|
+
import * as url from 'node:url';
|
|
6
6
|
import resolve from '@rollup/plugin-node-resolve';
|
|
7
7
|
import license from 'rollup-plugin-license';
|
|
8
8
|
|
|
@@ -11,29 +11,23 @@ import license from 'rollup-plugin-license';
|
|
|
11
11
|
const __filename = import.meta.filename || url.fileURLToPath(import.meta.url)
|
|
12
12
|
const __dirname = import.meta.dirname || path.dirname(__filename)
|
|
13
13
|
|
|
14
|
+
// TODO: Package @sqlite.org/sqlite-wasm. Or maybe it must be an external
|
|
15
|
+
// because of the worker module and .wasm.
|
|
16
|
+
|
|
14
17
|
export default {
|
|
15
18
|
input: "./tdoc/common/scripts/tdoc-editor.js",
|
|
16
19
|
output: {
|
|
17
|
-
chunkFileNames: '[name].
|
|
20
|
+
chunkFileNames: '[name].js',
|
|
18
21
|
compact: true,
|
|
19
|
-
dir: './tdoc/common/static/',
|
|
20
|
-
entryFileNames: '[name].
|
|
22
|
+
dir: './tdoc/common/static.gen/',
|
|
23
|
+
entryFileNames: '[name].js',
|
|
21
24
|
format: 'es',
|
|
22
25
|
generatedCode: {
|
|
23
26
|
arrowFunctions: true,
|
|
24
27
|
constBindings: true,
|
|
25
28
|
objectShorthand: true,
|
|
26
29
|
},
|
|
27
|
-
|
|
28
|
-
// be an external because of the worker module and .wasm
|
|
29
|
-
manualChunks: {
|
|
30
|
-
'tdoc-cm': ['codemirror'],
|
|
31
|
-
'tdoc-cm-css': ['@codemirror/lang-css'],
|
|
32
|
-
'tdoc-cm-html': ['@codemirror/lang-html'],
|
|
33
|
-
'tdoc-cm-javascript': ['@codemirror/lang-javascript'],
|
|
34
|
-
'tdoc-cm-python': ['@codemirror/lang-python'],
|
|
35
|
-
'tdoc-cm-sql': ['@codemirror/lang-sql'],
|
|
36
|
-
},
|
|
30
|
+
manualChunks: {},
|
|
37
31
|
},
|
|
38
32
|
plugins: [
|
|
39
33
|
resolve(),
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
import pathlib
|
|
5
5
|
import re
|
|
6
6
|
|
|
7
|
-
from docutils import nodes
|
|
7
|
+
from docutils import nodes, statemachine
|
|
8
8
|
from docutils.parsers.rst import directives
|
|
9
9
|
from sphinx.directives.code import CodeBlock
|
|
10
10
|
from sphinx.util import logging
|
|
11
11
|
|
|
12
12
|
__project__ = 't-doc-common'
|
|
13
|
-
__version__ = '0.
|
|
13
|
+
__version__ = '0.8'
|
|
14
14
|
|
|
15
15
|
_common = pathlib.Path(__file__).absolute().parent
|
|
16
16
|
_root = _common.parent.parent
|
|
@@ -48,6 +48,20 @@ def setup(app):
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
|
|
51
|
+
def report_exceptions(fn):
|
|
52
|
+
def wrapper(self, /, *args, **kwargs):
|
|
53
|
+
try:
|
|
54
|
+
return fn(self, *args, **kwargs)
|
|
55
|
+
except Exception as e:
|
|
56
|
+
return [self.state.document.reporter.warning(e, line=self.lineno)]
|
|
57
|
+
return wrapper
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def format_data_attrs(translator, /, **kwargs):
|
|
61
|
+
return ' '.join(f'data-tdoc-{k}="{translator.attval(v)}"'
|
|
62
|
+
for k, v in sorted(kwargs.items()) if v is not None)
|
|
63
|
+
|
|
64
|
+
|
|
51
65
|
def on_config_inited(app, config):
|
|
52
66
|
cv = config.values['html_title']
|
|
53
67
|
super(cv.__class__, cv).__setattr__('default', lambda c: c.project)
|
|
@@ -65,9 +79,11 @@ def on_config_inited(app, config):
|
|
|
65
79
|
def on_builder_inited(app):
|
|
66
80
|
# Add our own static paths.
|
|
67
81
|
app.config.html_static_path.append(str(_common / 'static'))
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
82
|
+
app.config.html_static_path.append(str(_common / 'static.gen'))
|
|
83
|
+
sqlite_path = (_root / 'node_modules' / '@sqlite.org' / 'sqlite-wasm'
|
|
84
|
+
/ 'sqlite-wasm' / 'jswasm')
|
|
85
|
+
if sqlite_path.is_dir():
|
|
86
|
+
app.config.html_static_path.append(str(sqlite_path))
|
|
71
87
|
|
|
72
88
|
|
|
73
89
|
def on_html_page_context(app, page, template, context, doctree):
|
|
@@ -82,19 +98,16 @@ def on_html_page_context(app, page, template, context, doctree):
|
|
|
82
98
|
# TODO: Work around inability to specify headers on GitHub Pages
|
|
83
99
|
|
|
84
100
|
|
|
85
|
-
def format_data_attrs(translator, /, **kwargs):
|
|
86
|
-
return ' '.join(f'data-tdoc-{k}="{translator.attval(v)}"'
|
|
87
|
-
for k, v in sorted(kwargs.items()) if v is not None)
|
|
88
|
-
|
|
89
|
-
|
|
90
101
|
class ExecBlock(nodes.literal_block): pass
|
|
91
102
|
|
|
92
103
|
|
|
93
104
|
class Exec(CodeBlock):
|
|
94
|
-
# TODO:
|
|
105
|
+
# TODO: Validate the language against the list of supported languages
|
|
95
106
|
|
|
96
107
|
option_spec = CodeBlock.option_spec | {
|
|
97
|
-
'after': directives.
|
|
108
|
+
'after': directives.class_option,
|
|
109
|
+
'editable': directives.flag,
|
|
110
|
+
'include': directives.unchanged_required,
|
|
98
111
|
'when': lambda c: directives.choice(c, ('click', 'load', 'never')),
|
|
99
112
|
}
|
|
100
113
|
|
|
@@ -104,12 +117,21 @@ class Exec(CodeBlock):
|
|
|
104
117
|
and 'tdoc-exec' in n['classes'] \
|
|
105
118
|
and (lang is None or n.get('language') == lang)
|
|
106
119
|
|
|
120
|
+
@report_exceptions
|
|
107
121
|
def run(self):
|
|
122
|
+
if include := self.options.get('include'):
|
|
123
|
+
content = statemachine.StringList()
|
|
124
|
+
for path in include.split():
|
|
125
|
+
rel_path, path = self.env.relfn2path(path)
|
|
126
|
+
self.env.note_dependency(rel_path)
|
|
127
|
+
content.extend(statemachine.StringList(
|
|
128
|
+
initlist=pathlib.Path(path).read_text().splitlines(),
|
|
129
|
+
source=path))
|
|
130
|
+
self.content[:0] = content
|
|
108
131
|
res = super().run()
|
|
109
132
|
for node in res:
|
|
110
133
|
for n in node.findall(nodes.literal_block):
|
|
111
134
|
self._update_node(node)
|
|
112
|
-
# _log.info("res: %s", res, color='yellow')
|
|
113
135
|
return res
|
|
114
136
|
|
|
115
137
|
def _update_node(self, node):
|
|
@@ -119,6 +141,8 @@ class Exec(CodeBlock):
|
|
|
119
141
|
if after := self.options.get('after'):
|
|
120
142
|
node['after'] = after
|
|
121
143
|
node['when'] = self.options.get('when', 'click')
|
|
144
|
+
if 'editable' in self.options:
|
|
145
|
+
node['classes'] += ['tdoc-editable']
|
|
122
146
|
|
|
123
147
|
|
|
124
148
|
def check_after_references(app, doctree, docname):
|
|
@@ -127,10 +151,10 @@ def check_after_references(app, doctree, docname):
|
|
|
127
151
|
for n in nodes:
|
|
128
152
|
names.update(n['names'])
|
|
129
153
|
for n in nodes:
|
|
130
|
-
after
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
154
|
+
for after in n.get('after', ()):
|
|
155
|
+
if after not in names:
|
|
156
|
+
doctree.reporter.error(
|
|
157
|
+
f"'exec': Unknown :after: reference: {after}", base_node=n)
|
|
134
158
|
|
|
135
159
|
|
|
136
160
|
div_attrs_re = re.compile(r'(?s)^(<div[^>]*)(>.*)$')
|
|
@@ -140,8 +164,10 @@ def visit_ExecBlock(self, node):
|
|
|
140
164
|
try:
|
|
141
165
|
return self.visit_literal_block(node)
|
|
142
166
|
except nodes.SkipNode:
|
|
143
|
-
|
|
144
|
-
|
|
167
|
+
after = node.get('after')
|
|
168
|
+
attrs = format_data_attrs(
|
|
169
|
+
self, after=' '.join(after) if after else None,
|
|
170
|
+
when=node.get('when'))
|
|
145
171
|
if attrs:
|
|
146
172
|
def subst(m):
|
|
147
173
|
return f'{m.group(1)} {attrs}{m.group(2)}'
|