sphinx-touchbook 0.1.0__py3-none-any.whl

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.
Files changed (66) hide show
  1. sphinx_touchbook/__init__.py +627 -0
  2. sphinx_touchbook/directives/__init__.py +15 -0
  3. sphinx_touchbook/directives/blank.py +192 -0
  4. sphinx_touchbook/directives/choice.py +240 -0
  5. sphinx_touchbook/directives/click.py +302 -0
  6. sphinx_touchbook/directives/code.py +294 -0
  7. sphinx_touchbook/directives/common.py +24 -0
  8. sphinx_touchbook/directives/file.py +138 -0
  9. sphinx_touchbook/directives/formula.py +242 -0
  10. sphinx_touchbook/directives/match.py +127 -0
  11. sphinx_touchbook/directives/micro_parsons.py +117 -0
  12. sphinx_touchbook/directives/order.py +89 -0
  13. sphinx_touchbook/directives/parsons.py +199 -0
  14. sphinx_touchbook/directives/reveal.py +50 -0
  15. sphinx_touchbook/directives/tabs.py +69 -0
  16. sphinx_touchbook/directives/video.py +244 -0
  17. sphinx_touchbook/generators/__init__.py +11 -0
  18. sphinx_touchbook/generators/blank.py +120 -0
  19. sphinx_touchbook/generators/choice.py +190 -0
  20. sphinx_touchbook/generators/click.py +170 -0
  21. sphinx_touchbook/generators/code.py +138 -0
  22. sphinx_touchbook/generators/file.py +97 -0
  23. sphinx_touchbook/generators/formula.py +116 -0
  24. sphinx_touchbook/generators/match.py +259 -0
  25. sphinx_touchbook/generators/micro_parsons.py +147 -0
  26. sphinx_touchbook/generators/order.py +133 -0
  27. sphinx_touchbook/generators/parsons.py +155 -0
  28. sphinx_touchbook/generators/reveal.py +69 -0
  29. sphinx_touchbook/generators/tabs.py +85 -0
  30. sphinx_touchbook/generators/video.py +154 -0
  31. sphinx_touchbook/nodes.py +156 -0
  32. sphinx_touchbook/static/Baby_Chick_Hatching.jpg +0 -0
  33. sphinx_touchbook/static/Baby_Chick_Hatching.webm +0 -0
  34. sphinx_touchbook/static/hand-index-thumb.svg +3 -0
  35. sphinx_touchbook/static/tb-blank.css +51 -0
  36. sphinx_touchbook/static/tb-blank.js +107 -0
  37. sphinx_touchbook/static/tb-choice.css +82 -0
  38. sphinx_touchbook/static/tb-choice.js +111 -0
  39. sphinx_touchbook/static/tb-click.css +84 -0
  40. sphinx_touchbook/static/tb-click.js +70 -0
  41. sphinx_touchbook/static/tb-code.css +121 -0
  42. sphinx_touchbook/static/tb-code.js +802 -0
  43. sphinx_touchbook/static/tb-file.css +52 -0
  44. sphinx_touchbook/static/tb-file.js +101 -0
  45. sphinx_touchbook/static/tb-formula.css +66 -0
  46. sphinx_touchbook/static/tb-formula.js +200 -0
  47. sphinx_touchbook/static/tb-group.css +36 -0
  48. sphinx_touchbook/static/tb-group.js +175 -0
  49. sphinx_touchbook/static/tb-match.css +90 -0
  50. sphinx_touchbook/static/tb-match.js +85 -0
  51. sphinx_touchbook/static/tb-micro-parsons.css +103 -0
  52. sphinx_touchbook/static/tb-micro-parsons.js +139 -0
  53. sphinx_touchbook/static/tb-order.css +104 -0
  54. sphinx_touchbook/static/tb-order.js +108 -0
  55. sphinx_touchbook/static/tb-parsons.css +120 -0
  56. sphinx_touchbook/static/tb-parsons.js +201 -0
  57. sphinx_touchbook/static/tb-reveal.css +43 -0
  58. sphinx_touchbook/static/tb-reveal.js +120 -0
  59. sphinx_touchbook/static/tb-video.css +143 -0
  60. sphinx_touchbook/static/tb-video.js +274 -0
  61. sphinx_touchbook/static/wilms-tumor-ct-scan.ogv +0 -0
  62. sphinx_touchbook/transforms.py +209 -0
  63. sphinx_touchbook-0.1.0.dist-info/METADATA +156 -0
  64. sphinx_touchbook-0.1.0.dist-info/RECORD +66 -0
  65. sphinx_touchbook-0.1.0.dist-info/WHEEL +4 -0
  66. sphinx_touchbook-0.1.0.dist-info/licenses/LICENSE +28 -0
