Load new math resources in the native Web editor
This commit is contained in:
1 parent
8b6dab8d52
commit
fe86163767
12 files changed
+838
-106
No files matched your search
+17
-3
@@ -125,13 +125,20 @@ def launch(args):
|
||||
env.update(manifest["environment"])
|
||||
env["TEXRRA_STATE_DIR"] = str(bundle / "state")
|
||||
profile = manifest["input_profile"]
|
||||
if args.action in ("open", "resume"):
|
||||
if args.action == "web":
|
||||
command = [
|
||||
bundle / "bin" / binary_name("native_editor"), "--input-profile", profile,
|
||||
"--web-dir", args.web_dir.resolve(strict=True), "--projects",
|
||||
args.projects_dir.resolve(), bundle / FORMAT, bundle / RESOURCES,
|
||||
bundle / "web-runs", str(args.port),
|
||||
]
|
||||
elif args.action in ("open", "resume"):
|
||||
if args.action == "resume":
|
||||
saved = args.snapshot.resolve(strict=True)
|
||||
project = json.loads((saved / "project.json").read_text(encoding="utf-8"))
|
||||
entry = Path(project["entry"])
|
||||
if len(entry.parts) != 1 or entry.name in ("", ".."):
|
||||
raise ValueError("The saved project entry must be a filename")
|
||||
if entry.is_absolute() or not entry.parts or ".." in entry.parts:
|
||||
raise ValueError("The saved project entry must be a relative path")
|
||||
source = (saved / "sources" / entry).resolve(strict=True)
|
||||
assets = project["files"]
|
||||
else:
|
||||
@@ -146,6 +153,8 @@ def launch(args):
|
||||
command = [bundle / "bin" / binary_name("native_editor"), "--input-profile", profile]
|
||||
if args.web_dir:
|
||||
command.extend(["--web-dir", args.web_dir.resolve(strict=True)])
|
||||
if args.action == "resume":
|
||||
command.extend(["--source-root", saved / "sources"])
|
||||
command.extend([source, bundle / FORMAT, bundle / RESOURCES, run, str(args.port), *assets])
|
||||
else:
|
||||
command = native_command(bundle / "bin" / binary_name("texrra"), profile, roots)
|
||||
@@ -178,6 +187,11 @@ def main():
|
||||
command.add_argument("--run-dir", type=Path)
|
||||
command.add_argument("--port", type=int, default=0)
|
||||
|
||||
web = commands.add_parser("web", help="open the native Web project library")
|
||||
web.add_argument("--web-dir", type=Path, required=True)
|
||||
web.add_argument("--projects-dir", type=Path, default=Path("projects"))
|
||||
web.add_argument("--port", type=int, default=0)
|
||||
|
||||
compiler = commands.add_parser("compile", help="produce a PDF with the bundle's native CLI")
|
||||
compiler.add_argument("entry", type=Path)
|
||||
compiler.add_argument("output", type=Path)
|
||||
|
||||
Reference in new issue
Block a user