auto-editor 28.1.0__py3-none-any.whl → 29.0.1__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 (60) hide show
  1. auto_editor/__init__.py +3 -1
  2. auto_editor/__main__.py +31 -497
  3. auto_editor/cli.py +12 -0
  4. {auto_editor-28.1.0.dist-info → auto_editor-29.0.1.dist-info}/METADATA +5 -6
  5. auto_editor-29.0.1.dist-info/RECORD +9 -0
  6. auto_editor-29.0.1.dist-info/entry_points.txt +2 -0
  7. {auto_editor-28.1.0.dist-info → auto_editor-29.0.1.dist-info}/top_level.txt +0 -1
  8. auto_editor/analyze.py +0 -393
  9. auto_editor/cmds/__init__.py +0 -0
  10. auto_editor/cmds/cache.py +0 -69
  11. auto_editor/cmds/desc.py +0 -32
  12. auto_editor/cmds/info.py +0 -213
  13. auto_editor/cmds/levels.py +0 -199
  14. auto_editor/cmds/palet.py +0 -29
  15. auto_editor/cmds/repl.py +0 -113
  16. auto_editor/cmds/subdump.py +0 -72
  17. auto_editor/cmds/test.py +0 -816
  18. auto_editor/edit.py +0 -560
  19. auto_editor/exports/__init__.py +0 -0
  20. auto_editor/exports/fcp11.py +0 -195
  21. auto_editor/exports/fcp7.py +0 -313
  22. auto_editor/exports/json.py +0 -63
  23. auto_editor/exports/kdenlive.py +0 -322
  24. auto_editor/exports/shotcut.py +0 -147
  25. auto_editor/ffwrapper.py +0 -187
  26. auto_editor/help.py +0 -224
  27. auto_editor/imports/__init__.py +0 -0
  28. auto_editor/imports/fcp7.py +0 -275
  29. auto_editor/imports/json.py +0 -234
  30. auto_editor/json.py +0 -297
  31. auto_editor/lang/__init__.py +0 -0
  32. auto_editor/lang/libintrospection.py +0 -10
  33. auto_editor/lang/libmath.py +0 -23
  34. auto_editor/lang/palet.py +0 -724
  35. auto_editor/lang/stdenv.py +0 -1179
  36. auto_editor/lib/__init__.py +0 -0
  37. auto_editor/lib/contracts.py +0 -235
  38. auto_editor/lib/data_structs.py +0 -278
  39. auto_editor/lib/err.py +0 -2
  40. auto_editor/make_layers.py +0 -315
  41. auto_editor/preview.py +0 -93
  42. auto_editor/render/__init__.py +0 -0
  43. auto_editor/render/audio.py +0 -517
  44. auto_editor/render/subtitle.py +0 -205
  45. auto_editor/render/video.py +0 -307
  46. auto_editor/timeline.py +0 -331
  47. auto_editor/utils/__init__.py +0 -0
  48. auto_editor/utils/bar.py +0 -142
  49. auto_editor/utils/chunks.py +0 -2
  50. auto_editor/utils/cmdkw.py +0 -206
  51. auto_editor/utils/container.py +0 -101
  52. auto_editor/utils/func.py +0 -128
  53. auto_editor/utils/log.py +0 -126
  54. auto_editor/utils/types.py +0 -277
  55. auto_editor/vanparse.py +0 -313
  56. auto_editor-28.1.0.dist-info/RECORD +0 -57
  57. auto_editor-28.1.0.dist-info/entry_points.txt +0 -6
  58. docs/build.py +0 -70
  59. {auto_editor-28.1.0.dist-info → auto_editor-29.0.1.dist-info}/WHEEL +0 -0
  60. {auto_editor-28.1.0.dist-info → auto_editor-29.0.1.dist-info}/licenses/LICENSE +0 -0
