bloops 0.0.2__tar.gz → 0.2.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.
- {bloops-0.0.2 → bloops-0.2.0}/.gitignore +0 -1
- {bloops-0.0.2 → bloops-0.2.0}/PKG-INFO +49 -27
- {bloops-0.0.2 → bloops-0.2.0}/README.md +47 -25
- {bloops-0.0.2 → bloops-0.2.0}/example/content.bbcode +5 -1
- {bloops-0.0.2 → bloops-0.2.0}/example/index.html +29 -26
- {bloops-0.0.2 → bloops-0.2.0}/pyproject.toml +3 -2
- {bloops-0.0.2 → bloops-0.2.0}/src/bloops/__about__.py +1 -1
- bloops-0.2.0/src/bloops/__main__.py +4 -0
- {bloops-0.0.2 → bloops-0.2.0}/src/bloops/_build_and_preview.py +19 -13
- {bloops-0.0.2 → bloops-0.2.0}/src/bloops/bloopser.py +35 -75
- bloops-0.0.2/src/bloops/__main__.py → bloops-0.2.0/src/bloops/cli.py +1 -7
- bloops-0.0.2/src/bloops/vars.py → bloops-0.2.0/src/bloops/static/error_template.html +31 -395
- bloops-0.2.0/src/bloops/static/index.html +64 -0
- bloops-0.2.0/src/bloops/static/script.js +32 -0
- bloops-0.2.0/src/bloops/static/style.css +315 -0
- {bloops-0.0.2 → bloops-0.2.0}/src/bloops/validator.py +28 -15
- bloops-0.2.0/src/bloops/vars.py +109 -0
- {bloops-0.0.2 → bloops-0.2.0}/tests/test_asy_generatation.py +3 -4
- {bloops-0.0.2 → bloops-0.2.0}/tests/test_asy_tag.py +11 -12
- {bloops-0.0.2 → bloops-0.2.0}/tests/test_bloopser.py +5 -6
- {bloops-0.0.2 → bloops-0.2.0}/tests/test_bracer.py +7 -8
- {bloops-0.0.2 → bloops-0.2.0}/tests/test_img_tag.py +11 -12
- {bloops-0.0.2 → bloops-0.2.0}/tests/test_list_tag.py +11 -12
- {bloops-0.0.2 → bloops-0.2.0}/tests/test_math_boxes.py +33 -34
- {bloops-0.0.2 → bloops-0.2.0}/tests/test_remaining_tags.py +12 -44
- {bloops-0.0.2 → bloops-0.2.0}/tests/test_simple_tags.py +16 -17
- {bloops-0.0.2 → bloops-0.2.0}/tests/test_transpile.py +21 -22
- {bloops-0.0.2 → bloops-0.2.0}/tests/test_validator.py +12 -12
- bloops-0.0.2/.github/dependabot.yaml +0 -26
- bloops-0.0.2/.github/scripts/update-api-docs.py +0 -60
- bloops-0.0.2/.github/scripts/update-example.py +0 -19
- bloops-0.0.2/.github/workflows/codeql.yaml +0 -96
- bloops-0.0.2/.github/workflows/lint-pr.yaml +0 -20
- bloops-0.0.2/.github/workflows/prek.yaml +0 -24
- bloops-0.0.2/.github/workflows/pytest.yaml +0 -30
- bloops-0.0.2/.github/workflows/release.yaml +0 -30
- bloops-0.0.2/.github/workflows/update-api-docs.yaml +0 -31
- bloops-0.0.2/.github/workflows/update-example.yaml +0 -40
- bloops-0.0.2/.pre-commit-config.yaml +0 -92
- bloops-0.0.2/.python-version +0 -1
- bloops-0.0.2/.yamllint.yaml +0 -3
- bloops-0.0.2/CONTRIBUTING.md +0 -58
- bloops-0.0.2/assets/banner.png +0 -0
- bloops-0.0.2/prek.toml +0 -114
- bloops-0.0.2/rumdl.toml +0 -19
- bloops-0.0.2/tombi.toml +0 -2
- bloops-0.0.2/uv.lock +0 -159
- bloops-0.0.2/yamlfmt.yaml +0 -4
- {bloops-0.0.2 → bloops-0.2.0}/LICENSE +0 -0
- /bloops-0.0.2/docs/API.md → /bloops-0.2.0/docs/api.md +0 -0
- {bloops-0.0.2 → bloops-0.2.0}/src/bloops/__init__.py +0 -0
- {bloops-0.0.2 → bloops-0.2.0}/src/bloops/_helper.py +0 -0
- {bloops-0.0.2 → bloops-0.2.0}/src/bloops/bracer.py +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: bloops
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.2.0
|
|
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/
|
|
5
|
+
Project-URL: Documentation, https://github.com/Bubu-Droid/bloops/blob/main/docs/api.md
|
|
6
6
|
Project-URL: Issues, https://github.com/Bubu-Droid/bloops/issues
|
|
7
7
|
Project-URL: Repository, https://github.com/Bubu-Droid/bloops
|
|
8
8
|
Author-email: Bubu-Droid <bubu@bubudroid.me>
|
|
@@ -21,7 +21,7 @@ Requires-Dist: watchdog>=6
|
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
|
|
23
23
|
<div align="center">
|
|
24
|
-
<img src="assets/banner.png" style="width: 90%; height: auto;">
|
|
24
|
+
<img src="https://raw.githubusercontent.com/Bubu-Droid/bloops/main/assets/banner.png" style="width: 90%; height: auto;">
|
|
25
25
|
</div>
|
|
26
26
|
|
|
27
27
|
<hr>
|
|
@@ -30,31 +30,31 @@ Bloops is an AoPS-like **BBCode to HTML transpiler**
|
|
|
30
30
|
written in Python, with **live-preview**
|
|
31
31
|
and support for **Asymptote geometry diagrams**.
|
|
32
32
|
|
|
33
|
-
<div align="center">
|
|
33
|
+
<div align="center" style="height: 28px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; margin: 6px 0;">
|
|
34
34
|
<a href="https://github.com/Bubu-Droid/bloops/releases/latest">
|
|
35
|
-
<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" />
|
|
35
|
+
<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
36
|
</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.
|
|
37
|
+
<a href="https://github.com/Bubu-Droid/bloops/actions/workflows/prek.yml">
|
|
38
|
+
<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
39
|
</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.
|
|
40
|
+
<a href="https://github.com/Bubu-Droid/bloops/actions/workflows/pytest.yml">
|
|
41
|
+
<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
42
|
</a>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
|
-
<div align="center">
|
|
45
|
+
<div align="center" style="height: 28px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; margin: 6px 0;">
|
|
46
46
|
<a href="https://pypi.org/project/bloops/">
|
|
47
|
-
<img alt="PyPI Python Version" src="https://img.shields.io/pypi/pyversions/bloops?style=for-the-badge&logo=python&logoColor=c0caf5&labelColor=1a1b26&color=7aa2f7" />
|
|
47
|
+
<img alt="PyPI Python Version" src="https://img.shields.io/pypi/pyversions/bloops?style=for-the-badge&logo=python&logoColor=c0caf5&labelColor=1a1b26&color=7aa2f7&v=1" />
|
|
48
48
|
</a>
|
|
49
49
|
<a href="https://github.com/Bubu-Droid/bloops/issues">
|
|
50
50
|
<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
51
|
</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.
|
|
52
|
+
<a href="https://github.com/Bubu-Droid/bloops/actions/workflows/codeql.yml">
|
|
53
|
+
<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
54
|
</a>
|
|
55
55
|
</div>
|
|
56
56
|
|
|
57
|
-
<div align="center">
|
|
57
|
+
<div align="center" style="height: 28px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; margin: 6px 0;">
|
|
58
58
|
<a href="https://github.com/Bubu-Droid/bloops/blob/main/LICENSE">
|
|
59
59
|
<img alt="License" src="https://img.shields.io/github/license/Bubu-Droid/bloops?label=License&style=for-the-badge&labelColor=1a1b26&color=7dcfff" />
|
|
60
60
|
</a>
|
|
@@ -110,7 +110,11 @@ for vector diagram rendering
|
|
|
110
110
|
Install `bloops` from PyPI. Here is the
|
|
111
111
|
[PyPI listing](https://pypi.org/project/bloops/).
|
|
112
112
|
|
|
113
|
-
- I suggest using `uv`:
|
|
113
|
+
- I suggest using `uv`:
|
|
114
|
+
- Run `uv tool install bloops` if you'd like to use `bloops`
|
|
115
|
+
just as a CLI tool.
|
|
116
|
+
- Run `uv add bloops` if you you'd like to import `bloops`
|
|
117
|
+
as a package in your project.
|
|
114
118
|
- Or, if you want to use `pip`: run `pip install bloops`.
|
|
115
119
|
- AUR entry is yet to be added.
|
|
116
120
|
|
|
@@ -241,6 +245,14 @@ Here are reference tables for each BBCode tag bloops uses:
|
|
|
241
245
|
|
|
242
246
|
</details>
|
|
243
247
|
|
|
248
|
+
<details><summary>[hide]</summary>
|
|
249
|
+
|
|
250
|
+
| Option | Mandatory | Description |
|
|
251
|
+
| ------- | :-------: | --------------------------------------------------- |
|
|
252
|
+
| `label` | YES | Label to be used as the summary for hidden details. |
|
|
253
|
+
|
|
254
|
+
</details>
|
|
255
|
+
|
|
244
256
|
<details><summary>math environments</summary>
|
|
245
257
|
|
|
246
258
|
Currently, the following math box tags are supported:
|
|
@@ -260,6 +272,11 @@ proof and solutions.
|
|
|
260
272
|
|
|
261
273
|
<details><summary>tags without any options</summary>
|
|
262
274
|
|
|
275
|
+
| Tag | Purpose |
|
|
276
|
+
| ---------------------------------- | ------------------------------------------------ |
|
|
277
|
+
| `[sidemark][/sidemark]` | To put a number in the subscript for a sidenote. |
|
|
278
|
+
| `[sidenote]<your-note>[/sidenote]` | To write a note to be put aside. |
|
|
279
|
+
|
|
263
280
|
| Tag | HTML Counterpart |
|
|
264
281
|
| ------- | ---------------- |
|
|
265
282
|
| `[b]` | `<strong>` |
|
|
@@ -281,9 +298,9 @@ proof and solutions.
|
|
|
281
298
|
<br>
|
|
282
299
|
|
|
283
300
|
An example showcasing the use of tags mentioned above has been
|
|
284
|
-
provided in [example/content.bbcode]
|
|
301
|
+
provided in [example/content.bbcode][content.bbcode]
|
|
285
302
|
and the corresponding generated HTML file is present in
|
|
286
|
-
[example/index.html]
|
|
303
|
+
[example/index.html][example.html].
|
|
287
304
|
|
|
288
305
|
## API Reference
|
|
289
306
|
|
|
@@ -299,11 +316,11 @@ If you want to convert a BBCode text into HTML using `bloops`,
|
|
|
299
316
|
first run `validate_bbcode`, then `compile_asy_diagrams`, and
|
|
300
317
|
finally `convert_bbcode_to_html` on the text.
|
|
301
318
|
|
|
302
|
-
Bloops also provides the
|
|
303
|
-
|
|
319
|
+
Bloops also provides the `BBCODE_TAGS` global constant
|
|
320
|
+
under the `vars` module.
|
|
304
321
|
|
|
305
322
|
A detailed documentation of these API endpoints can be found in
|
|
306
|
-
[docs/
|
|
323
|
+
[docs/api.md][api.md].
|
|
307
324
|
|
|
308
325
|
## FAQs
|
|
309
326
|
|
|
@@ -353,7 +370,7 @@ need JS for running simple static pages.
|
|
|
353
370
|
## Contribution
|
|
354
371
|
|
|
355
372
|
Contributions are very welcome!
|
|
356
|
-
Please read [CONTRIBUTING.md]
|
|
373
|
+
Please read [CONTRIBUTING.md][CONTRIBUTING.md] for a guide on
|
|
357
374
|
how to contribute. I'm against the idea of using AI
|
|
358
375
|
for writing hobby projects; however, I have no
|
|
359
376
|
problem if someone else uses them. If you're using AI assistance
|
|
@@ -368,11 +385,16 @@ how to implement it.
|
|
|
368
385
|
## TODOs
|
|
369
386
|
|
|
370
387
|
- [ ] 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
|
-
|
|
388
|
+
every disjoint block of HTML code.
|
|
389
|
+
- [ ] Shift avatar to integration server.
|
|
390
|
+
- [ ] Handle `[` or `]` inside arguments of BBCode tags.
|
|
391
|
+
(I'll be very glad if someone suggests me a solution for this;
|
|
392
|
+
I've thought about it myself, but couldn't really come up with
|
|
393
|
+
anything.)
|
|
377
394
|
|
|
378
395
|
<p align="right"><a href="#index">↑ Back to top</a></p>
|
|
396
|
+
|
|
397
|
+
[content.bbcode]: https://github.com/Bubu-Droid/bloops/blob/main/example/content.bbcode
|
|
398
|
+
[example.html]: https://github.com/Bubu-Droid/bloops/blob/main/example/index.html
|
|
399
|
+
[api.md]: https://github.com/Bubu-Droid/bloops/blob/main/docs/api.md
|
|
400
|
+
[CONTRIBUTING.md]: https://github.com/Bubu-Droid/bloops/blob/main/CONTRIBUTING.md
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img src="assets/banner.png" style="width: 90%; height: auto;">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/Bubu-Droid/bloops/main/assets/banner.png" style="width: 90%; height: auto;">
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
5
|
<hr>
|
|
@@ -8,31 +8,31 @@ Bloops is an AoPS-like **BBCode to HTML transpiler**
|
|
|
8
8
|
written in Python, with **live-preview**
|
|
9
9
|
and support for **Asymptote geometry diagrams**.
|
|
10
10
|
|
|
11
|
-
<div align="center">
|
|
11
|
+
<div align="center" style="height: 28px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; margin: 6px 0;">
|
|
12
12
|
<a href="https://github.com/Bubu-Droid/bloops/releases/latest">
|
|
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" />
|
|
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" />
|
|
14
14
|
</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.
|
|
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" />
|
|
17
17
|
</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.
|
|
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" />
|
|
20
20
|
</a>
|
|
21
21
|
</div>
|
|
22
22
|
|
|
23
|
-
<div align="center">
|
|
23
|
+
<div align="center" style="height: 28px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; margin: 6px 0;">
|
|
24
24
|
<a href="https://pypi.org/project/bloops/">
|
|
25
|
-
<img alt="PyPI Python Version" src="https://img.shields.io/pypi/pyversions/bloops?style=for-the-badge&logo=python&logoColor=c0caf5&labelColor=1a1b26&color=7aa2f7" />
|
|
25
|
+
<img alt="PyPI Python Version" src="https://img.shields.io/pypi/pyversions/bloops?style=for-the-badge&logo=python&logoColor=c0caf5&labelColor=1a1b26&color=7aa2f7&v=1" />
|
|
26
26
|
</a>
|
|
27
27
|
<a href="https://github.com/Bubu-Droid/bloops/issues">
|
|
28
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" />
|
|
29
29
|
</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.
|
|
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" />
|
|
32
32
|
</a>
|
|
33
33
|
</div>
|
|
34
34
|
|
|
35
|
-
<div align="center">
|
|
35
|
+
<div align="center" style="height: 28px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; margin: 6px 0;">
|
|
36
36
|
<a href="https://github.com/Bubu-Droid/bloops/blob/main/LICENSE">
|
|
37
37
|
<img alt="License" src="https://img.shields.io/github/license/Bubu-Droid/bloops?label=License&style=for-the-badge&labelColor=1a1b26&color=7dcfff" />
|
|
38
38
|
</a>
|
|
@@ -88,7 +88,11 @@ for vector diagram rendering
|
|
|
88
88
|
Install `bloops` from PyPI. Here is the
|
|
89
89
|
[PyPI listing](https://pypi.org/project/bloops/).
|
|
90
90
|
|
|
91
|
-
- 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.
|
|
92
96
|
- Or, if you want to use `pip`: run `pip install bloops`.
|
|
93
97
|
- AUR entry is yet to be added.
|
|
94
98
|
|
|
@@ -219,6 +223,14 @@ Here are reference tables for each BBCode tag bloops uses:
|
|
|
219
223
|
|
|
220
224
|
</details>
|
|
221
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
|
+
|
|
222
234
|
<details><summary>math environments</summary>
|
|
223
235
|
|
|
224
236
|
Currently, the following math box tags are supported:
|
|
@@ -238,6 +250,11 @@ proof and solutions.
|
|
|
238
250
|
|
|
239
251
|
<details><summary>tags without any options</summary>
|
|
240
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
|
+
|
|
241
258
|
| Tag | HTML Counterpart |
|
|
242
259
|
| ------- | ---------------- |
|
|
243
260
|
| `[b]` | `<strong>` |
|
|
@@ -259,9 +276,9 @@ proof and solutions.
|
|
|
259
276
|
<br>
|
|
260
277
|
|
|
261
278
|
An example showcasing the use of tags mentioned above has been
|
|
262
|
-
provided in [example/content.bbcode]
|
|
279
|
+
provided in [example/content.bbcode][content.bbcode]
|
|
263
280
|
and the corresponding generated HTML file is present in
|
|
264
|
-
[example/index.html]
|
|
281
|
+
[example/index.html][example.html].
|
|
265
282
|
|
|
266
283
|
## API Reference
|
|
267
284
|
|
|
@@ -277,11 +294,11 @@ If you want to convert a BBCode text into HTML using `bloops`,
|
|
|
277
294
|
first run `validate_bbcode`, then `compile_asy_diagrams`, and
|
|
278
295
|
finally `convert_bbcode_to_html` on the text.
|
|
279
296
|
|
|
280
|
-
Bloops also provides the
|
|
281
|
-
|
|
297
|
+
Bloops also provides the `BBCODE_TAGS` global constant
|
|
298
|
+
under the `vars` module.
|
|
282
299
|
|
|
283
300
|
A detailed documentation of these API endpoints can be found in
|
|
284
|
-
[docs/
|
|
301
|
+
[docs/api.md][api.md].
|
|
285
302
|
|
|
286
303
|
## FAQs
|
|
287
304
|
|
|
@@ -331,7 +348,7 @@ need JS for running simple static pages.
|
|
|
331
348
|
## Contribution
|
|
332
349
|
|
|
333
350
|
Contributions are very welcome!
|
|
334
|
-
Please read [CONTRIBUTING.md]
|
|
351
|
+
Please read [CONTRIBUTING.md][CONTRIBUTING.md] for a guide on
|
|
335
352
|
how to contribute. I'm against the idea of using AI
|
|
336
353
|
for writing hobby projects; however, I have no
|
|
337
354
|
problem if someone else uses them. If you're using AI assistance
|
|
@@ -346,11 +363,16 @@ how to implement it.
|
|
|
346
363
|
## TODOs
|
|
347
364
|
|
|
348
365
|
- [ ] 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
|
-
|
|
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.)
|
|
355
372
|
|
|
356
373
|
<p align="right"><a href="#index">↑ Back to top</a></p>
|
|
374
|
+
|
|
375
|
+
[content.bbcode]: https://github.com/Bubu-Droid/bloops/blob/main/example/content.bbcode
|
|
376
|
+
[example.html]: https://github.com/Bubu-Droid/bloops/blob/main/example/index.html
|
|
377
|
+
[api.md]: https://github.com/Bubu-Droid/bloops/blob/main/docs/api.md
|
|
378
|
+
[CONTRIBUTING.md]: https://github.com/Bubu-Droid/bloops/blob/main/CONTRIBUTING.md
|
|
@@ -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>
|
|
@@ -38,10 +38,10 @@ dependencies = [
|
|
|
38
38
|
"livereload>=2.7.1",
|
|
39
39
|
"watchdog>=6",
|
|
40
40
|
]
|
|
41
|
-
urls.Documentation = "https://github.com/Bubu-Droid/bloops/blob/main/docs/
|
|
41
|
+
urls.Documentation = "https://github.com/Bubu-Droid/bloops/blob/main/docs/api.md"
|
|
42
42
|
urls.Issues = "https://github.com/Bubu-Droid/bloops/issues"
|
|
43
43
|
urls.Repository = "https://github.com/Bubu-Droid/bloops"
|
|
44
|
-
scripts.bloops = "bloops.
|
|
44
|
+
scripts.bloops = "bloops.cli:main"
|
|
45
45
|
|
|
46
46
|
[dependency-groups]
|
|
47
47
|
dev = [
|
|
@@ -52,6 +52,7 @@ dev = [
|
|
|
52
52
|
[tool.hatch]
|
|
53
53
|
version.path = "src/bloops/__about__.py"
|
|
54
54
|
build.targets.wheel.packages = [ "src/bloops" ]
|
|
55
|
+
build.targets.sdist.include = [ "/src", "/tests", "/docs", "/example" ]
|
|
55
56
|
|
|
56
57
|
[tool.ruff]
|
|
57
58
|
line-length = 80
|
|
@@ -8,6 +8,7 @@ server.
|
|
|
8
8
|
import pathlib
|
|
9
9
|
import threading
|
|
10
10
|
import time
|
|
11
|
+
from importlib.resources import files
|
|
11
12
|
from typing import override
|
|
12
13
|
|
|
13
14
|
from livereload import Server # pyright: ignore[reportMissingTypeStubs]
|
|
@@ -20,7 +21,12 @@ from watchdog.observers import Observer
|
|
|
20
21
|
|
|
21
22
|
from bloops.bloopser import convert_bbcode_to_html
|
|
22
23
|
from bloops.validator import compile_asy_diagrams, validate_bbcode
|
|
23
|
-
|
|
24
|
+
|
|
25
|
+
_static = files("bloops") / "static"
|
|
26
|
+
|
|
27
|
+
ERROR_TEMPLATE = (_static / "error_template.html").read_text(encoding="utf-8")
|
|
28
|
+
STYLESHEET = (_static / "style.css").read_text(encoding="utf-8")
|
|
29
|
+
SCRIPT = (_static / "script.js").read_text(encoding="utf-8")
|
|
24
30
|
|
|
25
31
|
|
|
26
32
|
class _Handler(PatternMatchingEventHandler):
|
|
@@ -72,8 +78,7 @@ class _Handler(PatternMatchingEventHandler):
|
|
|
72
78
|
event: File system event describing the modification.
|
|
73
79
|
"""
|
|
74
80
|
|
|
75
|
-
|
|
76
|
-
new_content = f.read().strip()
|
|
81
|
+
new_content = self.input_file.read_text(encoding="utf-8").strip()
|
|
77
82
|
if self.file_content == new_content:
|
|
78
83
|
return
|
|
79
84
|
print("---------- File change detected ----------")
|
|
@@ -105,11 +110,11 @@ class _Handler(PatternMatchingEventHandler):
|
|
|
105
110
|
)
|
|
106
111
|
|
|
107
112
|
print("Converting BBCode into HTML...")
|
|
108
|
-
|
|
109
|
-
|
|
113
|
+
_ = self.output_file.write_text(
|
|
114
|
+
convert_bbcode_to_html(self.file_content), encoding="utf-8"
|
|
115
|
+
)
|
|
110
116
|
except Exception:
|
|
111
|
-
|
|
112
|
-
_ = f.write(ERROR_TEMPLATE)
|
|
117
|
+
_ = self.output_file.write_text(ERROR_TEMPLATE, encoding="utf-8")
|
|
113
118
|
# HACK: the liveserver plugin takes short time span before
|
|
114
119
|
# it can reflect the updates.
|
|
115
120
|
# if we raise the exception immediately, then the program
|
|
@@ -147,6 +152,8 @@ def main(
|
|
|
147
152
|
output_file = in_dir / "index.html"
|
|
148
153
|
style_file = in_dir / "static" / "style.css"
|
|
149
154
|
style_file.parent.mkdir(parents=True, exist_ok=True)
|
|
155
|
+
script_file = in_dir / "static" / "script.js"
|
|
156
|
+
script_file.parent.mkdir(parents=True, exist_ok=True)
|
|
150
157
|
build_dir = in_dir / "build/"
|
|
151
158
|
build_dir.mkdir(parents=True, exist_ok=True)
|
|
152
159
|
asy_cache_file = build_dir / "cache.json"
|
|
@@ -161,13 +168,12 @@ def main(
|
|
|
161
168
|
out_dir.mkdir(parents=True, exist_ok=True)
|
|
162
169
|
if not out_dir.is_dir():
|
|
163
170
|
raise NotADirectoryError(f"{out_dir} is not a directory.")
|
|
164
|
-
|
|
165
|
-
file_content = f.read().strip()
|
|
171
|
+
file_content = input_file.read_text(encoding="utf-8").strip()
|
|
166
172
|
if not style_file.exists():
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
173
|
+
_ = style_file.write_text(STYLESHEET, encoding="utf-8")
|
|
174
|
+
if not script_file.exists():
|
|
175
|
+
_ = script_file.write_text(SCRIPT, encoding="utf-8")
|
|
176
|
+
_ = asy_cache_file.write_text("{}", encoding="utf-8")
|
|
171
177
|
|
|
172
178
|
handler = _Handler(in_dir, out_dir, file_content)
|
|
173
179
|
|