bloops 0.1.4__tar.gz → 0.2.1__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.
- {bloops-0.1.4 → bloops-0.2.1}/.gitignore +0 -1
- bloops-0.1.4/README.md → bloops-0.2.1/PKG-INFO +80 -24
- bloops-0.1.4/PKG-INFO → bloops-0.2.1/README.md +47 -46
- bloops-0.1.4/docs/API.md → bloops-0.2.1/docs/api.md +22 -3
- {bloops-0.1.4 → bloops-0.2.1}/example/content.bbcode +5 -1
- {bloops-0.1.4 → bloops-0.2.1}/example/index.html +29 -26
- {bloops-0.1.4 → bloops-0.2.1}/pyproject.toml +20 -3
- bloops-0.2.1/src/bloops/__about__.py +5 -0
- bloops-0.2.1/src/bloops/__init__.py +6 -0
- bloops-0.2.1/src/bloops/__main__.py +6 -0
- {bloops-0.1.4 → bloops-0.2.1}/src/bloops/_build_and_preview.py +25 -22
- {bloops-0.1.4 → bloops-0.2.1}/src/bloops/_helper.py +0 -2
- {bloops-0.1.4 → bloops-0.2.1}/src/bloops/bloopser.py +40 -78
- {bloops-0.1.4 → bloops-0.2.1}/src/bloops/bracer.py +1 -4
- bloops-0.1.4/src/bloops/__main__.py → bloops-0.2.1/src/bloops/cli.py +1 -8
- bloops-0.1.4/src/bloops/vars.py → bloops-0.2.1/src/bloops/static/error_template.html +31 -395
- bloops-0.2.1/src/bloops/static/index.html +64 -0
- bloops-0.2.1/src/bloops/static/script.js +32 -0
- bloops-0.2.1/src/bloops/static/style.css +315 -0
- {bloops-0.1.4 → bloops-0.2.1}/src/bloops/validator.py +35 -20
- bloops-0.2.1/src/bloops/vars.py +122 -0
- bloops-0.1.4/tests/test_asy_generatation.py → bloops-0.2.1/tests/test_asy_generation.py +3 -4
- {bloops-0.1.4 → bloops-0.2.1}/tests/test_asy_tag.py +11 -12
- {bloops-0.1.4 → bloops-0.2.1}/tests/test_bloopser.py +5 -6
- {bloops-0.1.4 → bloops-0.2.1}/tests/test_bracer.py +8 -9
- {bloops-0.1.4 → bloops-0.2.1}/tests/test_img_tag.py +11 -12
- {bloops-0.1.4 → bloops-0.2.1}/tests/test_list_tag.py +11 -12
- {bloops-0.1.4 → bloops-0.2.1}/tests/test_math_boxes.py +33 -34
- {bloops-0.1.4 → bloops-0.2.1}/tests/test_remaining_tags.py +12 -44
- {bloops-0.1.4 → bloops-0.2.1}/tests/test_simple_tags.py +16 -17
- {bloops-0.1.4 → bloops-0.2.1}/tests/test_transpile.py +21 -22
- {bloops-0.1.4 → bloops-0.2.1}/tests/test_validator.py +13 -13
- bloops-0.1.4/.github/dependabot.yaml +0 -26
- bloops-0.1.4/.github/scripts/update-api-docs.py +0 -60
- bloops-0.1.4/.github/scripts/update-example.py +0 -19
- bloops-0.1.4/.github/workflows/codeql.yaml +0 -96
- bloops-0.1.4/.github/workflows/lint-pr.yaml +0 -20
- bloops-0.1.4/.github/workflows/prek.yaml +0 -24
- bloops-0.1.4/.github/workflows/pytest.yaml +0 -30
- bloops-0.1.4/.github/workflows/release.yaml +0 -30
- bloops-0.1.4/.github/workflows/update-api-docs.yaml +0 -31
- bloops-0.1.4/.github/workflows/update-example.yaml +0 -40
- bloops-0.1.4/.pre-commit-config.yaml +0 -92
- bloops-0.1.4/.python-version +0 -1
- bloops-0.1.4/.yamllint.yaml +0 -3
- bloops-0.1.4/CONTRIBUTING.md +0 -58
- bloops-0.1.4/assets/banner.png +0 -0
- bloops-0.1.4/prek.toml +0 -114
- bloops-0.1.4/rumdl.toml +0 -19
- bloops-0.1.4/src/bloops/__about__.py +0 -3
- bloops-0.1.4/tombi.toml +0 -2
- bloops-0.1.4/uv.lock +0 -159
- bloops-0.1.4/yamlfmt.yaml +0 -4
- {bloops-0.1.4 → bloops-0.2.1}/LICENSE +0 -0
- /bloops-0.1.4/src/bloops/__init__.py → /bloops-0.2.1/src/bloops/py.typed +0 -0
|
@@ -1,5 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: bloops
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: An AoPS-like BBCode to HTML transpiler, with live-preview and support for Asymptote geometry diagrams.
|
|
5
|
+
Project-URL: Documentation, https://github.com/Bubu-Droid/bloops/blob/main/docs/api.md
|
|
6
|
+
Project-URL: Issues, https://github.com/Bubu-Droid/bloops/issues
|
|
7
|
+
Project-URL: Repository, https://github.com/Bubu-Droid/bloops
|
|
8
|
+
Author-email: Bubu-Droid <bubu@bubudroid.me>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: aops,asymptote,bbcode,converter,diagrams,geometry,html,latex,live-preview,markup,math,tex,transpiler
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Education
|
|
16
|
+
Classifier: Natural Language :: English
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
23
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
24
|
+
Classifier: Topic :: Education
|
|
25
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
26
|
+
Classifier: Topic :: Text Processing :: Markup
|
|
27
|
+
Classifier: Topic :: Text Processing :: Markup :: HTML
|
|
28
|
+
Classifier: Typing :: Typed
|
|
29
|
+
Requires-Python: >=3.12
|
|
30
|
+
Requires-Dist: livereload>=2.7.1
|
|
31
|
+
Requires-Dist: watchdog>=6
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
1
34
|
<div align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/Bubu-Droid/bloops/main/assets/banner.png"
|
|
35
|
+
<img src="https://raw.githubusercontent.com/Bubu-Droid/bloops/main/assets/banner.png" width="90%">
|
|
3
36
|
</div>
|
|
4
37
|
|
|
5
38
|
<hr>
|
|
@@ -12,11 +45,11 @@ and support for **Asymptote geometry diagrams**.
|
|
|
12
45
|
<a href="https://github.com/Bubu-Droid/bloops/releases/latest">
|
|
13
46
|
<img alt="PyPI Version" src="https://img.shields.io/pypi/v/bloops?label=PyPI&style=for-the-badge&logo=pypi&logoColor=c0caf5&labelColor=1a1b26&color=7aa2f7&v=1" />
|
|
14
47
|
</a>
|
|
15
|
-
<a href="https://github.com/Bubu-Droid/bloops/actions/workflows/prek.
|
|
16
|
-
<img alt="Prek CI Status" src="https://img.shields.io/github/actions/workflow/status/Bubu-Droid/bloops/prek.
|
|
48
|
+
<a href="https://github.com/Bubu-Droid/bloops/actions/workflows/prek.yml">
|
|
49
|
+
<img alt="Prek CI Status" src="https://img.shields.io/github/actions/workflow/status/Bubu-Droid/bloops/prek.yml?label=CI&style=for-the-badge&logo=githubactions&logoColor=c0caf5&labelColor=1a1b26&color=9ece6a" />
|
|
17
50
|
</a>
|
|
18
|
-
<a href="https://github.com/Bubu-Droid/bloops/actions/workflows/pytest.
|
|
19
|
-
<img alt="Unit Tests Status" src="https://img.shields.io/github/actions/workflow/status/Bubu-Droid/bloops/pytest.
|
|
51
|
+
<a href="https://github.com/Bubu-Droid/bloops/actions/workflows/pytest.yml">
|
|
52
|
+
<img alt="Unit Tests Status" src="https://img.shields.io/github/actions/workflow/status/Bubu-Droid/bloops/pytest.yml?label=Unit%20Tests&style=for-the-badge&logo=pytest&logoColor=c0caf5&labelColor=1a1b26&color=9ece6a" />
|
|
20
53
|
</a>
|
|
21
54
|
</div>
|
|
22
55
|
|
|
@@ -27,8 +60,8 @@ and support for **Asymptote geometry diagrams**.
|
|
|
27
60
|
<a href="https://github.com/Bubu-Droid/bloops/issues">
|
|
28
61
|
<img alt="GitHub Issues" src="https://img.shields.io/github/issues/Bubu-Droid/bloops?label=Issues&style=for-the-badge&logo=github&logoColor=c0caf5&labelColor=1a1b26&color=e0af68" />
|
|
29
62
|
</a>
|
|
30
|
-
<a href="https://github.com/Bubu-Droid/bloops/actions/workflows/codeql.
|
|
31
|
-
<img alt="CodeQL Status" src="https://img.shields.io/github/actions/workflow/status/Bubu-Droid/bloops/codeql.
|
|
63
|
+
<a href="https://github.com/Bubu-Droid/bloops/actions/workflows/codeql.yml">
|
|
64
|
+
<img alt="CodeQL Status" src="https://img.shields.io/github/actions/workflow/status/Bubu-Droid/bloops/codeql.yml?label=CodeQL&style=for-the-badge&logo=github&logoColor=c0caf5&labelColor=1a1b26&color=bb9af7" />
|
|
32
65
|
</a>
|
|
33
66
|
</div>
|
|
34
67
|
|
|
@@ -88,7 +121,11 @@ for vector diagram rendering
|
|
|
88
121
|
Install `bloops` from PyPI. Here is the
|
|
89
122
|
[PyPI listing](https://pypi.org/project/bloops/).
|
|
90
123
|
|
|
91
|
-
- I suggest using `uv`:
|
|
124
|
+
- I suggest using `uv`:
|
|
125
|
+
- Run `uv tool install bloops` if you'd like to use `bloops`
|
|
126
|
+
just as a CLI tool.
|
|
127
|
+
- Run `uv add bloops` if you you'd like to import `bloops`
|
|
128
|
+
as a package in your project.
|
|
92
129
|
- Or, if you want to use `pip`: run `pip install bloops`.
|
|
93
130
|
- AUR entry is yet to be added.
|
|
94
131
|
|
|
@@ -101,7 +138,7 @@ Install `bloops` from PyPI. Here is the
|
|
|
101
138
|
| Flag | Long Flag | Description |
|
|
102
139
|
| ---- | -------------- | ------------------------------------------------------------------------- |
|
|
103
140
|
| `-h` | `--help` | Show help message for usage of `bloops`. |
|
|
104
|
-
| `-
|
|
141
|
+
| `-V` | `--version` | Show the version of `bloops`. |
|
|
105
142
|
| `-c` | `--build-cont` | Watch `content.bbcode` for changes and continuously rebuild `index.html`. |
|
|
106
143
|
| `-p` | `--preview` | Launch a local web live-server to preview `index.html`. |
|
|
107
144
|
| `-i` | `--input` | (**Required**) Input directory containing `content.bbcode`. |
|
|
@@ -169,9 +206,9 @@ Here are reference tables for each BBCode tag bloops uses:
|
|
|
169
206
|
|
|
170
207
|
<details><summary>[color]</summary>
|
|
171
208
|
|
|
172
|
-
| Option
|
|
173
|
-
|
|
|
174
|
-
| `
|
|
209
|
+
| Option | Mandatory | Description |
|
|
210
|
+
| ------ | :-------: | ---------------------------------------- |
|
|
211
|
+
| `hex` | YES | Color code in hex (with the leading \#). |
|
|
175
212
|
|
|
176
213
|
</details>
|
|
177
214
|
|
|
@@ -219,6 +256,14 @@ Here are reference tables for each BBCode tag bloops uses:
|
|
|
219
256
|
|
|
220
257
|
</details>
|
|
221
258
|
|
|
259
|
+
<details><summary>[hide]</summary>
|
|
260
|
+
|
|
261
|
+
| Option | Mandatory | Description |
|
|
262
|
+
| ------- | :-------: | --------------------------------------------------- |
|
|
263
|
+
| `label` | YES | Label to be used as the summary for hidden details. |
|
|
264
|
+
|
|
265
|
+
</details>
|
|
266
|
+
|
|
222
267
|
<details><summary>math environments</summary>
|
|
223
268
|
|
|
224
269
|
Currently, the following math box tags are supported:
|
|
@@ -238,6 +283,11 @@ proof and solutions.
|
|
|
238
283
|
|
|
239
284
|
<details><summary>tags without any options</summary>
|
|
240
285
|
|
|
286
|
+
| Tag | Purpose |
|
|
287
|
+
| ---------------------------------- | ------------------------------------------------ |
|
|
288
|
+
| `[sidemark][/sidemark]` | To put a number in the subscript for a sidenote. |
|
|
289
|
+
| `[sidenote]<your-note>[/sidenote]` | To write a note to be put aside. |
|
|
290
|
+
|
|
241
291
|
| Tag | HTML Counterpart |
|
|
242
292
|
| ------- | ---------------- |
|
|
243
293
|
| `[b]` | `<strong>` |
|
|
@@ -259,9 +309,9 @@ proof and solutions.
|
|
|
259
309
|
<br>
|
|
260
310
|
|
|
261
311
|
An example showcasing the use of tags mentioned above has been
|
|
262
|
-
provided in [example/content.bbcode]
|
|
312
|
+
provided in [example/content.bbcode][content.bbcode]
|
|
263
313
|
and the corresponding generated HTML file is present in
|
|
264
|
-
[example/index.html]
|
|
314
|
+
[example/index.html][example.html].
|
|
265
315
|
|
|
266
316
|
## API Reference
|
|
267
317
|
|
|
@@ -277,11 +327,11 @@ If you want to convert a BBCode text into HTML using `bloops`,
|
|
|
277
327
|
first run `validate_bbcode`, then `compile_asy_diagrams`, and
|
|
278
328
|
finally `convert_bbcode_to_html` on the text.
|
|
279
329
|
|
|
280
|
-
Bloops also provides the
|
|
281
|
-
|
|
330
|
+
Bloops also provides the `BBCODE_TAGS` global constant
|
|
331
|
+
under the `vars` module.
|
|
282
332
|
|
|
283
333
|
A detailed documentation of these API endpoints can be found in
|
|
284
|
-
[docs/
|
|
334
|
+
[docs/api.md][api.md].
|
|
285
335
|
|
|
286
336
|
## FAQs
|
|
287
337
|
|
|
@@ -331,7 +381,7 @@ need JS for running simple static pages.
|
|
|
331
381
|
## Contribution
|
|
332
382
|
|
|
333
383
|
Contributions are very welcome!
|
|
334
|
-
Please read [CONTRIBUTING.md]
|
|
384
|
+
Please read [CONTRIBUTING.md][CONTRIBUTING.md] for a guide on
|
|
335
385
|
how to contribute. I'm against the idea of using AI
|
|
336
386
|
for writing hobby projects; however, I have no
|
|
337
387
|
problem if someone else uses them. If you're using AI assistance
|
|
@@ -346,11 +396,17 @@ how to implement it.
|
|
|
346
396
|
## TODOs
|
|
347
397
|
|
|
348
398
|
- [ ] Implement a post-processor which adds paragraph tags around
|
|
349
|
-
every disjoint block of HTML code.
|
|
350
|
-
- [ ]
|
|
351
|
-
- [ ] Handle `]` inside arguments of BBCode tags.
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
399
|
+
every disjoint block of HTML code.
|
|
400
|
+
- [ ] Shift avatar to integration server.
|
|
401
|
+
- [ ] Handle `[` or `]` inside arguments of BBCode tags.
|
|
402
|
+
(I'll be very glad if someone suggests me a solution for this;
|
|
403
|
+
I've thought about it myself, but couldn't really come up with
|
|
404
|
+
anything.)
|
|
405
|
+
- [ ] Switch lists to sets to optimize speed.
|
|
355
406
|
|
|
356
407
|
<p align="right"><a href="#index">↑ Back to top</a></p>
|
|
408
|
+
|
|
409
|
+
[content.bbcode]: https://github.com/Bubu-Droid/bloops/blob/main/example/content.bbcode
|
|
410
|
+
[example.html]: https://github.com/Bubu-Droid/bloops/blob/main/example/index.html
|
|
411
|
+
[api.md]: https://github.com/Bubu-Droid/bloops/blob/main/docs/api.md
|
|
412
|
+
[CONTRIBUTING.md]: https://github.com/Bubu-Droid/bloops/blob/main/CONTRIBUTING.md
|
|
@@ -1,27 +1,5 @@
|
|
|
1
|
-
Metadata-Version: 2.5
|
|
2
|
-
Name: bloops
|
|
3
|
-
Version: 0.1.4
|
|
4
|
-
Summary: An AoPS-like BBCode to HTML transpiler, with live-preview and support for Asymptote geometry diagrams.
|
|
5
|
-
Project-URL: Documentation, https://github.com/Bubu-Droid/bloops/blob/main/docs/API.md
|
|
6
|
-
Project-URL: Issues, https://github.com/Bubu-Droid/bloops/issues
|
|
7
|
-
Project-URL: Repository, https://github.com/Bubu-Droid/bloops
|
|
8
|
-
Author-email: Bubu-Droid <bubu@bubudroid.me>
|
|
9
|
-
License-Expression: MIT
|
|
10
|
-
License-File: LICENSE
|
|
11
|
-
Keywords: aops,asymptote,bbcode,converter,diagrams,geometry,html,latex,live-preview,markup,math,tex,transpiler
|
|
12
|
-
Classifier: Operating System :: OS Independent
|
|
13
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.15
|
|
18
|
-
Requires-Python: >=3.12
|
|
19
|
-
Requires-Dist: livereload>=2.7.1
|
|
20
|
-
Requires-Dist: watchdog>=6
|
|
21
|
-
Description-Content-Type: text/markdown
|
|
22
|
-
|
|
23
1
|
<div align="center">
|
|
24
|
-
<img src="https://raw.githubusercontent.com/Bubu-Droid/bloops/main/assets/banner.png"
|
|
2
|
+
<img src="https://raw.githubusercontent.com/Bubu-Droid/bloops/main/assets/banner.png" width="90%">
|
|
25
3
|
</div>
|
|
26
4
|
|
|
27
5
|
<hr>
|
|
@@ -34,11 +12,11 @@ and support for **Asymptote geometry diagrams**.
|
|
|
34
12
|
<a href="https://github.com/Bubu-Droid/bloops/releases/latest">
|
|
35
13
|
<img alt="PyPI Version" src="https://img.shields.io/pypi/v/bloops?label=PyPI&style=for-the-badge&logo=pypi&logoColor=c0caf5&labelColor=1a1b26&color=7aa2f7&v=1" />
|
|
36
14
|
</a>
|
|
37
|
-
<a href="https://github.com/Bubu-Droid/bloops/actions/workflows/prek.
|
|
38
|
-
<img alt="Prek CI Status" src="https://img.shields.io/github/actions/workflow/status/Bubu-Droid/bloops/prek.
|
|
15
|
+
<a href="https://github.com/Bubu-Droid/bloops/actions/workflows/prek.yml">
|
|
16
|
+
<img alt="Prek CI Status" src="https://img.shields.io/github/actions/workflow/status/Bubu-Droid/bloops/prek.yml?label=CI&style=for-the-badge&logo=githubactions&logoColor=c0caf5&labelColor=1a1b26&color=9ece6a" />
|
|
39
17
|
</a>
|
|
40
|
-
<a href="https://github.com/Bubu-Droid/bloops/actions/workflows/pytest.
|
|
41
|
-
<img alt="Unit Tests Status" src="https://img.shields.io/github/actions/workflow/status/Bubu-Droid/bloops/pytest.
|
|
18
|
+
<a href="https://github.com/Bubu-Droid/bloops/actions/workflows/pytest.yml">
|
|
19
|
+
<img alt="Unit Tests Status" src="https://img.shields.io/github/actions/workflow/status/Bubu-Droid/bloops/pytest.yml?label=Unit%20Tests&style=for-the-badge&logo=pytest&logoColor=c0caf5&labelColor=1a1b26&color=9ece6a" />
|
|
42
20
|
</a>
|
|
43
21
|
</div>
|
|
44
22
|
|
|
@@ -49,8 +27,8 @@ and support for **Asymptote geometry diagrams**.
|
|
|
49
27
|
<a href="https://github.com/Bubu-Droid/bloops/issues">
|
|
50
28
|
<img alt="GitHub Issues" src="https://img.shields.io/github/issues/Bubu-Droid/bloops?label=Issues&style=for-the-badge&logo=github&logoColor=c0caf5&labelColor=1a1b26&color=e0af68" />
|
|
51
29
|
</a>
|
|
52
|
-
<a href="https://github.com/Bubu-Droid/bloops/actions/workflows/codeql.
|
|
53
|
-
<img alt="CodeQL Status" src="https://img.shields.io/github/actions/workflow/status/Bubu-Droid/bloops/codeql.
|
|
30
|
+
<a href="https://github.com/Bubu-Droid/bloops/actions/workflows/codeql.yml">
|
|
31
|
+
<img alt="CodeQL Status" src="https://img.shields.io/github/actions/workflow/status/Bubu-Droid/bloops/codeql.yml?label=CodeQL&style=for-the-badge&logo=github&logoColor=c0caf5&labelColor=1a1b26&color=bb9af7" />
|
|
54
32
|
</a>
|
|
55
33
|
</div>
|
|
56
34
|
|
|
@@ -110,7 +88,11 @@ for vector diagram rendering
|
|
|
110
88
|
Install `bloops` from PyPI. Here is the
|
|
111
89
|
[PyPI listing](https://pypi.org/project/bloops/).
|
|
112
90
|
|
|
113
|
-
- I suggest using `uv`:
|
|
91
|
+
- I suggest using `uv`:
|
|
92
|
+
- Run `uv tool install bloops` if you'd like to use `bloops`
|
|
93
|
+
just as a CLI tool.
|
|
94
|
+
- Run `uv add bloops` if you you'd like to import `bloops`
|
|
95
|
+
as a package in your project.
|
|
114
96
|
- Or, if you want to use `pip`: run `pip install bloops`.
|
|
115
97
|
- AUR entry is yet to be added.
|
|
116
98
|
|
|
@@ -123,7 +105,7 @@ Install `bloops` from PyPI. Here is the
|
|
|
123
105
|
| Flag | Long Flag | Description |
|
|
124
106
|
| ---- | -------------- | ------------------------------------------------------------------------- |
|
|
125
107
|
| `-h` | `--help` | Show help message for usage of `bloops`. |
|
|
126
|
-
| `-
|
|
108
|
+
| `-V` | `--version` | Show the version of `bloops`. |
|
|
127
109
|
| `-c` | `--build-cont` | Watch `content.bbcode` for changes and continuously rebuild `index.html`. |
|
|
128
110
|
| `-p` | `--preview` | Launch a local web live-server to preview `index.html`. |
|
|
129
111
|
| `-i` | `--input` | (**Required**) Input directory containing `content.bbcode`. |
|
|
@@ -191,9 +173,9 @@ Here are reference tables for each BBCode tag bloops uses:
|
|
|
191
173
|
|
|
192
174
|
<details><summary>[color]</summary>
|
|
193
175
|
|
|
194
|
-
| Option
|
|
195
|
-
|
|
|
196
|
-
| `
|
|
176
|
+
| Option | Mandatory | Description |
|
|
177
|
+
| ------ | :-------: | ---------------------------------------- |
|
|
178
|
+
| `hex` | YES | Color code in hex (with the leading \#). |
|
|
197
179
|
|
|
198
180
|
</details>
|
|
199
181
|
|
|
@@ -241,6 +223,14 @@ Here are reference tables for each BBCode tag bloops uses:
|
|
|
241
223
|
|
|
242
224
|
</details>
|
|
243
225
|
|
|
226
|
+
<details><summary>[hide]</summary>
|
|
227
|
+
|
|
228
|
+
| Option | Mandatory | Description |
|
|
229
|
+
| ------- | :-------: | --------------------------------------------------- |
|
|
230
|
+
| `label` | YES | Label to be used as the summary for hidden details. |
|
|
231
|
+
|
|
232
|
+
</details>
|
|
233
|
+
|
|
244
234
|
<details><summary>math environments</summary>
|
|
245
235
|
|
|
246
236
|
Currently, the following math box tags are supported:
|
|
@@ -260,6 +250,11 @@ proof and solutions.
|
|
|
260
250
|
|
|
261
251
|
<details><summary>tags without any options</summary>
|
|
262
252
|
|
|
253
|
+
| Tag | Purpose |
|
|
254
|
+
| ---------------------------------- | ------------------------------------------------ |
|
|
255
|
+
| `[sidemark][/sidemark]` | To put a number in the subscript for a sidenote. |
|
|
256
|
+
| `[sidenote]<your-note>[/sidenote]` | To write a note to be put aside. |
|
|
257
|
+
|
|
263
258
|
| Tag | HTML Counterpart |
|
|
264
259
|
| ------- | ---------------- |
|
|
265
260
|
| `[b]` | `<strong>` |
|
|
@@ -281,9 +276,9 @@ proof and solutions.
|
|
|
281
276
|
<br>
|
|
282
277
|
|
|
283
278
|
An example showcasing the use of tags mentioned above has been
|
|
284
|
-
provided in [example/content.bbcode]
|
|
279
|
+
provided in [example/content.bbcode][content.bbcode]
|
|
285
280
|
and the corresponding generated HTML file is present in
|
|
286
|
-
[example/index.html]
|
|
281
|
+
[example/index.html][example.html].
|
|
287
282
|
|
|
288
283
|
## API Reference
|
|
289
284
|
|
|
@@ -299,11 +294,11 @@ If you want to convert a BBCode text into HTML using `bloops`,
|
|
|
299
294
|
first run `validate_bbcode`, then `compile_asy_diagrams`, and
|
|
300
295
|
finally `convert_bbcode_to_html` on the text.
|
|
301
296
|
|
|
302
|
-
Bloops also provides the
|
|
303
|
-
|
|
297
|
+
Bloops also provides the `BBCODE_TAGS` global constant
|
|
298
|
+
under the `vars` module.
|
|
304
299
|
|
|
305
300
|
A detailed documentation of these API endpoints can be found in
|
|
306
|
-
[docs/
|
|
301
|
+
[docs/api.md][api.md].
|
|
307
302
|
|
|
308
303
|
## FAQs
|
|
309
304
|
|
|
@@ -353,7 +348,7 @@ need JS for running simple static pages.
|
|
|
353
348
|
## Contribution
|
|
354
349
|
|
|
355
350
|
Contributions are very welcome!
|
|
356
|
-
Please read [CONTRIBUTING.md]
|
|
351
|
+
Please read [CONTRIBUTING.md][CONTRIBUTING.md] for a guide on
|
|
357
352
|
how to contribute. I'm against the idea of using AI
|
|
358
353
|
for writing hobby projects; however, I have no
|
|
359
354
|
problem if someone else uses them. If you're using AI assistance
|
|
@@ -368,11 +363,17 @@ how to implement it.
|
|
|
368
363
|
## TODOs
|
|
369
364
|
|
|
370
365
|
- [ ] Implement a post-processor which adds paragraph tags around
|
|
371
|
-
every disjoint block of HTML code.
|
|
372
|
-
- [ ]
|
|
373
|
-
- [ ] Handle `]` inside arguments of BBCode tags.
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
366
|
+
every disjoint block of HTML code.
|
|
367
|
+
- [ ] Shift avatar to integration server.
|
|
368
|
+
- [ ] Handle `[` or `]` inside arguments of BBCode tags.
|
|
369
|
+
(I'll be very glad if someone suggests me a solution for this;
|
|
370
|
+
I've thought about it myself, but couldn't really come up with
|
|
371
|
+
anything.)
|
|
372
|
+
- [ ] Switch lists to sets to optimize speed.
|
|
377
373
|
|
|
378
374
|
<p align="right"><a href="#index">↑ Back to top</a></p>
|
|
375
|
+
|
|
376
|
+
[content.bbcode]: https://github.com/Bubu-Droid/bloops/blob/main/example/content.bbcode
|
|
377
|
+
[example.html]: https://github.com/Bubu-Droid/bloops/blob/main/example/index.html
|
|
378
|
+
[api.md]: https://github.com/Bubu-Droid/bloops/blob/main/docs/api.md
|
|
379
|
+
[CONTRIBUTING.md]: https://github.com/Bubu-Droid/bloops/blob/main/CONTRIBUTING.md
|
|
@@ -14,11 +14,15 @@ with MathJax and Syntax Highlighting support.
|
|
|
14
14
|
|
|
15
15
|
Args:
|
|
16
16
|
text: Raw BBCode text content.
|
|
17
|
-
bbcode_tags:
|
|
17
|
+
bbcode_tags: Mapping of tag names to their opening pattern,
|
|
18
|
+
closing pattern and permitted arguments. See `BBCODE_TAGS`.
|
|
18
19
|
|
|
19
20
|
Returns:
|
|
20
21
|
A fully formatted HTML document string.
|
|
21
22
|
|
|
23
|
+
Raises:
|
|
24
|
+
SyntaxError: If a tag has no matching closing tag.
|
|
25
|
+
|
|
22
26
|
## `bracer.py`
|
|
23
27
|
|
|
24
28
|
### `gobble_inside_delim` (Function)
|
|
@@ -68,6 +72,16 @@ Raises:
|
|
|
68
72
|
matching closing tag cannot be found.
|
|
69
73
|
RuntimeError: If parser enters an unexpected state.
|
|
70
74
|
|
|
75
|
+
## `cli.py`
|
|
76
|
+
|
|
77
|
+
### `main` (Function)
|
|
78
|
+
|
|
79
|
+
Parse command-line arguments and run the build and preview process.
|
|
80
|
+
|
|
81
|
+
Reads input/output paths and continuous build or live preview flags
|
|
82
|
+
from CLI arguments, setting default fallback paths when necessary,
|
|
83
|
+
and invokes the build and preview pipeline.
|
|
84
|
+
|
|
71
85
|
## `validator.py`
|
|
72
86
|
|
|
73
87
|
### `validate_bbcode` (Function)
|
|
@@ -80,13 +94,14 @@ dictionary mapping each diagram label to its character index.
|
|
|
80
94
|
|
|
81
95
|
Args:
|
|
82
96
|
text: Raw BBCode input string.
|
|
83
|
-
bbcode_tags:
|
|
84
|
-
and permitted
|
|
97
|
+
bbcode_tags: Mapping of tag names to their opening pattern,
|
|
98
|
+
closing pattern and permitted arguments. See `BBCODE_TAGS`.
|
|
85
99
|
|
|
86
100
|
Returns:
|
|
87
101
|
A dictionary mapping diagram labels to their starting index.
|
|
88
102
|
|
|
89
103
|
Raises:
|
|
104
|
+
SyntaxError: If a tag has no matching closing tag.
|
|
90
105
|
ValueError: If an invalid argument is supplied or duplicate
|
|
91
106
|
diagram labels are encountered.
|
|
92
107
|
|
|
@@ -104,6 +119,10 @@ Args:
|
|
|
104
119
|
text: Entire input text containing BBCode and Asymptote code.
|
|
105
120
|
in_dir: Source directory containing the build cache folder.
|
|
106
121
|
out_dir: Target directory where compiled SVG images are stored.
|
|
122
|
+
bbcode_tags: Mapping of tag names to their opening pattern,
|
|
123
|
+
closing pattern and permitted arguments. See `BBCODE_TAGS`.
|
|
107
124
|
|
|
108
125
|
Raises:
|
|
126
|
+
FileNotFoundError: If `build/cache.json` does not exist in
|
|
127
|
+
`in_dir`, or the `asy` executable is not installed.
|
|
109
128
|
ValueError: If Asymptote compilation fails.
|
|
@@ -87,7 +87,9 @@ dot("$Y$", Y, NW, tnMagenta);
|
|
|
87
87
|
|
|
88
88
|
Here's a cute diagram from my
|
|
89
89
|
[url link="https://aops.com/community/c6h3106748p32782057"]IMO 2023 G4[/url]
|
|
90
|
-
solve.
|
|
90
|
+
solve.[sidemark][/sidemark]
|
|
91
|
+
|
|
92
|
+
[sidenote]One of my favorite problems ever. :)[/sidenote]
|
|
91
93
|
|
|
92
94
|
[asy src=static/mewtwo.svg label=mewtwo width=80 caption="cute diagram from IMO 2023 P2"]
|
|
93
95
|
import graph;
|
|
@@ -220,6 +222,8 @@ Prove that this process will eventually reach the number 1,
|
|
|
220
222
|
regardless of which positive integer is chosen initially.
|
|
221
223
|
[/lemma]
|
|
222
224
|
|
|
225
|
+
[hide label="The proof is hidden inside this block."]
|
|
223
226
|
[proof]
|
|
224
227
|
[s]Left as an exercise to the reader[/s] Skipped, too easy.
|
|
225
228
|
[/proof]
|
|
229
|
+
[/hide]
|
|
@@ -9,24 +9,25 @@
|
|
|
9
9
|
type="image/x-icon"
|
|
10
10
|
href="https://avatar.artofproblemsolving.com/avatar_778606.png"
|
|
11
11
|
/>
|
|
12
|
-
<link rel="stylesheet" href="static/style.css" />
|
|
13
|
-
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
14
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
15
|
-
<link
|
|
16
|
-
href="https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400..700;1,400..700&display=swap"
|
|
17
|
-
rel="stylesheet"
|
|
18
|
-
/>
|
|
19
|
-
<link
|
|
20
|
-
href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap"
|
|
21
|
-
rel="stylesheet"
|
|
22
|
-
/>
|
|
23
12
|
<link
|
|
24
|
-
href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap"
|
|
25
13
|
rel="stylesheet"
|
|
14
|
+
href="https://cdn.jsdelivr.net/npm/@catppuccin/highlightjs@1.0.1/css/catppuccin-variables.css"
|
|
26
15
|
/>
|
|
16
|
+
<link rel="stylesheet" href="static/style.css" />
|
|
17
|
+
<script>
|
|
18
|
+
try {
|
|
19
|
+
document.documentElement.dataset.theme =
|
|
20
|
+
localStorage.getItem("theme") ||
|
|
21
|
+
(matchMedia("(prefers-color-scheme: dark)").matches
|
|
22
|
+
? "night"
|
|
23
|
+
: "day");
|
|
24
|
+
} catch {}
|
|
25
|
+
</script>
|
|
26
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
27
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
27
28
|
<link
|
|
29
|
+
href="https://fonts.googleapis.com/css2?family=Literata:ital,opsz,wght@0,7..72,200..900;1,7..72,200..900&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap"
|
|
28
30
|
rel="stylesheet"
|
|
29
|
-
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.12.0/styles/tokyo-night-dark.min.css"
|
|
30
31
|
/>
|
|
31
32
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.12.0/highlight.min.js"></script>
|
|
32
33
|
<script>
|
|
@@ -55,16 +56,13 @@
|
|
|
55
56
|
defer
|
|
56
57
|
src="https://cdn.jsdelivr.net/npm/mathjax@4/tex-svg.js"
|
|
57
58
|
></script>
|
|
59
|
+
<script src="static/script.js" defer></script>
|
|
58
60
|
</head>
|
|
59
61
|
<body>
|
|
60
62
|
<h1>Page Heading</h1>
|
|
61
63
|
|
|
62
64
|
Here is a <span style="color: #9ece6a">code</span> block:
|
|
63
|
-
<pre>
|
|
64
|
-
<code class="language-python">
|
|
65
|
-
print("hello world!")
|
|
66
|
-
</code>
|
|
67
|
-
</pre>
|
|
65
|
+
<pre><code class="language-python">print("hello world!")</code></pre>
|
|
68
66
|
|
|
69
67
|
Here's an <strong>Asymptote</strong> diagram:
|
|
70
68
|
<figure>
|
|
@@ -76,7 +74,9 @@ print("hello world!")
|
|
|
76
74
|
<a href="https://aops.com/community/c6h3106748p32782057" target="_blank"
|
|
77
75
|
>IMO 2023 G4</a
|
|
78
76
|
>
|
|
79
|
-
solve
|
|
77
|
+
solve.<span class="sidemark"></span>
|
|
78
|
+
|
|
79
|
+
<span class="sidenote">One of my favorite problems ever. :)</span>
|
|
80
80
|
|
|
81
81
|
<figure>
|
|
82
82
|
<img src="static/mewtwo.svg" style="width: 80%; height: auto" />
|
|
@@ -128,12 +128,15 @@ print("hello world!")
|
|
|
128
128
|
which positive integer is chosen initially.
|
|
129
129
|
</div>
|
|
130
130
|
|
|
131
|
-
<
|
|
132
|
-
<
|
|
133
|
-
<
|
|
134
|
-
class="
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
131
|
+
<details>
|
|
132
|
+
<summary>The proof is hidden inside this block.</summary>
|
|
133
|
+
<div>
|
|
134
|
+
<i class="proof">Proof.</i>
|
|
135
|
+
<s>Left as an exercise to the reader</s> Skipped, too easy.<span
|
|
136
|
+
class="qed"
|
|
137
|
+
>□</span
|
|
138
|
+
>
|
|
139
|
+
</div>
|
|
140
|
+
</details>
|
|
138
141
|
</body>
|
|
139
142
|
</html>
|
|
@@ -26,22 +26,33 @@ license-files = [ "LICEN[CS]E*" ]
|
|
|
26
26
|
authors = [ { name = "Bubu-Droid", email = "bubu@bubudroid.me" } ]
|
|
27
27
|
requires-python = ">=3.12"
|
|
28
28
|
classifiers = [
|
|
29
|
+
"Development Status :: 3 - Alpha",
|
|
30
|
+
"Environment :: Console",
|
|
31
|
+
"Intended Audience :: Developers",
|
|
32
|
+
"Intended Audience :: Education",
|
|
33
|
+
"Natural Language :: English",
|
|
29
34
|
"Operating System :: OS Independent",
|
|
30
35
|
"Programming Language :: Python :: 3 :: Only",
|
|
31
36
|
"Programming Language :: Python :: 3.12",
|
|
32
37
|
"Programming Language :: Python :: 3.13",
|
|
33
38
|
"Programming Language :: Python :: 3.14",
|
|
34
39
|
"Programming Language :: Python :: 3.15",
|
|
40
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
41
|
+
"Topic :: Education",
|
|
42
|
+
"Topic :: Scientific/Engineering :: Mathematics",
|
|
43
|
+
"Topic :: Text Processing :: Markup",
|
|
44
|
+
"Topic :: Text Processing :: Markup :: HTML",
|
|
45
|
+
"Typing :: Typed",
|
|
35
46
|
]
|
|
36
47
|
dynamic = [ "version" ]
|
|
37
48
|
dependencies = [
|
|
38
49
|
"livereload>=2.7.1",
|
|
39
50
|
"watchdog>=6",
|
|
40
51
|
]
|
|
41
|
-
urls.Documentation = "https://github.com/Bubu-Droid/bloops/blob/main/docs/
|
|
52
|
+
urls.Documentation = "https://github.com/Bubu-Droid/bloops/blob/main/docs/api.md"
|
|
42
53
|
urls.Issues = "https://github.com/Bubu-Droid/bloops/issues"
|
|
43
54
|
urls.Repository = "https://github.com/Bubu-Droid/bloops"
|
|
44
|
-
scripts.bloops = "bloops.
|
|
55
|
+
scripts.bloops = "bloops.cli:main"
|
|
45
56
|
|
|
46
57
|
[dependency-groups]
|
|
47
58
|
dev = [
|
|
@@ -52,12 +63,18 @@ dev = [
|
|
|
52
63
|
[tool.hatch]
|
|
53
64
|
version.path = "src/bloops/__about__.py"
|
|
54
65
|
build.targets.wheel.packages = [ "src/bloops" ]
|
|
66
|
+
build.targets.sdist.include = [ "/src", "/tests", "/docs", "/example" ]
|
|
55
67
|
|
|
56
68
|
[tool.ruff]
|
|
57
69
|
line-length = 80
|
|
58
|
-
lint.extend-select = [ "ANN" ]
|
|
70
|
+
lint.extend-select = [ "ANN", "D", "DOC" ]
|
|
71
|
+
lint.per-file-ignores.".github/**" = [ "D", "DOC" ]
|
|
72
|
+
lint.per-file-ignores."tests/**" = [ "D", "DOC" ]
|
|
59
73
|
lint.unfixable = [ "F401" ]
|
|
60
74
|
|
|
75
|
+
[tool.ruff.lint.pydocstyle]
|
|
76
|
+
convention = "google"
|
|
77
|
+
|
|
61
78
|
[tool.basedpyright]
|
|
62
79
|
executionEnvironments = [
|
|
63
80
|
{ root = "tests", reportPrivateUsage = false },
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"""An AoPS-like BBCode to HTML transpiler with Asymptote diagram support.
|
|
2
|
+
|
|
3
|
+
Use `bloops.validator.validate_bbcode` and
|
|
4
|
+
`bloops.validator.compile_asy_diagrams` to check a document and render its
|
|
5
|
+
diagrams, then `bloops.bloopser.convert_bbcode_to_html` to produce the HTML.
|
|
6
|
+
"""
|