pytex-preprocessor 0.1.0rc1__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.
- pytex_preprocessor-0.1.0rc1/PKG-INFO +82 -0
- pytex_preprocessor-0.1.0rc1/README.md +68 -0
- pytex_preprocessor-0.1.0rc1/pyproject.toml +77 -0
- pytex_preprocessor-0.1.0rc1/setup.cfg +4 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/__init__.py +87 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/__init__.py +51 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/biblatex.py +98 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/builtin.py +598 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/captions.py +56 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/cleveref.py +43 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/colors.py +60 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/conditionals.py +62 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/counters.py +85 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/definitions.py +109 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/floats.py +93 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/font.py +138 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/fontawesome.py +88 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/fontspec.py +75 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/geometry.py +25 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/glossaries.py +126 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/graphics.py +68 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/hooks.py +58 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/hyperref.py +57 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/lengths.py +200 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/listings.py +63 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/mdframed.py +43 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/picture.py +32 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/setspace.py +38 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/commands/tables.py +123 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/helpers/__init__.py +3 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/helpers/coerce.py +13 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/helpers/parenting.py +13 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/helpers/sanitize.py +54 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/helpers/with_package.py +61 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/interface/__init__.py +3 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/interface/control_sequence.py +29 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/interface/package.py +52 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/interface/tex.py +41 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/model/__init__.py +25 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/model/color.py +203 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/model/concat.py +31 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/model/control_sequence.py +72 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/model/document.py +120 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/model/document_class.py +29 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/model/empty.py +19 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/model/environment.py +30 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/model/image.py +137 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/model/include.py +21 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/model/length.py +54 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/model/math.py +401 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/model/package.py +132 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/model/raw.py +61 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/packages.py +221 -0
- pytex_preprocessor-0.1.0rc1/src/pytex/registry.py +49 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_builder/__init__.py +8 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_builder/build.py +175 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_builder/console.py +77 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_builder/render.py +82 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_builder/tectonic.py +307 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/__init__.py +116 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/fonts/Blender/Blender-Bold.ttf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/fonts/Blender/Blender-BoldItalic.ttf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/fonts/Blender/Blender-Book.ttf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/fonts/Blender/Blender-BookItalic.ttf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/fonts/Blender/Blender-Medium.ttf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/fonts/Blender/Blender-MediumItalic.ttf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/fonts/Blender/Blender-Strong.ttf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/fonts/Blender/Blender-Thin.ttf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/fonts/Blender/Blender-ThinItalic.ttf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/fonts/DIN/DIN-Black.ttf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/fonts/DIN/DIN-Bold.ttf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/fonts/DIN/DIN-BoldItalic.ttf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/fonts/DIN/DIN-Italic.ttf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/fonts/DIN/DIN-Medium.ttf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/fonts/DIN/DIN-Regular.ttf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/fonts/Times New Roman.ttf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/logos/ASTA.svg +79 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/logos/DUMMY.png +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/logos/DUMMY_FOOT.png +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/logos/ECHO.svg +226 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/logos/HSRT.pdf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/logos/INF.pdf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/logos/STUPA.pdf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/assets/logos/Skyline.pdf +0 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/boxes.py +215 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/citations.py +19 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/cleveref_names.py +47 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/colors.py +30 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/document.py +302 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/fonts.py +66 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/glossary.py +61 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/hyperref_config.py +45 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/listings.py +90 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/logos.py +234 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/pagebreak.py +67 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/pagesetup.py +33 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/tex/pagesetup.tex +76 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/titlepage.py +136 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/variants.py +24 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/voting.py +96 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/watermark.py +63 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_hsrtreport/wordcount.py +33 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_koma/__init__.py +90 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_koma/commands.py +296 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_koma/document.py +138 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_markdown/__init__.py +62 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_markdown/convert.py +268 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_markdown/escape.py +11 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_preprocessor.egg-info/PKG-INFO +82 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_preprocessor.egg-info/SOURCES.txt +114 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_preprocessor.egg-info/dependency_links.txt +1 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_preprocessor.egg-info/entry_points.txt +2 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_preprocessor.egg-info/requires.txt +7 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_preprocessor.egg-info/top_level.txt +6 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_tikz/__init__.py +25 -0
- pytex_preprocessor-0.1.0rc1/src/pytex_tikz/tikz.py +272 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pytex-preprocessor
|
|
3
|
+
Version: 0.1.0rc1
|
|
4
|
+
Summary: Type-safe LaTeX document generation with Python
|
|
5
|
+
Author-email: Frederik Beimgraben <frederik@beimgraben.net>
|
|
6
|
+
Requires-Python: >=3.13
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: pydantic
|
|
9
|
+
Requires-Dist: marko
|
|
10
|
+
Provides-Extra: dev
|
|
11
|
+
Requires-Dist: pytest; extra == "dev"
|
|
12
|
+
Requires-Dist: ruff; extra == "dev"
|
|
13
|
+
Requires-Dist: basedpyright; extra == "dev"
|
|
14
|
+
|
|
15
|
+
# pytex
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
python -m venv venv && . venv/bin/activate
|
|
21
|
+
pip install -e . # add [dev] for pytest
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`SVG` conversion needs `inkscape`. Compiling to PDF needs `tectonic` — if it
|
|
25
|
+
is not on `PATH`, `pytex --build` downloads a self-contained binary into a
|
|
26
|
+
temp folder and reuses it on later runs. Resolving glossaries/acronyms needs
|
|
27
|
+
`makeindex` from a TeX distribution (e.g. TeX Live).
|
|
28
|
+
|
|
29
|
+
## The `pytex` command
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
pytex example.tex.py # render -> example.out.tex
|
|
33
|
+
pytex example.tex.py --build # render + compile -> build/example.out.pdf
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The input is either:
|
|
37
|
+
|
|
38
|
+
- a `.py` file exposing a module-level `__pytex__` variable that is a `TeX`
|
|
39
|
+
node (e.g. a `Document`) — it is rendered, or
|
|
40
|
+
- a `.tex` file — wrapped in `IncludeTeX` (so `\iffalse pytex(...) \fi`
|
|
41
|
+
replacements are evaluated) and rendered.
|
|
42
|
+
|
|
43
|
+
### Options
|
|
44
|
+
|
|
45
|
+
| Flag | Default | Meaning |
|
|
46
|
+
| --- | --- | --- |
|
|
47
|
+
| `-o`, `--output` | `<input>.out.tex` | rendered LaTeX output path |
|
|
48
|
+
| `-b`, `--build` | off | compile the rendered `.tex` to PDF with tectonic |
|
|
49
|
+
| `--build-dir DIR` | `build` | directory for artifacts and tectonic output |
|
|
50
|
+
| `--no-shell-escape` | shell-escape on | disable shell-escape |
|
|
51
|
+
|
|
52
|
+
Shell-escape is enabled by default because inline images decode their base64
|
|
53
|
+
payloads at compile time. The build runs tectonic, then `makeindex` (for
|
|
54
|
+
`glossaries`/acronyms), then reruns tectonic when an index changed.
|
|
55
|
+
|
|
56
|
+
Output is minimal and color-tagged (`==>`, `note:`, `warning:`, `error:`),
|
|
57
|
+
following tectonic's style; on failure it points at the likely cause and the
|
|
58
|
+
log file. Set `NO_COLOR` to disable color.
|
|
59
|
+
|
|
60
|
+
## Markdown
|
|
61
|
+
|
|
62
|
+
`pytex_markdown` converts Markdown to native `TeX` nodes (via `marko`):
|
|
63
|
+
|
|
64
|
+
```py
|
|
65
|
+
from pytex_markdown import Markdown, IncludeMarkdown
|
|
66
|
+
|
|
67
|
+
body = Markdown("# Title\n\nText with **bold**, `code`, [a link](https://x).")
|
|
68
|
+
body = IncludeMarkdown("notes.md", base_level=-1) # base_level=-1: # -> \chapter
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Headings, emphasis, inline/fenced code, lists, links, images, block quotes and
|
|
72
|
+
thematic breaks map to the standard pytex library; text is LaTeX-escaped.
|
|
73
|
+
GitHub-style callouts become HSRT colored boxes (so the module depends on
|
|
74
|
+
`pytex_hsrtreport`):
|
|
75
|
+
|
|
76
|
+
```md
|
|
77
|
+
> [!NOTE] -> InfoBox > [!IMPORTANT] -> ImportantBox
|
|
78
|
+
> [!TIP] -> SuccessBox > [!WARNING] -> WarningBox
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Both factories are registered, so they are usable from `\iffalse pytex(...) \fi`
|
|
82
|
+
replacements in `.tex` sources too.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# pytex
|
|
2
|
+
|
|
3
|
+
## Install
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
python -m venv venv && . venv/bin/activate
|
|
7
|
+
pip install -e . # add [dev] for pytest
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
`SVG` conversion needs `inkscape`. Compiling to PDF needs `tectonic` — if it
|
|
11
|
+
is not on `PATH`, `pytex --build` downloads a self-contained binary into a
|
|
12
|
+
temp folder and reuses it on later runs. Resolving glossaries/acronyms needs
|
|
13
|
+
`makeindex` from a TeX distribution (e.g. TeX Live).
|
|
14
|
+
|
|
15
|
+
## The `pytex` command
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
pytex example.tex.py # render -> example.out.tex
|
|
19
|
+
pytex example.tex.py --build # render + compile -> build/example.out.pdf
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The input is either:
|
|
23
|
+
|
|
24
|
+
- a `.py` file exposing a module-level `__pytex__` variable that is a `TeX`
|
|
25
|
+
node (e.g. a `Document`) — it is rendered, or
|
|
26
|
+
- a `.tex` file — wrapped in `IncludeTeX` (so `\iffalse pytex(...) \fi`
|
|
27
|
+
replacements are evaluated) and rendered.
|
|
28
|
+
|
|
29
|
+
### Options
|
|
30
|
+
|
|
31
|
+
| Flag | Default | Meaning |
|
|
32
|
+
| --- | --- | --- |
|
|
33
|
+
| `-o`, `--output` | `<input>.out.tex` | rendered LaTeX output path |
|
|
34
|
+
| `-b`, `--build` | off | compile the rendered `.tex` to PDF with tectonic |
|
|
35
|
+
| `--build-dir DIR` | `build` | directory for artifacts and tectonic output |
|
|
36
|
+
| `--no-shell-escape` | shell-escape on | disable shell-escape |
|
|
37
|
+
|
|
38
|
+
Shell-escape is enabled by default because inline images decode their base64
|
|
39
|
+
payloads at compile time. The build runs tectonic, then `makeindex` (for
|
|
40
|
+
`glossaries`/acronyms), then reruns tectonic when an index changed.
|
|
41
|
+
|
|
42
|
+
Output is minimal and color-tagged (`==>`, `note:`, `warning:`, `error:`),
|
|
43
|
+
following tectonic's style; on failure it points at the likely cause and the
|
|
44
|
+
log file. Set `NO_COLOR` to disable color.
|
|
45
|
+
|
|
46
|
+
## Markdown
|
|
47
|
+
|
|
48
|
+
`pytex_markdown` converts Markdown to native `TeX` nodes (via `marko`):
|
|
49
|
+
|
|
50
|
+
```py
|
|
51
|
+
from pytex_markdown import Markdown, IncludeMarkdown
|
|
52
|
+
|
|
53
|
+
body = Markdown("# Title\n\nText with **bold**, `code`, [a link](https://x).")
|
|
54
|
+
body = IncludeMarkdown("notes.md", base_level=-1) # base_level=-1: # -> \chapter
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Headings, emphasis, inline/fenced code, lists, links, images, block quotes and
|
|
58
|
+
thematic breaks map to the standard pytex library; text is LaTeX-escaped.
|
|
59
|
+
GitHub-style callouts become HSRT colored boxes (so the module depends on
|
|
60
|
+
`pytex_hsrtreport`):
|
|
61
|
+
|
|
62
|
+
```md
|
|
63
|
+
> [!NOTE] -> InfoBox > [!IMPORTANT] -> ImportantBox
|
|
64
|
+
> [!TIP] -> SuccessBox > [!WARNING] -> WarningBox
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Both factories are registered, so they are usable from `\iffalse pytex(...) \fi`
|
|
68
|
+
replacements in `.tex` sources too.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pytex-preprocessor"
|
|
7
|
+
version = "0.1.0rc1"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="Frederik Beimgraben", email="frederik@beimgraben.net" },
|
|
10
|
+
]
|
|
11
|
+
description = "Type-safe LaTeX document generation with Python"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.13"
|
|
14
|
+
dependencies = ["pydantic", "marko"]
|
|
15
|
+
|
|
16
|
+
[project.optional-dependencies]
|
|
17
|
+
dev = ["pytest", "ruff", "basedpyright"]
|
|
18
|
+
|
|
19
|
+
[project.scripts]
|
|
20
|
+
pytex = "pytex_builder.build:main"
|
|
21
|
+
|
|
22
|
+
[tool.setuptools.packages.find]
|
|
23
|
+
where = ["src"]
|
|
24
|
+
|
|
25
|
+
[tool.setuptools.package-data]
|
|
26
|
+
pytex_hsrtreport = ["assets/**/*", "tex/**/*"]
|
|
27
|
+
|
|
28
|
+
[tool.pyright]
|
|
29
|
+
extraPaths = ["src"]
|
|
30
|
+
|
|
31
|
+
[tool.pytest.ini_options]
|
|
32
|
+
testpaths = ["tests"]
|
|
33
|
+
addopts = "--import-mode=importlib"
|
|
34
|
+
|
|
35
|
+
[tool.ruff]
|
|
36
|
+
line-length = 88
|
|
37
|
+
target-version = "py313"
|
|
38
|
+
src = ["src", "tests"]
|
|
39
|
+
|
|
40
|
+
[tool.ruff.lint]
|
|
41
|
+
select = [
|
|
42
|
+
"E", # pycodestyle errors
|
|
43
|
+
"W", # pycodestyle warnings
|
|
44
|
+
"F", # pyflakes
|
|
45
|
+
"I", # isort
|
|
46
|
+
"N", # pep8-naming
|
|
47
|
+
"UP", # pyupgrade
|
|
48
|
+
"B", # flake8-bugbear
|
|
49
|
+
"C4", # flake8-comprehensions
|
|
50
|
+
"SIM", # flake8-simplify
|
|
51
|
+
"RET", # flake8-return
|
|
52
|
+
"PIE", # flake8-pie
|
|
53
|
+
"TC", # flake8-type-checking
|
|
54
|
+
"ANN", # flake8-annotations
|
|
55
|
+
"RUF", # ruff-specific
|
|
56
|
+
]
|
|
57
|
+
# N802 (non-lowercase function names) is intentional: the public API mirrors
|
|
58
|
+
# LaTeX control sequences as PascalCase factories (`Bfseries`, `Author`,
|
|
59
|
+
# `Align`, ...). Renaming would break every document and downstream package.
|
|
60
|
+
ignore = ["N802"]
|
|
61
|
+
|
|
62
|
+
[tool.ruff.lint.per-file-ignores]
|
|
63
|
+
# Tests favour readability over full annotation coverage.
|
|
64
|
+
"tests/**" = ["ANN"]
|
|
65
|
+
# These modules embed raw LaTeX templates whose German typography uses
|
|
66
|
+
# non-ASCII glyphs on purpose (EN DASH separators, MULTIPLICATION SIGN). An
|
|
67
|
+
# inline `noqa` is impossible since it would land inside the template string.
|
|
68
|
+
# pagesetup is one large raw LaTeX template string; its lines cannot be
|
|
69
|
+
# reflowed (a source break would alter the emitted LaTeX).
|
|
70
|
+
"src/pytex_hsrtreport/pagesetup.py" = ["RUF001", "E501"]
|
|
71
|
+
"src/pytex_hsrtreport/watermark.py" = ["RUF002"]
|
|
72
|
+
# glossary holds raw LaTeX template constants (column types, style, labels)
|
|
73
|
+
# that exceed the line length and cannot be reflowed.
|
|
74
|
+
"src/pytex_hsrtreport/glossary.py" = ["E501"]
|
|
75
|
+
|
|
76
|
+
[tool.ruff.lint.isort]
|
|
77
|
+
known-first-party = ["pytex", "pytex_builder", "pytex_koma", "pytex_tikz", "pytex_hsrtreport", "pytex_markdown"]
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
from . import packages
|
|
2
|
+
from .commands import (
|
|
3
|
+
biblatex,
|
|
4
|
+
builtin,
|
|
5
|
+
captions,
|
|
6
|
+
cleveref,
|
|
7
|
+
colors,
|
|
8
|
+
conditionals,
|
|
9
|
+
counters,
|
|
10
|
+
definitions,
|
|
11
|
+
floats,
|
|
12
|
+
font,
|
|
13
|
+
fontawesome,
|
|
14
|
+
fontspec,
|
|
15
|
+
geometry,
|
|
16
|
+
glossaries,
|
|
17
|
+
graphics,
|
|
18
|
+
hooks,
|
|
19
|
+
hyperref,
|
|
20
|
+
lengths,
|
|
21
|
+
listings,
|
|
22
|
+
mdframed,
|
|
23
|
+
picture,
|
|
24
|
+
setspace,
|
|
25
|
+
tables,
|
|
26
|
+
)
|
|
27
|
+
from .helpers import coerce, sanitize, with_package
|
|
28
|
+
from .model import (
|
|
29
|
+
color,
|
|
30
|
+
concat,
|
|
31
|
+
control_sequence,
|
|
32
|
+
document,
|
|
33
|
+
document_class,
|
|
34
|
+
empty,
|
|
35
|
+
environment,
|
|
36
|
+
image,
|
|
37
|
+
include,
|
|
38
|
+
length,
|
|
39
|
+
math,
|
|
40
|
+
package,
|
|
41
|
+
raw,
|
|
42
|
+
)
|
|
43
|
+
from .registry import Registry
|
|
44
|
+
|
|
45
|
+
__all__ = [
|
|
46
|
+
"Registry",
|
|
47
|
+
"biblatex",
|
|
48
|
+
"builtin",
|
|
49
|
+
"captions",
|
|
50
|
+
"cleveref",
|
|
51
|
+
"coerce",
|
|
52
|
+
"color",
|
|
53
|
+
"colors",
|
|
54
|
+
"concat",
|
|
55
|
+
"conditionals",
|
|
56
|
+
"control_sequence",
|
|
57
|
+
"counters",
|
|
58
|
+
"definitions",
|
|
59
|
+
"document",
|
|
60
|
+
"document_class",
|
|
61
|
+
"empty",
|
|
62
|
+
"environment",
|
|
63
|
+
"floats",
|
|
64
|
+
"font",
|
|
65
|
+
"fontawesome",
|
|
66
|
+
"fontspec",
|
|
67
|
+
"geometry",
|
|
68
|
+
"glossaries",
|
|
69
|
+
"graphics",
|
|
70
|
+
"hooks",
|
|
71
|
+
"hyperref",
|
|
72
|
+
"image",
|
|
73
|
+
"include",
|
|
74
|
+
"length",
|
|
75
|
+
"lengths",
|
|
76
|
+
"listings",
|
|
77
|
+
"math",
|
|
78
|
+
"mdframed",
|
|
79
|
+
"package",
|
|
80
|
+
"packages",
|
|
81
|
+
"picture",
|
|
82
|
+
"raw",
|
|
83
|
+
"sanitize",
|
|
84
|
+
"setspace",
|
|
85
|
+
"tables",
|
|
86
|
+
"with_package",
|
|
87
|
+
]
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from . import (
|
|
2
|
+
biblatex,
|
|
3
|
+
builtin,
|
|
4
|
+
captions,
|
|
5
|
+
cleveref,
|
|
6
|
+
colors,
|
|
7
|
+
conditionals,
|
|
8
|
+
counters,
|
|
9
|
+
definitions,
|
|
10
|
+
floats,
|
|
11
|
+
font,
|
|
12
|
+
fontawesome,
|
|
13
|
+
fontspec,
|
|
14
|
+
geometry,
|
|
15
|
+
glossaries,
|
|
16
|
+
graphics,
|
|
17
|
+
hooks,
|
|
18
|
+
hyperref,
|
|
19
|
+
lengths,
|
|
20
|
+
listings,
|
|
21
|
+
mdframed,
|
|
22
|
+
picture,
|
|
23
|
+
setspace,
|
|
24
|
+
tables,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
__all__ = [
|
|
28
|
+
"biblatex",
|
|
29
|
+
"builtin",
|
|
30
|
+
"captions",
|
|
31
|
+
"cleveref",
|
|
32
|
+
"colors",
|
|
33
|
+
"conditionals",
|
|
34
|
+
"counters",
|
|
35
|
+
"definitions",
|
|
36
|
+
"floats",
|
|
37
|
+
"font",
|
|
38
|
+
"fontawesome",
|
|
39
|
+
"fontspec",
|
|
40
|
+
"geometry",
|
|
41
|
+
"glossaries",
|
|
42
|
+
"graphics",
|
|
43
|
+
"hooks",
|
|
44
|
+
"hyperref",
|
|
45
|
+
"lengths",
|
|
46
|
+
"listings",
|
|
47
|
+
"mdframed",
|
|
48
|
+
"picture",
|
|
49
|
+
"setspace",
|
|
50
|
+
"tables",
|
|
51
|
+
]
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
from ..helpers.with_package import with_package
|
|
2
|
+
from ..interface.tex import TeX
|
|
3
|
+
from ..model.control_sequence import ControlSequence, Parameter
|
|
4
|
+
from ..packages import BIBLATEX
|
|
5
|
+
from ..registry import Registry
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"Addbibresource",
|
|
9
|
+
"Autocite",
|
|
10
|
+
"Citeauthor",
|
|
11
|
+
"Citetitle",
|
|
12
|
+
"Citeyear",
|
|
13
|
+
"ExecuteBibliographyOptions",
|
|
14
|
+
"Footcite",
|
|
15
|
+
"Nocite",
|
|
16
|
+
"Parencite",
|
|
17
|
+
"Printbibliography",
|
|
18
|
+
"Textcite",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@Registry.add
|
|
23
|
+
@with_package(BIBLATEX)
|
|
24
|
+
def Addbibresource(path: str) -> TeX:
|
|
25
|
+
return ControlSequence("addbibresource", (Parameter(path),))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@Registry.add
|
|
29
|
+
@with_package(BIBLATEX)
|
|
30
|
+
def Printbibliography(
|
|
31
|
+
heading: str | None = None,
|
|
32
|
+
title: str | None = None,
|
|
33
|
+
) -> TeX:
|
|
34
|
+
opts = [
|
|
35
|
+
f"{key}={value}"
|
|
36
|
+
for key, value in (("heading", heading), ("title", title))
|
|
37
|
+
if value is not None
|
|
38
|
+
]
|
|
39
|
+
if not opts:
|
|
40
|
+
return ControlSequence("printbibliography", ())
|
|
41
|
+
return ControlSequence(
|
|
42
|
+
"printbibliography",
|
|
43
|
+
(Parameter(",".join(opts), optional=True),),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@Registry.add
|
|
48
|
+
@with_package(BIBLATEX)
|
|
49
|
+
def Textcite(*keys: str) -> TeX:
|
|
50
|
+
return ControlSequence("textcite", (Parameter(",".join(keys)),))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@Registry.add
|
|
54
|
+
@with_package(BIBLATEX)
|
|
55
|
+
def Parencite(*keys: str) -> TeX:
|
|
56
|
+
return ControlSequence("parencite", (Parameter(",".join(keys)),))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@Registry.add
|
|
60
|
+
@with_package(BIBLATEX)
|
|
61
|
+
def Autocite(*keys: str) -> TeX:
|
|
62
|
+
return ControlSequence("autocite", (Parameter(",".join(keys)),))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@Registry.add
|
|
66
|
+
@with_package(BIBLATEX)
|
|
67
|
+
def Footcite(*keys: str) -> TeX:
|
|
68
|
+
return ControlSequence("footcite", (Parameter(",".join(keys)),))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@Registry.add
|
|
72
|
+
@with_package(BIBLATEX)
|
|
73
|
+
def Citeauthor(key: str) -> TeX:
|
|
74
|
+
return ControlSequence("citeauthor", (Parameter(key),))
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@Registry.add
|
|
78
|
+
@with_package(BIBLATEX)
|
|
79
|
+
def Citeyear(key: str) -> TeX:
|
|
80
|
+
return ControlSequence("citeyear", (Parameter(key),))
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
@Registry.add
|
|
84
|
+
@with_package(BIBLATEX)
|
|
85
|
+
def Citetitle(key: str) -> TeX:
|
|
86
|
+
return ControlSequence("citetitle", (Parameter(key),))
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@Registry.add
|
|
90
|
+
@with_package(BIBLATEX)
|
|
91
|
+
def Nocite(*keys: str) -> TeX:
|
|
92
|
+
return ControlSequence("nocite", (Parameter(",".join(keys)),))
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@Registry.add
|
|
96
|
+
@with_package(BIBLATEX)
|
|
97
|
+
def ExecuteBibliographyOptions(options: dict[str, str]) -> TeX:
|
|
98
|
+
return ControlSequence("ExecuteBibliographyOptions", (Parameter(options),))
|