article-cli 1.3.1__tar.gz → 1.4.0__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.
- {article_cli-1.3.1 → article_cli-1.4.0}/PKG-INFO +73 -11
- {article_cli-1.3.1 → article_cli-1.4.0}/README.md +70 -8
- {article_cli-1.3.1 → article_cli-1.4.0}/pyproject.toml +3 -3
- {article_cli-1.3.1 → article_cli-1.4.0}/src/article_cli/__init__.py +7 -4
- {article_cli-1.3.1 → article_cli-1.4.0}/src/article_cli/cli.py +116 -41
- {article_cli-1.3.1 → article_cli-1.4.0}/src/article_cli/config.py +22 -14
- {article_cli-1.3.1 → article_cli-1.4.0}/src/article_cli/fonts.py +0 -2
- {article_cli-1.3.1 → article_cli-1.4.0}/src/article_cli/repository_setup.py +302 -51
- {article_cli-1.3.1 → article_cli-1.4.0}/src/article_cli/themes.py +17 -7
- article_cli-1.4.0/src/article_cli/typst_compiler.py +287 -0
- {article_cli-1.3.1 → article_cli-1.4.0}/tests/test_fonts.py +1 -5
- {article_cli-1.3.1 → article_cli-1.4.0}/tests/test_latex_compiler.py +0 -1
- {article_cli-1.3.1 → article_cli-1.4.0}/tests/test_repository_setup.py +0 -3
- {article_cli-1.3.1 → article_cli-1.4.0}/tests/test_themes.py +66 -1
- article_cli-1.4.0/tests/test_typst_compiler.py +286 -0
- {article_cli-1.3.1 → article_cli-1.4.0}/.gitignore +0 -0
- {article_cli-1.3.1 → article_cli-1.4.0}/LICENSE +0 -0
- {article_cli-1.3.1 → article_cli-1.4.0}/src/article_cli/__main__.py +0 -0
- {article_cli-1.3.1 → article_cli-1.4.0}/src/article_cli/git_manager.py +0 -0
- {article_cli-1.3.1 → article_cli-1.4.0}/src/article_cli/latex_compiler.py +0 -0
- {article_cli-1.3.1 → article_cli-1.4.0}/src/article_cli/zotero.py +0 -0
- {article_cli-1.3.1 → article_cli-1.4.0}/tests/__init__.py +0 -0
- {article_cli-1.3.1 → article_cli-1.4.0}/tests/test_config.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: article-cli
|
|
3
|
-
Version: 1.
|
|
4
|
-
Summary: CLI tool for managing LaTeX
|
|
3
|
+
Version: 1.4.0
|
|
4
|
+
Summary: CLI tool for managing LaTeX and Typst documents with git integration and Zotero bibliography
|
|
5
5
|
Project-URL: Homepage, https://github.com/feelpp/article.cli
|
|
6
6
|
Project-URL: Documentation, https://github.com/feelpp/article.cli#readme
|
|
7
7
|
Project-URL: Repository, https://github.com/feelpp/article.cli.git
|
|
@@ -29,7 +29,7 @@ License: MIT License
|
|
|
29
29
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
30
|
SOFTWARE.
|
|
31
31
|
License-File: LICENSE
|
|
32
|
-
Keywords: academic,bibliography,git,latex,research,zotero
|
|
32
|
+
Keywords: academic,bibliography,git,latex,presentations,research,typst,zotero
|
|
33
33
|
Classifier: Development Status :: 4 - Beta
|
|
34
34
|
Classifier: Intended Audience :: Science/Research
|
|
35
35
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -59,13 +59,14 @@ Description-Content-Type: text/markdown
|
|
|
59
59
|
[](https://badge.fury.io/py/article-cli)
|
|
60
60
|
[](https://pypi.org/project/article-cli/)
|
|
61
61
|
|
|
62
|
-
A command-line tool for managing LaTeX
|
|
62
|
+
A command-line tool for managing LaTeX and Typst documents with git integration and Zotero bibliography synchronization.
|
|
63
63
|
|
|
64
64
|
## Features
|
|
65
65
|
|
|
66
|
-
- **Repository Initialization**: Complete setup for LaTeX
|
|
67
|
-
- **Project Types**: Support for articles, Beamer presentations, and
|
|
66
|
+
- **Repository Initialization**: Complete setup for LaTeX or Typst projects with one command
|
|
67
|
+
- **Project Types**: Support for articles, Beamer presentations, posters, and Typst documents
|
|
68
68
|
- **LaTeX Compilation**: Compile documents with latexmk/pdflatex/xelatex/lualatex, watch mode, shell escape support
|
|
69
|
+
- **Typst Compilation**: Full support for Typst documents with watch mode and custom font paths
|
|
69
70
|
- **Font Installation**: Download and install fonts for XeLaTeX projects (Marianne, Roboto Mono, etc.)
|
|
70
71
|
- **GitHub Actions Workflows**: Automated PDF compilation with XeLaTeX support, artifact upload, and GitHub releases
|
|
71
72
|
- **Git Release Management**: Create, list, and delete releases with gitinfo2 support
|
|
@@ -186,8 +187,13 @@ directory = "."
|
|
|
186
187
|
# url = "https://example.com/theme.zip"
|
|
187
188
|
# description = "My custom theme"
|
|
188
189
|
# files = ["beamerthememytheme.sty"]
|
|
190
|
+
# typst_files = ["mytheme.typ"]
|
|
189
191
|
# requires_fonts = false
|
|
190
192
|
# engine = "pdflatex"
|
|
193
|
+
|
|
194
|
+
[typst]
|
|
195
|
+
font_paths = ["fonts/", "~/.fonts/"]
|
|
196
|
+
build_dir = "build"
|
|
191
197
|
```
|
|
192
198
|
|
|
193
199
|
## Usage
|
|
@@ -204,6 +210,12 @@ article-cli init --title "My Presentation" --authors "Author" --type presentatio
|
|
|
204
210
|
# Initialize with numpex theme (requires theme files from presentation.template.d)
|
|
205
211
|
article-cli init --title "NumPEx Talk" --authors "Author" --type presentation --theme numpex
|
|
206
212
|
|
|
213
|
+
# Initialize a Typst presentation project
|
|
214
|
+
article-cli init --title "My Typst Talk" --authors "Author" --type typst-presentation
|
|
215
|
+
|
|
216
|
+
# Initialize a Typst poster project
|
|
217
|
+
article-cli init --title "My Typst Poster" --authors "Author" --type typst-poster
|
|
218
|
+
|
|
207
219
|
# Specify custom Zotero group ID
|
|
208
220
|
article-cli init --title "My Article" --authors "Author" --group-id 1234567
|
|
209
221
|
|
|
@@ -279,6 +291,32 @@ article-cli compile --clean-first --clean-after
|
|
|
279
291
|
article-cli compile --output-dir build/
|
|
280
292
|
```
|
|
281
293
|
|
|
294
|
+
### Typst Compilation
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
# Compile a Typst document (auto-detects .typ files)
|
|
298
|
+
article-cli compile presentation.typ
|
|
299
|
+
|
|
300
|
+
# Compile with explicit Typst engine
|
|
301
|
+
article-cli compile --engine typst document.typ
|
|
302
|
+
|
|
303
|
+
# Watch for changes and auto-recompile
|
|
304
|
+
article-cli compile presentation.typ --watch
|
|
305
|
+
|
|
306
|
+
# Specify custom font paths
|
|
307
|
+
article-cli compile presentation.typ --font-path fonts/
|
|
308
|
+
|
|
309
|
+
# Multiple font paths
|
|
310
|
+
article-cli compile presentation.typ --font-path fonts/ --font-path ~/.fonts/
|
|
311
|
+
|
|
312
|
+
# Specify output directory
|
|
313
|
+
article-cli compile presentation.typ --output-dir build/
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
**Note:** The engine is automatically detected from the file extension:
|
|
317
|
+
- `.tex` files use LaTeX engines (latexmk by default)
|
|
318
|
+
- `.typ` files use the Typst engine
|
|
319
|
+
|
|
282
320
|
### Font Installation
|
|
283
321
|
|
|
284
322
|
Install fonts for XeLaTeX projects (useful for custom Beamer themes):
|
|
@@ -323,9 +361,11 @@ article-cli install-theme my-theme --url https://example.com/theme.zip
|
|
|
323
361
|
```
|
|
324
362
|
|
|
325
363
|
**Available themes:**
|
|
326
|
-
- **numpex**: NumPEx
|
|
364
|
+
- **numpex**: NumPEx theme following French government visual identity
|
|
365
|
+
- LaTeX: Beamer theme files (requires XeLaTeX and custom fonts)
|
|
366
|
+
- Typst: `numpex.typ` theme file for Typst presentations
|
|
327
367
|
|
|
328
|
-
**Complete presentation setup:**
|
|
368
|
+
**Complete LaTeX presentation setup:**
|
|
329
369
|
```bash
|
|
330
370
|
# 1. Install the theme
|
|
331
371
|
article-cli install-theme numpex
|
|
@@ -337,6 +377,15 @@ article-cli install-fonts
|
|
|
337
377
|
article-cli compile presentation.tex --engine xelatex
|
|
338
378
|
```
|
|
339
379
|
|
|
380
|
+
**Complete Typst presentation setup:**
|
|
381
|
+
```bash
|
|
382
|
+
# 1. Install the theme (includes numpex.typ)
|
|
383
|
+
article-cli install-theme numpex
|
|
384
|
+
|
|
385
|
+
# 2. Compile with Typst
|
|
386
|
+
article-cli compile presentation.typ --font-path fonts/
|
|
387
|
+
```
|
|
388
|
+
|
|
340
389
|
### Project Setup
|
|
341
390
|
|
|
342
391
|
```bash
|
|
@@ -368,6 +417,7 @@ Release versions must follow the semantic versioning format:
|
|
|
368
417
|
- Python 3.8+
|
|
369
418
|
- Git repository with gitinfo2 package (for LaTeX integration)
|
|
370
419
|
- Zotero account with API access (for bibliography features)
|
|
420
|
+
- Typst CLI (for Typst compilation) - install from https://typst.app/
|
|
371
421
|
|
|
372
422
|
## License
|
|
373
423
|
|
|
@@ -383,12 +433,24 @@ MIT License - see LICENSE file for details.
|
|
|
383
433
|
|
|
384
434
|
## Changelog
|
|
385
435
|
|
|
386
|
-
### v1.
|
|
387
|
-
- Add
|
|
388
|
-
-
|
|
436
|
+
### v1.4.0
|
|
437
|
+
- Add full Typst document compilation support
|
|
438
|
+
- New `TypstCompiler` class for Typst documents
|
|
439
|
+
- Auto-detection of `.typ` files with automatic engine selection
|
|
440
|
+
- Watch mode for Typst with live recompilation
|
|
441
|
+
- Custom font path support (`--font-path` option)
|
|
442
|
+
- New project types: `typst-presentation` and `typst-poster`
|
|
443
|
+
- Theme installation now includes Typst files (e.g., `numpex.typ`)
|
|
444
|
+
- Typst configuration section in config files
|
|
445
|
+
|
|
446
|
+
### v1.3.0
|
|
389
447
|
- Add theme installation command (`install-theme`) for Beamer presentations
|
|
390
448
|
- Built-in support for numpex theme with automatic download
|
|
391
449
|
- Extended GitHub Actions workflow with XeLaTeX and multi-document support
|
|
450
|
+
|
|
451
|
+
### v1.2.0
|
|
452
|
+
- Add font installation command (`install-fonts`) for XeLaTeX projects
|
|
453
|
+
- Support Marianne and Roboto Mono fonts by default
|
|
392
454
|
- Add presentation project type with Beamer template support
|
|
393
455
|
- Add `--engine` option for xelatex and lualatex compilation
|
|
394
456
|
- Improved CI/CD with font installation steps
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
[](https://badge.fury.io/py/article-cli)
|
|
5
5
|
[](https://pypi.org/project/article-cli/)
|
|
6
6
|
|
|
7
|
-
A command-line tool for managing LaTeX
|
|
7
|
+
A command-line tool for managing LaTeX and Typst documents with git integration and Zotero bibliography synchronization.
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
|
-
- **Repository Initialization**: Complete setup for LaTeX
|
|
12
|
-
- **Project Types**: Support for articles, Beamer presentations, and
|
|
11
|
+
- **Repository Initialization**: Complete setup for LaTeX or Typst projects with one command
|
|
12
|
+
- **Project Types**: Support for articles, Beamer presentations, posters, and Typst documents
|
|
13
13
|
- **LaTeX Compilation**: Compile documents with latexmk/pdflatex/xelatex/lualatex, watch mode, shell escape support
|
|
14
|
+
- **Typst Compilation**: Full support for Typst documents with watch mode and custom font paths
|
|
14
15
|
- **Font Installation**: Download and install fonts for XeLaTeX projects (Marianne, Roboto Mono, etc.)
|
|
15
16
|
- **GitHub Actions Workflows**: Automated PDF compilation with XeLaTeX support, artifact upload, and GitHub releases
|
|
16
17
|
- **Git Release Management**: Create, list, and delete releases with gitinfo2 support
|
|
@@ -131,8 +132,13 @@ directory = "."
|
|
|
131
132
|
# url = "https://example.com/theme.zip"
|
|
132
133
|
# description = "My custom theme"
|
|
133
134
|
# files = ["beamerthememytheme.sty"]
|
|
135
|
+
# typst_files = ["mytheme.typ"]
|
|
134
136
|
# requires_fonts = false
|
|
135
137
|
# engine = "pdflatex"
|
|
138
|
+
|
|
139
|
+
[typst]
|
|
140
|
+
font_paths = ["fonts/", "~/.fonts/"]
|
|
141
|
+
build_dir = "build"
|
|
136
142
|
```
|
|
137
143
|
|
|
138
144
|
## Usage
|
|
@@ -149,6 +155,12 @@ article-cli init --title "My Presentation" --authors "Author" --type presentatio
|
|
|
149
155
|
# Initialize with numpex theme (requires theme files from presentation.template.d)
|
|
150
156
|
article-cli init --title "NumPEx Talk" --authors "Author" --type presentation --theme numpex
|
|
151
157
|
|
|
158
|
+
# Initialize a Typst presentation project
|
|
159
|
+
article-cli init --title "My Typst Talk" --authors "Author" --type typst-presentation
|
|
160
|
+
|
|
161
|
+
# Initialize a Typst poster project
|
|
162
|
+
article-cli init --title "My Typst Poster" --authors "Author" --type typst-poster
|
|
163
|
+
|
|
152
164
|
# Specify custom Zotero group ID
|
|
153
165
|
article-cli init --title "My Article" --authors "Author" --group-id 1234567
|
|
154
166
|
|
|
@@ -224,6 +236,32 @@ article-cli compile --clean-first --clean-after
|
|
|
224
236
|
article-cli compile --output-dir build/
|
|
225
237
|
```
|
|
226
238
|
|
|
239
|
+
### Typst Compilation
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
# Compile a Typst document (auto-detects .typ files)
|
|
243
|
+
article-cli compile presentation.typ
|
|
244
|
+
|
|
245
|
+
# Compile with explicit Typst engine
|
|
246
|
+
article-cli compile --engine typst document.typ
|
|
247
|
+
|
|
248
|
+
# Watch for changes and auto-recompile
|
|
249
|
+
article-cli compile presentation.typ --watch
|
|
250
|
+
|
|
251
|
+
# Specify custom font paths
|
|
252
|
+
article-cli compile presentation.typ --font-path fonts/
|
|
253
|
+
|
|
254
|
+
# Multiple font paths
|
|
255
|
+
article-cli compile presentation.typ --font-path fonts/ --font-path ~/.fonts/
|
|
256
|
+
|
|
257
|
+
# Specify output directory
|
|
258
|
+
article-cli compile presentation.typ --output-dir build/
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**Note:** The engine is automatically detected from the file extension:
|
|
262
|
+
- `.tex` files use LaTeX engines (latexmk by default)
|
|
263
|
+
- `.typ` files use the Typst engine
|
|
264
|
+
|
|
227
265
|
### Font Installation
|
|
228
266
|
|
|
229
267
|
Install fonts for XeLaTeX projects (useful for custom Beamer themes):
|
|
@@ -268,9 +306,11 @@ article-cli install-theme my-theme --url https://example.com/theme.zip
|
|
|
268
306
|
```
|
|
269
307
|
|
|
270
308
|
**Available themes:**
|
|
271
|
-
- **numpex**: NumPEx
|
|
309
|
+
- **numpex**: NumPEx theme following French government visual identity
|
|
310
|
+
- LaTeX: Beamer theme files (requires XeLaTeX and custom fonts)
|
|
311
|
+
- Typst: `numpex.typ` theme file for Typst presentations
|
|
272
312
|
|
|
273
|
-
**Complete presentation setup:**
|
|
313
|
+
**Complete LaTeX presentation setup:**
|
|
274
314
|
```bash
|
|
275
315
|
# 1. Install the theme
|
|
276
316
|
article-cli install-theme numpex
|
|
@@ -282,6 +322,15 @@ article-cli install-fonts
|
|
|
282
322
|
article-cli compile presentation.tex --engine xelatex
|
|
283
323
|
```
|
|
284
324
|
|
|
325
|
+
**Complete Typst presentation setup:**
|
|
326
|
+
```bash
|
|
327
|
+
# 1. Install the theme (includes numpex.typ)
|
|
328
|
+
article-cli install-theme numpex
|
|
329
|
+
|
|
330
|
+
# 2. Compile with Typst
|
|
331
|
+
article-cli compile presentation.typ --font-path fonts/
|
|
332
|
+
```
|
|
333
|
+
|
|
285
334
|
### Project Setup
|
|
286
335
|
|
|
287
336
|
```bash
|
|
@@ -313,6 +362,7 @@ Release versions must follow the semantic versioning format:
|
|
|
313
362
|
- Python 3.8+
|
|
314
363
|
- Git repository with gitinfo2 package (for LaTeX integration)
|
|
315
364
|
- Zotero account with API access (for bibliography features)
|
|
365
|
+
- Typst CLI (for Typst compilation) - install from https://typst.app/
|
|
316
366
|
|
|
317
367
|
## License
|
|
318
368
|
|
|
@@ -328,12 +378,24 @@ MIT License - see LICENSE file for details.
|
|
|
328
378
|
|
|
329
379
|
## Changelog
|
|
330
380
|
|
|
331
|
-
### v1.
|
|
332
|
-
- Add
|
|
333
|
-
-
|
|
381
|
+
### v1.4.0
|
|
382
|
+
- Add full Typst document compilation support
|
|
383
|
+
- New `TypstCompiler` class for Typst documents
|
|
384
|
+
- Auto-detection of `.typ` files with automatic engine selection
|
|
385
|
+
- Watch mode for Typst with live recompilation
|
|
386
|
+
- Custom font path support (`--font-path` option)
|
|
387
|
+
- New project types: `typst-presentation` and `typst-poster`
|
|
388
|
+
- Theme installation now includes Typst files (e.g., `numpex.typ`)
|
|
389
|
+
- Typst configuration section in config files
|
|
390
|
+
|
|
391
|
+
### v1.3.0
|
|
334
392
|
- Add theme installation command (`install-theme`) for Beamer presentations
|
|
335
393
|
- Built-in support for numpex theme with automatic download
|
|
336
394
|
- Extended GitHub Actions workflow with XeLaTeX and multi-document support
|
|
395
|
+
|
|
396
|
+
### v1.2.0
|
|
397
|
+
- Add font installation command (`install-fonts`) for XeLaTeX projects
|
|
398
|
+
- Support Marianne and Roboto Mono fonts by default
|
|
337
399
|
- Add presentation project type with Beamer template support
|
|
338
400
|
- Add `--engine` option for xelatex and lualatex compilation
|
|
339
401
|
- Improved CI/CD with font installation steps
|
|
@@ -4,11 +4,11 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "article-cli"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.4.0"
|
|
8
8
|
authors = [
|
|
9
9
|
{name = "Christophe Prud'homme", email = "prudhomm@cemosis.fr"},
|
|
10
10
|
]
|
|
11
|
-
description = "CLI tool for managing LaTeX
|
|
11
|
+
description = "CLI tool for managing LaTeX and Typst documents with git integration and Zotero bibliography"
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
license = {file = "LICENSE"}
|
|
14
14
|
requires-python = ">=3.8"
|
|
@@ -26,7 +26,7 @@ classifiers = [
|
|
|
26
26
|
"Topic :: Scientific/Engineering",
|
|
27
27
|
"Topic :: Text Processing :: Markup :: LaTeX",
|
|
28
28
|
]
|
|
29
|
-
keywords = ["latex", "git", "zotero", "bibliography", "academic", "research"]
|
|
29
|
+
keywords = ["latex", "typst", "git", "zotero", "bibliography", "academic", "research", "presentations"]
|
|
30
30
|
dependencies = [
|
|
31
31
|
"requests>=2.28.0",
|
|
32
32
|
]
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Article CLI - A command-line tool for managing LaTeX
|
|
2
|
+
Article CLI - A command-line tool for managing LaTeX and Typst documents
|
|
3
3
|
|
|
4
4
|
This package provides tools for:
|
|
5
5
|
- Git release management with gitinfo2 support
|
|
6
6
|
- Zotero bibliography synchronization
|
|
7
|
-
- LaTeX
|
|
8
|
-
|
|
7
|
+
- LaTeX and Typst compilation
|
|
8
|
+
- Theme installation for presentations
|
|
9
|
+
- Git hooks setup
|
|
9
10
|
"""
|
|
10
11
|
|
|
11
|
-
__version__ = "1.
|
|
12
|
+
__version__ = "1.4.0"
|
|
12
13
|
__author__ = "Christophe Prud'homme"
|
|
13
14
|
__email__ = "prudhomm@cemosis.fr"
|
|
14
15
|
|
|
@@ -18,6 +19,7 @@ from .zotero import ZoteroBibTexUpdater
|
|
|
18
19
|
from .git_manager import GitManager
|
|
19
20
|
from .repository_setup import RepositorySetup
|
|
20
21
|
from .latex_compiler import LaTeXCompiler
|
|
22
|
+
from .typst_compiler import TypstCompiler
|
|
21
23
|
|
|
22
24
|
__all__ = [
|
|
23
25
|
"main",
|
|
@@ -26,4 +28,5 @@ __all__ = [
|
|
|
26
28
|
"GitManager",
|
|
27
29
|
"RepositorySetup",
|
|
28
30
|
"LaTeXCompiler",
|
|
31
|
+
"TypstCompiler",
|
|
29
32
|
]
|
|
@@ -31,6 +31,9 @@ Examples:
|
|
|
31
31
|
%(prog)s compile --engine pdflatex # Compile with pdflatex
|
|
32
32
|
%(prog)s compile --shell-escape # Enable shell escape
|
|
33
33
|
%(prog)s compile --watch # Watch and auto-recompile
|
|
34
|
+
%(prog)s compile presentation.typ # Compile Typst document
|
|
35
|
+
%(prog)s compile --engine typst --watch # Watch Typst file
|
|
36
|
+
%(prog)s compile --font-path fonts/ # Typst with custom fonts
|
|
34
37
|
%(prog)s create v1.0.0 # Create release v1.0.0
|
|
35
38
|
%(prog)s list --count 10 # List 10 recent releases
|
|
36
39
|
%(prog)s delete v1.0.0 # Delete release
|
|
@@ -38,7 +41,7 @@ Examples:
|
|
|
38
41
|
%(prog)s config create # Create sample config file
|
|
39
42
|
%(prog)s install-fonts # Install fonts for XeLaTeX
|
|
40
43
|
%(prog)s install-fonts --list # List installed fonts
|
|
41
|
-
%(prog)s install-theme numpex # Install numpex Beamer theme
|
|
44
|
+
%(prog)s install-theme numpex # Install numpex Beamer/Typst theme
|
|
42
45
|
%(prog)s install-theme --list # List available themes
|
|
43
46
|
|
|
44
47
|
Environment variables:
|
|
@@ -82,14 +85,20 @@ Environment variables:
|
|
|
82
85
|
)
|
|
83
86
|
init_parser.add_argument(
|
|
84
87
|
"--type",
|
|
85
|
-
choices=[
|
|
88
|
+
choices=[
|
|
89
|
+
"article",
|
|
90
|
+
"presentation",
|
|
91
|
+
"poster",
|
|
92
|
+
"typst-presentation",
|
|
93
|
+
"typst-poster",
|
|
94
|
+
],
|
|
86
95
|
default="article",
|
|
87
|
-
help="Project type (default: article). Use 'presentation' for Beamer slides.",
|
|
96
|
+
help="Project type (default: article). Use 'presentation' for Beamer, 'typst-presentation' for Typst slides.",
|
|
88
97
|
)
|
|
89
98
|
init_parser.add_argument(
|
|
90
99
|
"--theme",
|
|
91
100
|
default="",
|
|
92
|
-
help="
|
|
101
|
+
help="Theme for presentations (e.g., 'numpex'). Works with both Beamer and Typst.",
|
|
93
102
|
)
|
|
94
103
|
init_parser.add_argument(
|
|
95
104
|
"--aspect-ratio",
|
|
@@ -111,13 +120,19 @@ Environment variables:
|
|
|
111
120
|
compile_parser.add_argument(
|
|
112
121
|
"tex_file",
|
|
113
122
|
nargs="?",
|
|
114
|
-
help="
|
|
123
|
+
help="Document file to compile (.tex or .typ, auto-detected if not specified)",
|
|
115
124
|
)
|
|
116
125
|
compile_parser.add_argument(
|
|
117
126
|
"--engine",
|
|
118
|
-
choices=["latexmk", "pdflatex", "xelatex", "lualatex"],
|
|
127
|
+
choices=["latexmk", "pdflatex", "xelatex", "lualatex", "typst"],
|
|
119
128
|
default="latexmk",
|
|
120
|
-
help="
|
|
129
|
+
help="Compilation engine (default: latexmk). Use typst for .typ files, xelatex/lualatex for custom fonts.",
|
|
130
|
+
)
|
|
131
|
+
compile_parser.add_argument(
|
|
132
|
+
"--font-path",
|
|
133
|
+
action="append",
|
|
134
|
+
dest="font_paths",
|
|
135
|
+
help="Additional font path for Typst (can be specified multiple times)",
|
|
121
136
|
)
|
|
122
137
|
compile_parser.add_argument(
|
|
123
138
|
"--shell-escape",
|
|
@@ -294,48 +309,82 @@ def handle_clean_command(config: Config) -> int:
|
|
|
294
309
|
def handle_compile_command(args: argparse.Namespace, config: Config) -> int:
|
|
295
310
|
"""Handle the compile command"""
|
|
296
311
|
try:
|
|
297
|
-
from
|
|
312
|
+
# Determine engine from args or auto-detect from file extension
|
|
313
|
+
engine = args.engine
|
|
314
|
+
doc_file = args.tex_file
|
|
315
|
+
|
|
316
|
+
# Auto-detect file if not provided
|
|
317
|
+
if not doc_file:
|
|
318
|
+
# If engine is typst, look for .typ files first
|
|
319
|
+
if engine == "typst":
|
|
320
|
+
doc_file = _auto_detect_typ_file()
|
|
321
|
+
if not doc_file:
|
|
322
|
+
doc_file = _auto_detect_tex_file()
|
|
323
|
+
else:
|
|
324
|
+
doc_file = _auto_detect_tex_file()
|
|
325
|
+
if not doc_file:
|
|
326
|
+
doc_file = _auto_detect_typ_file()
|
|
298
327
|
|
|
299
|
-
|
|
300
|
-
tex_file = args.tex_file
|
|
301
|
-
if not tex_file:
|
|
302
|
-
tex_file = _auto_detect_tex_file()
|
|
303
|
-
if not tex_file:
|
|
328
|
+
if not doc_file:
|
|
304
329
|
print_error(
|
|
305
|
-
"No .tex file specified and none found in current directory"
|
|
330
|
+
"No .tex or .typ file specified and none found in current directory"
|
|
306
331
|
)
|
|
307
332
|
return 1
|
|
308
333
|
|
|
309
|
-
# Validate
|
|
310
|
-
|
|
311
|
-
if not
|
|
312
|
-
print_error(f"
|
|
334
|
+
# Validate file exists
|
|
335
|
+
doc_path = Path(doc_file)
|
|
336
|
+
if not doc_path.exists():
|
|
337
|
+
print_error(f"Document file not found: {doc_file}")
|
|
313
338
|
return 1
|
|
314
339
|
|
|
315
|
-
|
|
340
|
+
# Auto-detect engine from file extension if not explicitly set to typst
|
|
341
|
+
if doc_path.suffix == ".typ" and engine != "typst":
|
|
342
|
+
print_info(f"Detected Typst file, switching engine to typst")
|
|
343
|
+
engine = "typst"
|
|
344
|
+
elif doc_path.suffix == ".tex" and engine == "typst":
|
|
345
|
+
print_error(f"Cannot use Typst engine with .tex file: {doc_file}")
|
|
346
|
+
return 1
|
|
316
347
|
|
|
317
|
-
#
|
|
318
|
-
if
|
|
319
|
-
|
|
320
|
-
git_manager = GitManager()
|
|
321
|
-
latex_config = config.get_latex_config()
|
|
322
|
-
git_manager.clean_latex_files(latex_config["clean_extensions"])
|
|
323
|
-
|
|
324
|
-
# Compile the document
|
|
325
|
-
success = compiler.compile(
|
|
326
|
-
tex_file=tex_file,
|
|
327
|
-
engine=args.engine,
|
|
328
|
-
shell_escape=args.shell_escape,
|
|
329
|
-
output_dir=args.output_dir,
|
|
330
|
-
watch=args.watch,
|
|
331
|
-
)
|
|
348
|
+
# Use appropriate compiler
|
|
349
|
+
if engine == "typst":
|
|
350
|
+
from .typst_compiler import TypstCompiler
|
|
332
351
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
352
|
+
typst_compiler = TypstCompiler(config)
|
|
353
|
+
|
|
354
|
+
# Compile the document
|
|
355
|
+
success = typst_compiler.compile(
|
|
356
|
+
typ_file=doc_file,
|
|
357
|
+
output_dir=args.output_dir,
|
|
358
|
+
font_paths=args.font_paths,
|
|
359
|
+
watch=args.watch,
|
|
360
|
+
)
|
|
361
|
+
else:
|
|
362
|
+
from .latex_compiler import LaTeXCompiler
|
|
363
|
+
|
|
364
|
+
latex_compiler = LaTeXCompiler(config)
|
|
365
|
+
|
|
366
|
+
# Clean before compilation if requested
|
|
367
|
+
if args.clean_first:
|
|
368
|
+
print_info("Cleaning build files before compilation...")
|
|
369
|
+
git_manager = GitManager()
|
|
370
|
+
latex_config = config.get_latex_config()
|
|
371
|
+
git_manager.clean_latex_files(latex_config["clean_extensions"])
|
|
372
|
+
|
|
373
|
+
# Compile the document
|
|
374
|
+
success = latex_compiler.compile(
|
|
375
|
+
tex_file=doc_file,
|
|
376
|
+
engine=engine,
|
|
377
|
+
shell_escape=args.shell_escape,
|
|
378
|
+
output_dir=args.output_dir,
|
|
379
|
+
watch=args.watch,
|
|
380
|
+
)
|
|
381
|
+
|
|
382
|
+
# Clean after compilation if requested
|
|
383
|
+
if args.clean_after and success:
|
|
384
|
+
print_info("Cleaning build files after compilation...")
|
|
385
|
+
git_manager = GitManager()
|
|
386
|
+
latex_config = config.get_latex_config()
|
|
387
|
+
git_manager.clean_latex_files(latex_config["clean_extensions"])
|
|
339
388
|
|
|
340
389
|
return 0 if success else 1
|
|
341
390
|
|
|
@@ -365,6 +414,32 @@ def _auto_detect_tex_file() -> Optional[str]:
|
|
|
365
414
|
return tex_files[0].name
|
|
366
415
|
|
|
367
416
|
|
|
417
|
+
def _auto_detect_typ_file() -> Optional[str]:
|
|
418
|
+
"""Auto-detect main .typ file in current directory"""
|
|
419
|
+
current_dir = Path.cwd()
|
|
420
|
+
typ_files = list(current_dir.glob("*.typ"))
|
|
421
|
+
|
|
422
|
+
if not typ_files:
|
|
423
|
+
return None
|
|
424
|
+
|
|
425
|
+
if len(typ_files) == 1:
|
|
426
|
+
return typ_files[0].name
|
|
427
|
+
|
|
428
|
+
# Multiple .typ files - prefer common patterns
|
|
429
|
+
for pattern in [
|
|
430
|
+
"main.typ",
|
|
431
|
+
"presentation.typ",
|
|
432
|
+
"presentation.template.typ",
|
|
433
|
+
f"{current_dir.name}.typ",
|
|
434
|
+
]:
|
|
435
|
+
if (current_dir / pattern).exists():
|
|
436
|
+
return pattern
|
|
437
|
+
|
|
438
|
+
# Return first .typ file found
|
|
439
|
+
print_info(f"Multiple .typ files found, using: {typ_files[0].name}")
|
|
440
|
+
return typ_files[0].name
|
|
441
|
+
|
|
442
|
+
|
|
368
443
|
def handle_create_command(args: argparse.Namespace, config: Config) -> int:
|
|
369
444
|
"""Handle the create command"""
|
|
370
445
|
try:
|
|
@@ -491,7 +566,7 @@ def handle_config_command(args: argparse.Namespace, config: Config) -> int:
|
|
|
491
566
|
def handle_install_fonts_command(args: argparse.Namespace, config: Config) -> int:
|
|
492
567
|
"""Handle the install-fonts command"""
|
|
493
568
|
try:
|
|
494
|
-
from .fonts import FontInstaller
|
|
569
|
+
from .fonts import FontInstaller
|
|
495
570
|
|
|
496
571
|
fonts_config = config.get_fonts_config()
|
|
497
572
|
|
|
@@ -214,23 +214,12 @@ class Config:
|
|
|
214
214
|
|
|
215
215
|
def get_fonts_config(self) -> Dict[str, Any]:
|
|
216
216
|
"""Get font installation configuration"""
|
|
217
|
-
#
|
|
218
|
-
|
|
219
|
-
{
|
|
220
|
-
"name": "Marianne",
|
|
221
|
-
"url": "https://www.systeme-de-design.gouv.fr/uploads/Marianne_fd0ba9c190.zip",
|
|
222
|
-
"description": "French government official font",
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
"name": "Roboto Mono",
|
|
226
|
-
"url": "https://fonts.google.com/download?family=Roboto+Mono",
|
|
227
|
-
"description": "Google's monospace font",
|
|
228
|
-
},
|
|
229
|
-
]
|
|
217
|
+
# Import default sources from fonts module to keep them in sync
|
|
218
|
+
from .fonts import DEFAULT_FONT_SOURCES
|
|
230
219
|
|
|
231
220
|
return {
|
|
232
221
|
"directory": self.get("fonts", "directory", "fonts"),
|
|
233
|
-
"sources": self.get("fonts", "sources",
|
|
222
|
+
"sources": self.get("fonts", "sources", DEFAULT_FONT_SOURCES),
|
|
234
223
|
}
|
|
235
224
|
|
|
236
225
|
def get_themes_config(self) -> Dict[str, Any]:
|
|
@@ -245,6 +234,9 @@ class Config:
|
|
|
245
234
|
"beamercolorthemenumpex.sty",
|
|
246
235
|
"beamerfontthemenumpex.sty",
|
|
247
236
|
],
|
|
237
|
+
"typst_files": [
|
|
238
|
+
"numpex.typ",
|
|
239
|
+
],
|
|
248
240
|
"directories": ["images"],
|
|
249
241
|
"requires_fonts": True,
|
|
250
242
|
"engine": "xelatex",
|
|
@@ -256,6 +248,13 @@ class Config:
|
|
|
256
248
|
"sources": self.get("themes", "sources", default_sources),
|
|
257
249
|
}
|
|
258
250
|
|
|
251
|
+
def get_typst_config(self) -> Dict[str, Any]:
|
|
252
|
+
"""Get Typst-specific configuration"""
|
|
253
|
+
return {
|
|
254
|
+
"font_paths": self.get("typst", "font_paths", []),
|
|
255
|
+
"build_dir": self.get("typst", "build_dir", ""),
|
|
256
|
+
}
|
|
257
|
+
|
|
259
258
|
def validate_zotero_config(
|
|
260
259
|
self, args: argparse.Namespace
|
|
261
260
|
) -> Dict[str, Optional[str]]:
|
|
@@ -433,9 +432,18 @@ directory = "."
|
|
|
433
432
|
# url = "https://github.com/numpex/presentation.template.d/archive/refs/heads/main.zip"
|
|
434
433
|
# description = "NumPEx Beamer theme"
|
|
435
434
|
# files = ["beamerthemenumpex.sty", "beamercolorthemenumpex.sty", "beamerfontthemenumpex.sty"]
|
|
435
|
+
# typst_files = ["numpex.typ"]
|
|
436
436
|
# directories = ["images"]
|
|
437
437
|
# requires_fonts = true
|
|
438
438
|
# engine = "xelatex"
|
|
439
|
+
|
|
440
|
+
# Typst compilation settings
|
|
441
|
+
[typst]
|
|
442
|
+
# Font paths for Typst compiler (relative to project root)
|
|
443
|
+
# font_paths = ["fonts/Marianne/desktop", "fonts/Roboto/static"]
|
|
444
|
+
|
|
445
|
+
# Output directory for Typst builds
|
|
446
|
+
# build_dir = "build/typst"
|
|
439
447
|
"""
|
|
440
448
|
|
|
441
449
|
try:
|
|
@@ -4,7 +4,6 @@ Font installation module for article-cli
|
|
|
4
4
|
Provides functionality to download and install fonts for XeLaTeX projects.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
import os
|
|
8
7
|
import zipfile
|
|
9
8
|
import tempfile
|
|
10
9
|
from pathlib import Path
|
|
@@ -14,7 +13,6 @@ import requests
|
|
|
14
13
|
|
|
15
14
|
from .zotero import print_error, print_info, print_success, print_warning
|
|
16
15
|
|
|
17
|
-
|
|
18
16
|
# Default font sources for common themes
|
|
19
17
|
# Note: Marianne font from French government requires manual download due to Cloudflare protection.
|
|
20
18
|
# Configure custom URL in pyproject.toml if you have a mirror or local copy.
|