@@ -0,0 +1,627 @@
1
+ """Sphinx extension entrypoint for Touchbook interactive directives."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+
7
+ from sphinx.application import Sphinx
8
+
9
+ from .directives.blank import TbBlankDirective
10
+ from .directives.code import (
11
+ DEFAULT_CODE_BLOCK_OPTIONS,
12
+ DEFAULT_ENDPOINT,
13
+ DEFAULT_FILES_ENDPOINT,
14
+ DEFAULT_LANGUAGE,
15
+ DEFAULT_LANGUAGE_DEFAULTS,
16
+ DEFAULT_LANGUAGE_MAP,
17
+ DEFAULT_LANGUAGES_ENDPOINT,
18
+ TbCodeDirective,
19
+ )
20
+ from .directives.choice import DEFAULT_FORCE_MULTIPLE, DEFAULT_RANDOM, TbChoiceDirective
21
+ from .directives.click import (
22
+ DEFAULT_SHOW_HINTS,
23
+ TbClickDirective,
24
+ TbClickHitDirective,
25
+ TbClickMissDirective,
26
+ )
27
+ from .directives.file import TbFileDirective
28
+ from .directives.formula import TbFormulaDirective
29
+ from .directives.match import TbMatchDirective
30
+ from .directives.micro_parsons import TbMicroParsonsDirective
31
+ from .directives.order import TbOrderDirective
32
+ from .directives.parsons import TbParsonsDirective
33
+ from .directives.reveal import TbRevealDirective
34
+ from .directives.tabs import TbGroupDirective, TbTabDirective
35
+ from .directives.video import TbVideoDirective
36
+ from .nodes import (
37
+ TbBlankInputNode,
38
+ TbBlankNode,
39
+ TbBlankPromptNode,
40
+ TbChoiceAnswerNode,
41
+ TbChoiceFeedbackNode,
42
+ TbChoiceNode,
43
+ TbChoiceOptionNode,
44
+ TbChoicePromptNode,
45
+ TbClickNode,
46
+ TbClickPromptNode,
47
+ TbClickRegionNode,
48
+ TbClickSourceNode,
49
+ TbCodeNode,
50
+ TbFileNode,
51
+ TbFormulaNode,
52
+ TbFormulaPromptNode,
53
+ TbFormulaVariableNode,
54
+ TbMatchDistractorNode,
55
+ TbMatchNode,
56
+ TbMatchPairNode,
57
+ TbMatchPromptNode,
58
+ TbMatchSourceNode,
59
+ TbMatchTargetNode,
60
+ TbMicroParsonsNode,
61
+ TbMicroParsonsPromptNode,
62
+ TbMicroParsonsTokenNode,
63
+ TbOrderItemNode,
64
+ TbOrderNode,
65
+ TbOrderPromptNode,
66
+ TbParsonsItemNode,
67
+ TbParsonsNode,
68
+ TbParsonsPromptNode,
69
+ TbRevealNode,
70
+ TbGroupNode,
71
+ TbTabNode,
72
+ TbVideoNode,
73
+ )
74
+ from .generators.blank import (
75
+ depart_tb_blank_html,
76
+ depart_tb_blank_input_html,
77
+ depart_tb_blank_input_latex,
78
+ depart_tb_blank_input_text,
79
+ depart_tb_blank_latex,
80
+ depart_tb_blank_prompt_html,
81
+ depart_tb_blank_prompt_latex,
82
+ depart_tb_blank_prompt_text,
83
+ depart_tb_blank_text,
84
+ visit_tb_blank_html,
85
+ visit_tb_blank_input_html,
86
+ visit_tb_blank_input_latex,
87
+ visit_tb_blank_input_text,
88
+ visit_tb_blank_latex,
89
+ visit_tb_blank_prompt_html,
90
+ visit_tb_blank_prompt_latex,
91
+ visit_tb_blank_prompt_text,
92
+ visit_tb_blank_text,
93
+ )
94
+ from .generators.click import (
95
+ depart_tb_click_html,
96
+ depart_tb_click_latex,
97
+ depart_tb_click_prompt_html,
98
+ depart_tb_click_prompt_latex,
99
+ depart_tb_click_prompt_text,
100
+ depart_tb_click_region_html,
101
+ depart_tb_click_region_latex,
102
+ depart_tb_click_region_text,
103
+ depart_tb_click_source_html,
104
+ depart_tb_click_source_latex,
105
+ depart_tb_click_source_text,
106
+ depart_tb_click_text,
107
+ visit_tb_click_html,
108
+ visit_tb_click_latex,
109
+ visit_tb_click_prompt_html,
110
+ visit_tb_click_prompt_latex,
111
+ visit_tb_click_prompt_text,
112
+ visit_tb_click_region_html,
113
+ visit_tb_click_region_latex,
114
+ visit_tb_click_region_text,
115
+ visit_tb_click_source_html,
116
+ visit_tb_click_source_latex,
117
+ visit_tb_click_source_text,
118
+ visit_tb_click_text,
119
+ )
120
+ from .generators.choice import (
121
+ depart_tb_choice_answer_html,
122
+ depart_tb_choice_answer_latex,
123
+ depart_tb_choice_answer_text,
124
+ depart_tb_choice_feedback_html,
125
+ depart_tb_choice_feedback_latex,
126
+ depart_tb_choice_feedback_text,
127
+ depart_tb_choice_html,
128
+ depart_tb_choice_latex,
129
+ depart_tb_choice_option_html,
130
+ depart_tb_choice_option_latex,
131
+ depart_tb_choice_option_text,
132
+ depart_tb_choice_prompt_html,
133
+ depart_tb_choice_prompt_latex,
134
+ depart_tb_choice_prompt_text,
135
+ depart_tb_choice_text,
136
+ visit_tb_choice_answer_html,
137
+ visit_tb_choice_answer_latex,
138
+ visit_tb_choice_answer_text,
139
+ visit_tb_choice_feedback_html,
140
+ visit_tb_choice_feedback_latex,
141
+ visit_tb_choice_feedback_text,
142
+ visit_tb_choice_html,
143
+ visit_tb_choice_latex,
144
+ visit_tb_choice_option_html,
145
+ visit_tb_choice_option_latex,
146
+ visit_tb_choice_option_text,
147
+ visit_tb_choice_prompt_html,
148
+ visit_tb_choice_prompt_latex,
149
+ visit_tb_choice_prompt_text,
150
+ visit_tb_choice_text,
151
+ )
152
+ from .generators.code import (
153
+ depart_tb_code_html,
154
+ depart_tb_code_latex,
155
+ depart_tb_code_text,
156
+ visit_tb_code_html,
157
+ visit_tb_code_latex,
158
+ visit_tb_code_text,
159
+ )
160
+ from .generators.file import (
161
+ depart_tb_file_html,
162
+ depart_tb_file_latex,
163
+ depart_tb_file_text,
164
+ visit_tb_file_html,
165
+ visit_tb_file_latex,
166
+ visit_tb_file_text,
167
+ )
168
+ from .generators.formula import (
169
+ depart_tb_formula_html,
170
+ depart_tb_formula_latex,
171
+ depart_tb_formula_prompt_html,
172
+ depart_tb_formula_prompt_latex,
173
+ depart_tb_formula_prompt_text,
174
+ depart_tb_formula_text,
175
+ depart_tb_formula_variable_html,
176
+ depart_tb_formula_variable_latex,
177
+ depart_tb_formula_variable_text,
178
+ visit_tb_formula_html,
179
+ visit_tb_formula_latex,
180
+ visit_tb_formula_prompt_html,
181
+ visit_tb_formula_prompt_latex,
182
+ visit_tb_formula_prompt_text,
183
+ visit_tb_formula_text,
184
+ visit_tb_formula_variable_html,
185
+ visit_tb_formula_variable_latex,
186
+ visit_tb_formula_variable_text,
187
+ )
188
+ from .generators.match import (
189
+ depart_tb_match_html,
190
+ depart_tb_match_distractor_html,
191
+ depart_tb_match_distractor_latex,
192
+ depart_tb_match_distractor_text,
193
+ depart_tb_match_latex,
194
+ depart_tb_match_pair_html,
195
+ depart_tb_match_pair_latex,
196
+ depart_tb_match_pair_text,
197
+ depart_tb_match_prompt_html,
198
+ depart_tb_match_prompt_latex,
199
+ depart_tb_match_prompt_text,
200
+ depart_tb_match_source_html,
201
+ depart_tb_match_source_latex,
202
+ depart_tb_match_source_text,
203
+ depart_tb_match_target_html,
204
+ depart_tb_match_target_latex,
205
+ depart_tb_match_target_text,
206
+ depart_tb_match_text,
207
+ visit_tb_match_html,
208
+ visit_tb_match_distractor_html,
209
+ visit_tb_match_distractor_latex,
210
+ visit_tb_match_distractor_text,
211
+ visit_tb_match_latex,
212
+ visit_tb_match_pair_html,
213
+ visit_tb_match_pair_latex,
214
+ visit_tb_match_pair_text,
215
+ visit_tb_match_prompt_html,
216
+ visit_tb_match_prompt_latex,
217
+ visit_tb_match_prompt_text,
218
+ visit_tb_match_source_html,
219
+ visit_tb_match_source_latex,
220
+ visit_tb_match_source_text,
221
+ visit_tb_match_target_html,
222
+ visit_tb_match_target_latex,
223
+ visit_tb_match_target_text,
224
+ visit_tb_match_text,
225
+ )
226
+ from .generators.micro_parsons import (
227
+ depart_tb_micro_parsons_html,
228
+ depart_tb_micro_parsons_latex,
229
+ depart_tb_micro_parsons_prompt_html,
230
+ depart_tb_micro_parsons_prompt_latex,
231
+ depart_tb_micro_parsons_prompt_text,
232
+ depart_tb_micro_parsons_text,
233
+ depart_tb_micro_parsons_token_html,
234
+ depart_tb_micro_parsons_token_latex,
235
+ depart_tb_micro_parsons_token_text,
236
+ visit_tb_micro_parsons_html,
237
+ visit_tb_micro_parsons_latex,
238
+ visit_tb_micro_parsons_prompt_html,
239
+ visit_tb_micro_parsons_prompt_latex,
240
+ visit_tb_micro_parsons_prompt_text,
241
+ visit_tb_micro_parsons_text,
242
+ visit_tb_micro_parsons_token_html,
243
+ visit_tb_micro_parsons_token_latex,
244
+ visit_tb_micro_parsons_token_text,
245
+ )
246
+ from .generators.order import (
247
+ depart_tb_order_html,
248
+ depart_tb_order_item_html,
249
+ depart_tb_order_item_latex,
250
+ depart_tb_order_item_text,
251
+ depart_tb_order_latex,
252
+ depart_tb_order_prompt_html,
253
+ depart_tb_order_prompt_latex,
254
+ depart_tb_order_prompt_text,
255
+ depart_tb_order_text,
256
+ visit_tb_order_html,
257
+ visit_tb_order_item_html,
258
+ visit_tb_order_item_latex,
259
+ visit_tb_order_item_text,
260
+ visit_tb_order_latex,
261
+ visit_tb_order_prompt_html,
262
+ visit_tb_order_prompt_latex,
263
+ visit_tb_order_prompt_text,
264
+ visit_tb_order_text,
265
+ )
266
+ from .generators.parsons import (
267
+ depart_tb_parsons_html,
268
+ depart_tb_parsons_item_html,
269
+ depart_tb_parsons_item_latex,
270
+ depart_tb_parsons_item_text,
271
+ depart_tb_parsons_latex,
272
+ depart_tb_parsons_prompt_html,
273
+ depart_tb_parsons_prompt_latex,
274
+ depart_tb_parsons_prompt_text,
275
+ depart_tb_parsons_text,
276
+ visit_tb_parsons_html,
277
+ visit_tb_parsons_item_html,
278
+ visit_tb_parsons_item_latex,
279
+ visit_tb_parsons_item_text,
280
+ visit_tb_parsons_latex,
281
+ visit_tb_parsons_prompt_html,
282
+ visit_tb_parsons_prompt_latex,
283
+ visit_tb_parsons_prompt_text,
284
+ visit_tb_parsons_text,
285
+ )
286
+ from .generators.reveal import (
287
+ depart_tb_reveal_html,
288
+ depart_tb_reveal_latex,
289
+ depart_tb_reveal_text,
290
+ visit_tb_reveal_html,
291
+ visit_tb_reveal_latex,
292
+ visit_tb_reveal_text,
293
+ )
294
+ from .generators.video import (
295
+ depart_tb_video_html,
296
+ depart_tb_video_latex,
297
+ depart_tb_video_text,
298
+ visit_tb_video_html,
299
+ visit_tb_video_latex,
300
+ visit_tb_video_text,
301
+ )
302
+ from .generators.tabs import (
303
+ depart_tb_group_html,
304
+ depart_tb_group_latex,
305
+ depart_tb_group_text,
306
+ depart_tb_tab_html,
307
+ depart_tb_tab_latex,
308
+ depart_tb_tab_text,
309
+ visit_tb_group_html,
310
+ visit_tb_group_latex,
311
+ visit_tb_group_text,
312
+ visit_tb_tab_html,
313
+ visit_tb_tab_latex,
314
+ visit_tb_tab_text,
315
+ )
316
+ from .transforms import (
317
+ TbCodeIncludeTransform,
318
+ collect_tb_files,
319
+ collect_tb_code_snippets,
320
+ merge_tb_files,
321
+ merge_tb_code_snippets,
322
+ purge_tb_files,
323
+ purge_tb_code_snippets,
324
+ )
325
+
326
+
327
+ def _add_static_path(app: Sphinx) -> None:
328
+ static_path = str(Path(__file__).parent / "static")
329
+ if static_path not in app.config.html_static_path:
330
+ app.config.html_static_path.append(static_path)
331
+
332
+
333
+ def setup(app: Sphinx) -> dict[str, object]:
334
+ app.add_config_value(
335
+ "tb_code_default_endpoint",
336
+ DEFAULT_ENDPOINT,
337
+ "html",
338
+ )
339
+ app.add_config_value("tb_code_files_endpoint", DEFAULT_FILES_ENDPOINT, "html")
340
+ app.add_config_value("tb_code_languages_endpoint", DEFAULT_LANGUAGES_ENDPOINT, "html")
341
+ app.add_config_value("tb_code_validate_language", True, "html")
342
+ app.add_config_value("tb_code_default_language", DEFAULT_LANGUAGE, "env")
343
+ app.add_config_value("tb_code_language_map", DEFAULT_LANGUAGE_MAP, "env")
344
+ app.add_config_value("tb_code_language_defaults", DEFAULT_LANGUAGE_DEFAULTS, "env")
345
+ app.add_config_value("tb_code_block_defaults", DEFAULT_CODE_BLOCK_OPTIONS, "env")
346
+ app.add_config_value("tb_code_run_label", "Run", "html")
347
+ app.add_config_value("tb_code_edit_label", "Edit", "html")
348
+ app.add_config_value("tb_code_hide_edit_label", "Hide editor", "html")
349
+ app.add_config_value("tb_code_revision_label", "Source version", "html")
350
+ app.add_config_value("tb_choice_random", DEFAULT_RANDOM, "env")
351
+ app.add_config_value("tb_choice_force_multiple", DEFAULT_FORCE_MULTIPLE, "env")
352
+ app.add_config_value("tb_click_show_hints", DEFAULT_SHOW_HINTS, "html")
353
+ app.add_config_value("tb_formula_default_endpoint", DEFAULT_ENDPOINT, "html")
354
+ app.add_config_value("tb_formula_language_defaults", {}, "env")
355
+ app.add_config_value("tb_video_default_width", "560", "env")
356
+ app.add_config_value("tb_video_default_height", "315", "env")
357
+ app.add_node(
358
+ TbBlankNode,
359
+ html=(visit_tb_blank_html, depart_tb_blank_html),
360
+ latex=(visit_tb_blank_latex, depart_tb_blank_latex),
361
+ text=(visit_tb_blank_text, depart_tb_blank_text),
362
+ )
363
+ app.add_node(
364
+ TbBlankPromptNode,
365
+ html=(visit_tb_blank_prompt_html, depart_tb_blank_prompt_html),
366
+ latex=(visit_tb_blank_prompt_latex, depart_tb_blank_prompt_latex),
367
+ text=(visit_tb_blank_prompt_text, depart_tb_blank_prompt_text),
368
+ )
369
+ app.add_node(
370
+ TbBlankInputNode,
371
+ html=(visit_tb_blank_input_html, depart_tb_blank_input_html),
372
+ latex=(visit_tb_blank_input_latex, depart_tb_blank_input_latex),
373
+ text=(visit_tb_blank_input_text, depart_tb_blank_input_text),
374
+ )
375
+ app.add_node(
376
+ TbCodeNode,
377
+ html=(visit_tb_code_html, depart_tb_code_html),
378
+ latex=(visit_tb_code_latex, depart_tb_code_latex),
379
+ text=(visit_tb_code_text, depart_tb_code_text),
380
+ )
381
+ app.add_node(
382
+ TbFileNode,
383
+ html=(visit_tb_file_html, depart_tb_file_html),
384
+ latex=(visit_tb_file_latex, depart_tb_file_latex),
385
+ text=(visit_tb_file_text, depart_tb_file_text),
386
+ )
387
+ app.add_node(
388
+ TbFormulaNode,
389
+ html=(visit_tb_formula_html, depart_tb_formula_html),
390
+ latex=(visit_tb_formula_latex, depart_tb_formula_latex),
391
+ text=(visit_tb_formula_text, depart_tb_formula_text),
392
+ )
393
+ app.add_node(
394
+ TbFormulaPromptNode,
395
+ html=(visit_tb_formula_prompt_html, depart_tb_formula_prompt_html),
396
+ latex=(visit_tb_formula_prompt_latex, depart_tb_formula_prompt_latex),
397
+ text=(visit_tb_formula_prompt_text, depart_tb_formula_prompt_text),
398
+ )
399
+ app.add_node(
400
+ TbFormulaVariableNode,
401
+ html=(visit_tb_formula_variable_html, depart_tb_formula_variable_html),
402
+ latex=(visit_tb_formula_variable_latex, depart_tb_formula_variable_latex),
403
+ text=(visit_tb_formula_variable_text, depart_tb_formula_variable_text),
404
+ )
405
+ app.add_node(
406
+ TbRevealNode,
407
+ html=(visit_tb_reveal_html, depart_tb_reveal_html),
408
+ latex=(visit_tb_reveal_latex, depart_tb_reveal_latex),
409
+ text=(visit_tb_reveal_text, depart_tb_reveal_text),
410
+ )
411
+ app.add_node(
412
+ TbGroupNode,
413
+ html=(visit_tb_group_html, depart_tb_group_html),
414
+ latex=(visit_tb_group_latex, depart_tb_group_latex),
415
+ text=(visit_tb_group_text, depart_tb_group_text),
416
+ )
417
+ app.add_node(
418
+ TbTabNode,
419
+ html=(visit_tb_tab_html, depart_tb_tab_html),
420
+ latex=(visit_tb_tab_latex, depart_tb_tab_latex),
421
+ text=(visit_tb_tab_text, depart_tb_tab_text),
422
+ )
423
+ app.add_node(
424
+ TbVideoNode,
425
+ html=(visit_tb_video_html, depart_tb_video_html),
426
+ latex=(visit_tb_video_latex, depart_tb_video_latex),
427
+ text=(visit_tb_video_text, depart_tb_video_text),
428
+ )
429
+ app.add_node(
430
+ TbChoiceNode,
431
+ html=(visit_tb_choice_html, depart_tb_choice_html),
432
+ latex=(visit_tb_choice_latex, depart_tb_choice_latex),
433
+ text=(visit_tb_choice_text, depart_tb_choice_text),
434
+ )
435
+ app.add_node(
436
+ TbChoicePromptNode,
437
+ html=(visit_tb_choice_prompt_html, depart_tb_choice_prompt_html),
438
+ latex=(visit_tb_choice_prompt_latex, depart_tb_choice_prompt_latex),
439
+ text=(visit_tb_choice_prompt_text, depart_tb_choice_prompt_text),
440
+ )
441
+ app.add_node(
442
+ TbChoiceOptionNode,
443
+ html=(visit_tb_choice_option_html, depart_tb_choice_option_html),
444
+ latex=(visit_tb_choice_option_latex, depart_tb_choice_option_latex),
445
+ text=(visit_tb_choice_option_text, depart_tb_choice_option_text),
446
+ )
447
+ app.add_node(
448
+ TbChoiceAnswerNode,
449
+ html=(visit_tb_choice_answer_html, depart_tb_choice_answer_html),
450
+ latex=(visit_tb_choice_answer_latex, depart_tb_choice_answer_latex),
451
+ text=(visit_tb_choice_answer_text, depart_tb_choice_answer_text),
452
+ )
453
+ app.add_node(
454
+ TbChoiceFeedbackNode,
455
+ html=(visit_tb_choice_feedback_html, depart_tb_choice_feedback_html),
456
+ latex=(visit_tb_choice_feedback_latex, depart_tb_choice_feedback_latex),
457
+ text=(visit_tb_choice_feedback_text, depart_tb_choice_feedback_text),
458
+ )
459
+ app.add_node(
460
+ TbClickNode,
461
+ html=(visit_tb_click_html, depart_tb_click_html),
462
+ latex=(visit_tb_click_latex, depart_tb_click_latex),
463
+ text=(visit_tb_click_text, depart_tb_click_text),
464
+ )
465
+ app.add_node(
466
+ TbClickPromptNode,
467
+ html=(visit_tb_click_prompt_html, depart_tb_click_prompt_html),
468
+ latex=(visit_tb_click_prompt_latex, depart_tb_click_prompt_latex),
469
+ text=(visit_tb_click_prompt_text, depart_tb_click_prompt_text),
470
+ )
471
+ app.add_node(
472
+ TbClickSourceNode,
473
+ html=(visit_tb_click_source_html, depart_tb_click_source_html),
474
+ latex=(visit_tb_click_source_latex, depart_tb_click_source_latex),
475
+ text=(visit_tb_click_source_text, depart_tb_click_source_text),
476
+ )
477
+ app.add_node(
478
+ TbClickRegionNode,
479
+ html=(visit_tb_click_region_html, depart_tb_click_region_html),
480
+ latex=(visit_tb_click_region_latex, depart_tb_click_region_latex),
481
+ text=(visit_tb_click_region_text, depart_tb_click_region_text),
482
+ )
483
+ app.add_node(
484
+ TbMatchNode,
485
+ html=(visit_tb_match_html, depart_tb_match_html),
486
+ latex=(visit_tb_match_latex, depart_tb_match_latex),
487
+ text=(visit_tb_match_text, depart_tb_match_text),
488
+ )
489
+ app.add_node(
490
+ TbMatchPromptNode,
491
+ html=(visit_tb_match_prompt_html, depart_tb_match_prompt_html),
492
+ latex=(visit_tb_match_prompt_latex, depart_tb_match_prompt_latex),
493
+ text=(visit_tb_match_prompt_text, depart_tb_match_prompt_text),
494
+ )
495
+ app.add_node(
496
+ TbMatchPairNode,
497
+ html=(visit_tb_match_pair_html, depart_tb_match_pair_html),
498
+ latex=(visit_tb_match_pair_latex, depart_tb_match_pair_latex),
499
+ text=(visit_tb_match_pair_text, depart_tb_match_pair_text),
500
+ )
501
+ app.add_node(
502
+ TbMatchSourceNode,
503
+ html=(visit_tb_match_source_html, depart_tb_match_source_html),
504
+ latex=(visit_tb_match_source_latex, depart_tb_match_source_latex),
505
+ text=(visit_tb_match_source_text, depart_tb_match_source_text),
506
+ )
507
+ app.add_node(
508
+ TbMatchTargetNode,
509
+ html=(visit_tb_match_target_html, depart_tb_match_target_html),
510
+ latex=(visit_tb_match_target_latex, depart_tb_match_target_latex),
511
+ text=(visit_tb_match_target_text, depart_tb_match_target_text),
512
+ )
513
+ app.add_node(
514
+ TbMatchDistractorNode,
515
+ html=(visit_tb_match_distractor_html, depart_tb_match_distractor_html),
516
+ latex=(visit_tb_match_distractor_latex, depart_tb_match_distractor_latex),
517
+ text=(visit_tb_match_distractor_text, depart_tb_match_distractor_text),
518
+ )
519
+ app.add_node(
520
+ TbMicroParsonsNode,
521
+ html=(visit_tb_micro_parsons_html, depart_tb_micro_parsons_html),
522
+ latex=(visit_tb_micro_parsons_latex, depart_tb_micro_parsons_latex),
523
+ text=(visit_tb_micro_parsons_text, depart_tb_micro_parsons_text),
524
+ )
525
+ app.add_node(
526
+ TbMicroParsonsPromptNode,
527
+ html=(visit_tb_micro_parsons_prompt_html, depart_tb_micro_parsons_prompt_html),
528
+ latex=(visit_tb_micro_parsons_prompt_latex, depart_tb_micro_parsons_prompt_latex),
529
+ text=(visit_tb_micro_parsons_prompt_text, depart_tb_micro_parsons_prompt_text),
530
+ )
531
+ app.add_node(
532
+ TbMicroParsonsTokenNode,
533
+ html=(visit_tb_micro_parsons_token_html, depart_tb_micro_parsons_token_html),
534
+ latex=(visit_tb_micro_parsons_token_latex, depart_tb_micro_parsons_token_latex),
535
+ text=(visit_tb_micro_parsons_token_text, depart_tb_micro_parsons_token_text),
536
+ )
537
+ app.add_node(
538
+ TbOrderNode,
539
+ html=(visit_tb_order_html, depart_tb_order_html),
540
+ latex=(visit_tb_order_latex, depart_tb_order_latex),
541
+ text=(visit_tb_order_text, depart_tb_order_text),
542
+ )
543
+ app.add_node(
544
+ TbOrderItemNode,
545
+ html=(visit_tb_order_item_html, depart_tb_order_item_html),
546
+ latex=(visit_tb_order_item_latex, depart_tb_order_item_latex),
547
+ text=(visit_tb_order_item_text, depart_tb_order_item_text),
548
+ )
549
+ app.add_node(
550
+ TbOrderPromptNode,
551
+ html=(visit_tb_order_prompt_html, depart_tb_order_prompt_html),
552
+ latex=(visit_tb_order_prompt_latex, depart_tb_order_prompt_latex),
553
+ text=(visit_tb_order_prompt_text, depart_tb_order_prompt_text),
554
+ )
555
+ app.add_node(
556
+ TbParsonsNode,
557
+ html=(visit_tb_parsons_html, depart_tb_parsons_html),
558
+ latex=(visit_tb_parsons_latex, depart_tb_parsons_latex),
559
+ text=(visit_tb_parsons_text, depart_tb_parsons_text),
560
+ )
561
+ app.add_node(
562
+ TbParsonsItemNode,
563
+ html=(visit_tb_parsons_item_html, depart_tb_parsons_item_html),
564
+ latex=(visit_tb_parsons_item_latex, depart_tb_parsons_item_latex),
565
+ text=(visit_tb_parsons_item_text, depart_tb_parsons_item_text),
566
+ )
567
+ app.add_node(
568
+ TbParsonsPromptNode,
569
+ html=(visit_tb_parsons_prompt_html, depart_tb_parsons_prompt_html),
570
+ latex=(visit_tb_parsons_prompt_latex, depart_tb_parsons_prompt_latex),
571
+ text=(visit_tb_parsons_prompt_text, depart_tb_parsons_prompt_text),
572
+ )
573
+ app.add_directive("tb-blank", TbBlankDirective)
574
+ app.add_directive("tb-code", TbCodeDirective)
575
+ app.add_directive("tb-choice", TbChoiceDirective)
576
+ app.add_directive("tb-click", TbClickDirective)
577
+ app.add_directive("tb-hit", TbClickHitDirective)
578
+ app.add_directive("tb-miss", TbClickMissDirective)
579
+ app.add_directive("tb-file", TbFileDirective)
580
+ app.add_directive("tb-formula", TbFormulaDirective)
581
+ app.add_directive("tb-match", TbMatchDirective)
582
+ app.add_directive("tb-micro-parsons", TbMicroParsonsDirective)
583
+ app.add_directive("tb-order", TbOrderDirective)
584
+ app.add_directive("tb-parsons", TbParsonsDirective)
585
+ app.add_directive("tb-reveal", TbRevealDirective)
586
+ app.add_directive("tb-group", TbGroupDirective)
587
+ app.add_directive("tb-tab", TbTabDirective)
588
+ app.add_directive("tb-video", TbVideoDirective)
589
+ app.add_post_transform(TbCodeIncludeTransform)
590
+ app.connect("env-purge-doc", purge_tb_code_snippets)
591
+ app.connect("env-purge-doc", purge_tb_files)
592
+ app.connect("doctree-read", collect_tb_code_snippets)
593
+ app.connect("doctree-read", collect_tb_files)
594
+ app.connect("env-merge-info", merge_tb_code_snippets)
595
+ app.connect("env-merge-info", merge_tb_files)
596
+ app.connect("builder-inited", _add_static_path)
597
+ app.add_css_file("tb-reveal.css")
598
+ app.add_css_file("tb-group.css")
599
+ app.add_css_file("tb-code.css")
600
+ app.add_css_file("tb-blank.css")
601
+ app.add_css_file("tb-choice.css")
602
+ app.add_css_file("tb-click.css")
603
+ app.add_css_file("tb-file.css")
604
+ app.add_css_file("tb-formula.css")
605
+ app.add_css_file("tb-match.css")
606
+ app.add_css_file("tb-micro-parsons.css")
607
+ app.add_css_file("tb-order.css")
608
+ app.add_css_file("tb-parsons.css")
609
+ app.add_css_file("tb-video.css")
610
+ app.add_js_file("tb-reveal.js", loading_method="defer")
611
+ app.add_js_file("tb-group.js", loading_method="defer")
612
+ app.add_js_file("tb-code.js", loading_method="defer")
613
+ app.add_js_file("tb-blank.js", loading_method="defer")
614
+ app.add_js_file("tb-choice.js", loading_method="defer")
615
+ app.add_js_file("tb-click.js", loading_method="defer")
616
+ app.add_js_file("tb-file.js", loading_method="defer")
617
+ app.add_js_file("tb-formula.js", loading_method="defer")
618
+ app.add_js_file("tb-match.js", loading_method="defer")
619
+ app.add_js_file("tb-micro-parsons.js", loading_method="defer")
620
+ app.add_js_file("tb-order.js", loading_method="defer")
621
+ app.add_js_file("tb-parsons.js", loading_method="defer")
622
+ app.add_js_file("tb-video.js", loading_method="defer")
623
+ return {
624
+ "version": "0.1.0",
625
+ "parallel_read_safe": True,
626
+ "parallel_write_safe": True,
627
+ }
@@ -0,0 +1,15 @@
1
+ """Sphinx-Touchbook: Interactive textbook widgets for Sphinx-doc.
2
+ Copyright (C) 2026 Dave Parillo.
3
+
4
+ See:
5
+ https://daveparillo.github.io/sphinx-touchbook/
6
+ for details.
7
+ """
8
+
9
+
10
+
11
+
12
+ from __future__ import annotations
13
+
14
+ """Directive implementations."""
15
+