auto_editor/vanparse.py DELETED
@@ -1,313 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import difflib
4
- import re
5
- import sys
6
- import textwrap
7
- from dataclasses import dataclass
8
- from io import StringIO
9
- from shutil import get_terminal_size
10
- from typing import TYPE_CHECKING
11
-
12
- from auto_editor.utils.log import Log
13
- from auto_editor.utils.types import CoerceError
14
-
15
- if TYPE_CHECKING:
16
- from collections.abc import Callable, Iterator
17
- from typing import Any, Literal, TypeVar
18
-
19
- T = TypeVar("T")
20
- Nargs = int | Literal["*"]
21
-
22
-
23
- @dataclass(slots=True)
24
- class Required:
25
- names: tuple[str, ...]
26
- nargs: Nargs = "*"
27
- type: type = str
28
- choices: tuple[str, ...] | None = None
29
- metavar: str = "[file ...] [options]"
30
-
31
-
32
- @dataclass(slots=True)
33
- class Options:
34
- names: tuple[str, ...]
35
- nargs: Nargs = 1
36
- type: type = str
37
- flag: bool = False
38
- choices: tuple[str, ...] | None = None
39
- metavar: str | None = None
40
- help: str = ""
41
-
42
-
43
- @dataclass(slots=True)
44
- class OptionText:
45
- text: str
46
-
47
-
48
- def indent(text: str, prefix: str) -> str:
49
- def prefixed_lines() -> Iterator[str]:
50
- for line in text.splitlines(True):
51
- yield (prefix + line if line.strip() else line)
52
-
53
- return "".join(prefixed_lines())
54
-
55
-
56
- def out(text: str) -> None:
57
- width = get_terminal_size().columns - 3
58
-
59
- indent_regex = re.compile(r"^(\s+)")
60
-
61
- for line in text.split("\n"):
62
- exist_indent = re.search(indent_regex, line)
63
- pre_indent = exist_indent.groups()[0] if exist_indent else ""
64
-
65
- sys.stdout.write(textwrap.fill(line, width=width, subsequent_indent=pre_indent))
66
- sys.stdout.write("\n")
67
-
68
-
69
- def print_program_help(reqs: list[Required], args: list[Options | OptionText]) -> None:
70
- sys.stdout.write(f"Usage: {' '.join([req.metavar for req in reqs])}\n\nOptions:")
71
-
72
- width = get_terminal_size().columns - 3
73
- split = int(width * 0.44) + 3
74
- indent = " "
75
-
76
- for i, arg in enumerate(args):
77
- if isinstance(arg, OptionText):
78
- if i == 0:
79
- sys.stdout.write(f"\n {arg.text}")
80
- indent = " "
81
- else:
82
- sys.stdout.write(f"\n\n {arg.text}")
83
- else:
84
- sys.stdout.write("\n")
85
- line = f"{indent}{', '.join(reversed(arg.names))}"
86
- if arg.metavar is not None:
87
- line += f" {arg.metavar}"
88
-
89
- if arg.help == "":
90
- pass
91
- elif len(line) < split:
92
- line = textwrap.fill(
93
- arg.help,
94
- width=width,
95
- initial_indent=f"{line}{' ' * (split - len(line))}",
96
- subsequent_indent=split * " ",
97
- )
98
- else:
99
- line += "\n"
100
- line += textwrap.fill(
101
- arg.help,
102
- width=width,
103
- initial_indent=split * " ",
104
- subsequent_indent=split * " ",
105
- )
106
-
107
- sys.stdout.write(line)
108
- sys.stdout.write("\n\n")
109
-
110
-
111
- def to_underscore(name: str) -> str:
112
- """Convert new style options to old style. e.g. --hello-world -> --hello_world"""
113
- return name[:2] + name[2:].replace("-", "_")
114
-
115
-
116
- def to_key(op: Options | Required) -> str:
117
- """Convert option name to arg key. e.g. --hello-world -> hello_world"""
118
- return op.names[0][:2].replace("-", "") + op.names[0][2:].replace("-", "_")
119
-
120
-
121
- def print_option_help(name: str | None, ns_obj: object, option: Options) -> None:
122
- text = StringIO()
123
- text.write(
124
- f" {', '.join(option.names)} {'' if option.metavar is None else option.metavar}\n\n"
125
- )
126
-
127
- if option.flag:
128
- text.write(" type: flag\n")
129
- else:
130
- if option.nargs != 1:
131
- text.write(f" nargs: {option.nargs}\n")
132
-
133
- default: str | float | int | tuple | None = None
134
- try:
135
- default = getattr(ns_obj, to_key(option))
136
- except AttributeError:
137
- pass
138
-
139
- if default is not None and isinstance(default, int | float | str):
140
- text.write(f" default: {default}\n")
141
-
142
- if option.choices is not None:
143
- text.write(f" choices: {', '.join(option.choices)}\n")
144
-
145
- from auto_editor.help import data
146
-
147
- if name is not None and option.names[0] in data[name]:
148
- text.write(indent(data[name][option.names[0]], " ") + "\n")
149
- else:
150
- text.write(f" {option.help}\n\n")
151
-
152
- out(text.getvalue())
153
-
154
-
155
- def get_option(name: str, options: list[Options]) -> Options | None:
156
- for option in options:
157
- if name in option.names or name in map(to_underscore, option.names):
158
- return option
159
- return None
160
-
161
-
162
- class ArgumentParser:
163
- def __init__(self, program_name: str | None):
164
- self.program_name = program_name
165
- self.requireds: list[Required] = []
166
- self.options: list[Options] = []
167
- self.args: list[Options | OptionText] = []
168
-
169
- def add_argument(self, *args: str, **kwargs: Any) -> None:
170
- x = Options(args, **kwargs)
171
- self.options.append(x)
172
- self.args.append(x)
173
-
174
- def add_required(self, *args: str, **kwargs: Any) -> None:
175
- self.requireds.append(Required(args, **kwargs))
176
-
177
- def add_text(self, text: str) -> None:
178
- self.args.append(OptionText(text))
179
-
180
- def parse_args(
181
- self,
182
- ns_obj: type[T],
183
- sys_args: list[str],
184
- log_: Log | None = None,
185
- macros: list[tuple[set[str], list[str]]] | None = None,
186
- ) -> T:
187
- if not sys_args and self.program_name is not None:
188
- from auto_editor.help import data
189
-
190
- out(data[self.program_name]["_"])
191
- sys.exit()
192
-
193
- if macros is not None:
194
- _macros = [(x[0].union(map(to_underscore, x[0])), x[1]) for x in macros]
195
- for old_options, new in _macros:
196
- for old_option in old_options:
197
- if old_option in sys_args:
198
- pos = sys_args.index(old_option)
199
- sys_args[pos : pos + 1] = new
200
- del _macros
201
- del macros
202
-
203
- log = Log() if log_ is None else log_
204
- ns = ns_obj()
205
- option_names: list[str] = []
206
-
207
- def parse_value(option: Options | Required, val: str | None) -> Any:
208
- if val is None and option.nargs == 1:
209
- log.error(f"{option.names[0]} needs argument.")
210
-
211
- try:
212
- value = option.type(val)
213
- except CoerceError as e:
214
- log.error(e)
215
-
216
- if option.choices is not None and value not in option.choices:
217
- log.error(
218
- f"{value} is not a choice for {option.names[0]}\n"
219
- f"choices are:\n {', '.join(option.choices)}"
220
- )
221
- return value
222
-
223
- program_name = self.program_name
224
- requireds = self.requireds
225
- options = self.options
226
- args = self.args
227
-
228
- builtin_help = Options(
229
- ("--help", "-h"),
230
- flag=True,
231
- help="Show info about this program or option then exit",
232
- )
233
- options.append(builtin_help)
234
- args.append(builtin_help)
235
-
236
- # Figure out command line options changed by user.
237
- used_options: list[Options] = []
238
-
239
- req_list: list[str] = []
240
- req_list_name = requireds[0].names[0]
241
- setting_req_list = requireds[0].nargs != 1
242
-
243
- oplist_name: str | None = None
244
- oplist_coerce: Callable[[str], str] = str
245
-
246
- i = 0
247
- while i < len(sys_args):
248
- arg = sys_args[i]
249
- option = get_option(arg, options)
250
-
251
- if option is None:
252
- if oplist_name is not None:
253
- try:
254
- val = oplist_coerce(arg)
255
- ns.__setattr__(oplist_name, getattr(ns, oplist_name) + [val])
256
- except (CoerceError, ValueError) as e:
257
- log.error(e)
258
- elif requireds and not arg.startswith("--"):
259
- if requireds[0].nargs == 1:
260
- ns.__setattr__(req_list_name, parse_value(requireds[0], arg))
261
- requireds.pop()
262
- else:
263
- req_list.append(arg)
264
- else:
265
- label = "option" if arg.startswith("--") else "short"
266
-
267
- # 'Did you mean' message might appear that options need a comma.
268
- if arg.replace(",", "") in option_names:
269
- log.error(f"Option '{arg}' has an unnecessary comma.")
270
-
271
- close_matches = difflib.get_close_matches(arg, option_names)
272
- if close_matches:
273
- log.error(
274
- f"Unknown {label}: {arg}\n\n Did you mean:\n "
275
- + ", ".join(close_matches)
276
- )
277
- log.error(f"Unknown {label}: {arg}")
278
- else:
279
- if option.nargs != "*":
280
- if option in used_options:
281
- log.error(
282
- f"Option {option.names[0]} may not be used more than once."
283
- )
284
- used_options.append(option)
285
-
286
- oplist_name = None
287
- oplist_coerce = option.type
288
-
289
- key = to_key(option)
290
-
291
- next_arg = None if i == len(sys_args) - 1 else sys_args[i + 1]
292
- if next_arg in {"-h", "--help"}:
293
- print_option_help(program_name, ns_obj, option)
294
- sys.exit()
295
-
296
- if option.flag:
297
- ns.__setattr__(key, True)
298
- elif option.nargs == 1:
299
- ns.__setattr__(key, parse_value(option, next_arg))
300
- i += 1
301
- else:
302
- oplist_name = key
303
-
304
- i += 1
305
-
306
- if setting_req_list:
307
- ns.__setattr__(req_list_name, req_list)
308
-
309
- if getattr(ns, "help"):
310
- print_program_help(requireds, args)
311
- sys.exit()
312
-
313
- return ns
@@ -1,57 +0,0 @@
1
- auto_editor/__init__.py,sha256=22AwAEXAu8nCjcGi5JKpN5CwGqL0avyRi9p7xsPeXQk,23
2
- auto_editor/__main__.py,sha256=46l-4asehWV-GJIDDULm2Sh9RKD6KjVBariy6ijgFSI,15552
3
- auto_editor/analyze.py,sha256=b3x7efPza_PJ5E6zzSsgqFGYIRRulcpL1AEcrGVcFAg,12300
4
- auto_editor/edit.py,sha256=pU5uhyKJSsOoSVeZDWBUjWi2_UPEBXXEpHUsCD8CmwA,19690
5
- auto_editor/ffwrapper.py,sha256=YNGvHnkX0PTHsBx19kc-O3ZAiZX8WoqqZvIfjJ3tovQ,5474
6
- auto_editor/help.py,sha256=YAw0b_-b6_RXXuDSl6OHevCMrhDocxWbcvoIlj5Qq-E,7959
7
- auto_editor/json.py,sha256=g6ZsrSOXtjQj-8Otea3TIY2G-HZ6g-IXUblwukgTO1g,9332
8
- auto_editor/make_layers.py,sha256=JAel8N1wr3NSmd0LRhEQsMDHQILqcMXjGDZ_qTrs5No,10076
9
- auto_editor/preview.py,sha256=pBCw21wTORG0-Zs4Zf2anCecTNlnfiCq50tINeOcFmg,2815
10
- auto_editor/timeline.py,sha256=84k-sSK3c2kTZ28atPoIaWgSecZvO-fOGfsXFlmifP4,8165
11
- auto_editor/vanparse.py,sha256=Ug5A2QaRqGiw4l55Z_h9T2QU1x0WqRibR7yY5rQ0WTk,10002
12
- auto_editor/cmds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- auto_editor/cmds/cache.py,sha256=rK06dX3Z1pDAK0t5rqR7S2cMEpnT_Tv17t3Q5qPQKLI,1959
14
- auto_editor/cmds/desc.py,sha256=VKs6ibRMbC4I4ro5Qh2B-3xsfnYSwunkyEvgHidBTqk,805
15
- auto_editor/cmds/info.py,sha256=NwzZu6l6IIdK0ajZdn8WX_iiJwlsMrGIZ2vffDRu3gc,6535
16
- auto_editor/cmds/levels.py,sha256=sHaaDqCCU8fwV311kL_otVCBanrD37m8KvsIs5BQ1HY,5853
17
- auto_editor/cmds/palet.py,sha256=t2O_xM82PXUjnSgcHxyt9OG24gwQS4ksR2sKiQ1SvUA,743
18
- auto_editor/cmds/repl.py,sha256=HSUTDaVykPb5Bd-v_jz_8R7HvFmKOcT_ZVmP-d0AbUY,3247
19
- auto_editor/cmds/subdump.py,sha256=QPMX-Tb5ZIU857-u6UXSMf2pkoJON-OQ1zuZjhOFQgk,2393
20
- auto_editor/cmds/test.py,sha256=sFAbMKC_kTEIvFCjK7sm9cb2HL-ZyE0dNGCJpz-le9M,29946
21
- auto_editor/exports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- auto_editor/exports/fcp11.py,sha256=uOonQPBoSQSfUpdi58vqDgpZdmN6Jevm2YNPo9m9nI0,6195
23
- auto_editor/exports/fcp7.py,sha256=shZtn5i66hqGVrpR1PP1hiwKiZirr1cRUxATzbW-BOo,12069
24
- auto_editor/exports/json.py,sha256=Q176-MtctEyPVenxbjuhMx_j8oVx-_G4Zwa-PJ3f7oQ,1579
25
- auto_editor/exports/kdenlive.py,sha256=ZgMivXb2pBEF9zvU0Mnfm_a7CGupcb02jCt9EwDjwoQ,11798
26
- auto_editor/exports/shotcut.py,sha256=miIOvzM73tUJcHFCe7fUu66YZxEvlDSkV1PHxv8ED8k,4699
27
- auto_editor/imports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
- auto_editor/imports/fcp7.py,sha256=Vep1syViRZOrtZBlF6Ek_eRy0rLINpTso5nrh3uY3zk,8563
29
- auto_editor/imports/json.py,sha256=5c_vKoS8FzxAWagCetrwATHdnZ2beWQ77g8JYKVM0i8,6993
30
- auto_editor/lang/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
- auto_editor/lang/libintrospection.py,sha256=6H1rGp0wqaCud5IPaoEmzULGnYt6ec7_0h32ATcw2oY,261
32
- auto_editor/lang/libmath.py,sha256=z33A161Oe6vYYK7R6pgYjdZZe63dQkN38Qf36TL3prg,847
33
- auto_editor/lang/palet.py,sha256=bsuEWNEefTb0-69Dc4lq4aotqu7aarH1okETK8ab-Gw,22794
34
- auto_editor/lang/stdenv.py,sha256=Ier6zmn8eFd6cpMdgHnnShjmxXXPWH1ItGyqZQvSkjc,43475
35
- auto_editor/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
- auto_editor/lib/contracts.py,sha256=bADXnFXyq_-Tku59saxwDOlvexfS3wMAMdrKNL-Ql2w,7494
37
- auto_editor/lib/data_structs.py,sha256=2SxsOXKiY0H95wRIFOrQBjv1ykJUQar0Vr5dK9zZOiQ,6971
38
- auto_editor/lib/err.py,sha256=UlszQJdzMZwkbT8x3sY4GkCV_5x9yrd6uVVUzvA8iiI,35
39
- auto_editor/render/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
- auto_editor/render/audio.py,sha256=O4aUBfyLg4-6QmyXoOjwnKmw3n5ZMHvFJKGzu07BpgM,17629
41
- auto_editor/render/subtitle.py,sha256=6zPRbW2ksoBMDMm449vslLqs8v7htDEe5MRFEjXCGog,6129
42
- auto_editor/render/video.py,sha256=hrj2b6xJ7cu7JeALF_XaOOxGtJfYYvXAEIgylEXrh9k,11964
43
- auto_editor/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
- auto_editor/utils/bar.py,sha256=Ky9JRf37JTgLyvNuIXDfucaUE8H1vBbCqKLjttmsmmo,4156
45
- auto_editor/utils/chunks.py,sha256=J-eGKtEz68gFtRrj1kOSgH4Tj_Yz6prNQ7Xr-d9NQJw,52
46
- auto_editor/utils/cmdkw.py,sha256=aUGBvBel2Ko1o6Rwmr4rEL-BMc5hEnzYLbyZ1GeJdcY,5729
47
- auto_editor/utils/container.py,sha256=tdvTsY5kcz46DAQ7jvKoXk_UPzhsz430kSKEHL7RUTQ,2615
48
- auto_editor/utils/func.py,sha256=ODyjXnzSDatEu08w398K8_xBKYdXMY3IPHiJpGRZDyQ,3250
49
- auto_editor/utils/log.py,sha256=hTBpBpadu6uD161Uhi0X5Ks7aA1azbtjXVNmN_sz1ko,3748
50
- auto_editor/utils/types.py,sha256=j2hd4zMQ9EftDy41Ji2_PFru_7HEZObd9yKA0BJxFaY,7616
51
- auto_editor-28.1.0.dist-info/licenses/LICENSE,sha256=yiq99pWITHfqS0pbZMp7cy2dnbreTuvBwudsU-njvIM,1210
52
- docs/build.py,sha256=g1uc1H9T_naGaermUiVMMwUpbT0IWElRhjgT0fvCh8w,1914
53
- auto_editor-28.1.0.dist-info/METADATA,sha256=KEs0ikYYnmLrSLLhJXU4tgU9_LZGcCqWl82DjgGfmJI,6165
54
- auto_editor-28.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
55
- auto_editor-28.1.0.dist-info/entry_points.txt,sha256=UAsTc7qJQbnAzHd7KWg-ALo_X9Hj2yDs3M9I2DV3eyI,212
56
- auto_editor-28.1.0.dist-info/top_level.txt,sha256=jBV5zlbWRbKOa-xaWPvTD45QL7lGExx2BDzv-Ji4dTw,17
57
- auto_editor-28.1.0.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- [console_scripts]
2
- aedesc = auto_editor.cmds.desc:main
3
- aeinfo = auto_editor.cmds.info:main
4
- aelevels = auto_editor.cmds.levels:main
5
- aesubdump = auto_editor.cmds.subdump:main
6
- auto-editor = auto_editor.__main__:main
docs/build.py DELETED
@@ -1,70 +0,0 @@
1
- #!/usr/bin/env python3
2
-
3
- import os
4
- import sys
5
- from html import escape
6
-
7
- # Put 'auto_editor' in Python path
8
- sys.path.append(os.path.dirname(os.path.dirname(__file__)))
9
-
10
- import auto_editor.vanparse as vanparse
11
- from auto_editor.__main__ import main_options
12
- from auto_editor.lang.palet import Lexer, Parser, env, interpret
13
- from auto_editor.lang.stdenv import make_standard_env
14
- from auto_editor.vanparse import OptionText
15
-
16
-
17
- def main():
18
- parser = vanparse.ArgumentParser("Auto-Editor")
19
- parser = main_options(parser)
20
-
21
- with open("src/ref/options.html", "w") as file:
22
- file.write("""\
23
- <!DOCTYPE html>
24
- <html lang="en">
25
- <head>
26
- {{ init_head }}
27
- {{ headerdesc "Options" "These are the options and flags that auto-editor uses." }}
28
- {{ head_icon }}
29
- <style>
30
- {{ core_style }}
31
- </style>
32
- <body>
33
- {{ nav }}
34
- <section class="section">
35
- <div class="container">
36
- """)
37
-
38
- for op in parser.args:
39
- if isinstance(op, OptionText):
40
- file.write(f"<h2>{escape(op.text)}</h2>\n")
41
- else:
42
- if op.metavar is None:
43
- file.write(f"<h3><code>{op.names[0]}</code></h3>\n")
44
- else:
45
- file.write(
46
- f"<h3><code>{op.names[0]} {escape(op.metavar)}</code></h3>\n"
47
- )
48
-
49
- if len(op.names) > 1:
50
- file.write(
51
- "<h4>Aliases: <code>"
52
- + "</code> <code>".join(op.names[1:])
53
- + "</code></h4>\n"
54
- )
55
-
56
- file.write(f"<p>{op.help}</p>\n")
57
-
58
- file.write("</div>\n</section>\n</body>\n</html>\n\n")
59
-
60
- env.update(make_standard_env())
61
- with open("doc.pal") as sourcefile:
62
- try:
63
- interpret(env, Parser(Lexer("doc.pal", sourcefile.read())))
64
- except Exception as e:
65
- print(e)
66
- quit(1)
67
-
68
-
69
- if __name__ == "__main__":
70
- main()