typ2pptx 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.
typ2pptx/__init__.py ADDED
@@ -0,0 +1,8 @@
1
+ """
2
+ typ2pptx - Convert Typst presentations to editable PowerPoint files.
3
+
4
+ This tool converts Typst presentations (generated via Touying framework)
5
+ to PowerPoint (.pptx) files with editable text, shapes, and images.
6
+ """
7
+
8
+ __version__ = "0.1.0"
typ2pptx/__main__.py ADDED
@@ -0,0 +1,98 @@
1
+ """
2
+ typ2pptx CLI - Convert Typst presentations to PowerPoint.
3
+
4
+ Usage:
5
+ typ2pptx slides.typ -o slides.pptx
6
+ typ2pptx slides.svg -o slides.pptx
7
+ typ2pptx slides.typ --typst-ts-cli /path/to/typst-ts-cli
8
+ """
9
+
10
+ import argparse
11
+ import sys
12
+ from pathlib import Path
13
+
14
+ from .core.converter import convert_typst_to_pptx, ConversionConfig
15
+
16
+
17
+ def main():
18
+ parser = argparse.ArgumentParser(
19
+ prog='typ2pptx',
20
+ description='Convert Typst presentations to PowerPoint (.pptx) files',
21
+ )
22
+
23
+ parser.add_argument(
24
+ 'input',
25
+ help='Input file (.typ or .svg)',
26
+ )
27
+ parser.add_argument(
28
+ '-o', '--output',
29
+ help='Output PPTX file path (default: same name as input)',
30
+ )
31
+ parser.add_argument(
32
+ '--typst-ts-cli',
33
+ default='typst-ts-cli',
34
+ help='Path to typst-ts-cli binary (default: typst-ts-cli)',
35
+ )
36
+ parser.add_argument(
37
+ '-v', '--verbose',
38
+ action='store_true',
39
+ help='Enable verbose output',
40
+ )
41
+ parser.add_argument(
42
+ '--raster-dpi',
43
+ type=int,
44
+ default=300,
45
+ help='DPI for rasterization (default: 300)',
46
+ )
47
+ parser.add_argument(
48
+ '--inline-math-mode',
49
+ choices=['text', 'glyph', 'auto'],
50
+ default='auto',
51
+ help='Inline math rendering: "text" (Cambria Math), "glyph" (glyph curves), or "auto" (heuristic). Default: auto',
52
+ )
53
+ parser.add_argument(
54
+ '--display-math-mode',
55
+ choices=['text', 'glyph', 'auto'],
56
+ default='glyph',
57
+ help='Display/block math rendering: "text" (Cambria Math), "glyph" (glyph curves), or "auto" (heuristic). Default: glyph',
58
+ )
59
+
60
+ args = parser.parse_args()
61
+
62
+ # Validate input
63
+ input_path = Path(args.input)
64
+ if not input_path.exists():
65
+ print(f"Error: Input file not found: {input_path}", file=sys.stderr)
66
+ sys.exit(1)
67
+
68
+ if input_path.suffix not in ('.typ', '.svg'):
69
+ print(f"Error: Unsupported input format: {input_path.suffix}", file=sys.stderr)
70
+ print("Supported formats: .typ, .svg", file=sys.stderr)
71
+ sys.exit(1)
72
+
73
+ # Configuration
74
+ config = ConversionConfig(
75
+ raster_dpi=args.raster_dpi,
76
+ inline_math_mode=args.inline_math_mode,
77
+ display_math_mode=args.display_math_mode,
78
+ )
79
+
80
+ try:
81
+ output = convert_typst_to_pptx(
82
+ str(input_path),
83
+ output_path=args.output,
84
+ typst_ts_cli=args.typst_ts_cli,
85
+ config=config,
86
+ verbose=args.verbose,
87
+ )
88
+ print(f"Successfully created: {output}")
89
+ except Exception as e:
90
+ print(f"Error: {e}", file=sys.stderr)
91
+ if args.verbose:
92
+ import traceback
93
+ traceback.print_exc()
94
+ sys.exit(1)
95
+
96
+
97
+ if __name__ == '__main__':
98
+ main()
@@ -0,0 +1 @@
1
+ """Core conversion modules for typ2pptx."""