weavon 0.1.0__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- weavon/LICENSE-APACHE +202 -0
- weavon/LICENSE-MIT +21 -0
- weavon/THIRD_PARTY_NOTICES.md +82 -0
- weavon/__init__.py +162 -0
- weavon/_errors.py +33 -0
- weavon/_ffi.py +449 -0
- weavon/ast.py +807 -0
- weavon/compat.py +246 -0
- weavon/py.typed +0 -0
- weavon/weavon_c.dll +0 -0
- weavon-0.1.0.dist-info/METADATA +188 -0
- weavon-0.1.0.dist-info/RECORD +17 -0
- weavon-0.1.0.dist-info/WHEEL +5 -0
- weavon-0.1.0.dist-info/licenses/LICENSE-APACHE +202 -0
- weavon-0.1.0.dist-info/licenses/LICENSE-MIT +21 -0
- weavon-0.1.0.dist-info/licenses/THIRD_PARTY_NOTICES.md +82 -0
- weavon-0.1.0.dist-info/top_level.txt +1 -0
weavon/LICENSE-APACHE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
weavon/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 The Weavon contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
Weavon is an independent implementation of the behaviour of Pandoc. Pandoc is
|
|
4
|
+
licensed under GPL-2.0-or-later. Weavon contains no Pandoc source code and no
|
|
5
|
+
Pandoc test files.
|
|
6
|
+
|
|
7
|
+
This file lists each file or design that comes from a different project,
|
|
8
|
+
with its licence and its attribution. The full licence texts are in
|
|
9
|
+
`third_party/licences/`. The rule for reuse and the list of candidates are
|
|
10
|
+
in [`docs/PRIOR_ART.md`](docs/PRIOR_ART.md); the reason for each choice is
|
|
11
|
+
in [`docs/ADR.md`](docs/ADR.md). The name of this file was `THIRD_PARTY.md`
|
|
12
|
+
until 2026-11-10.
|
|
13
|
+
|
|
14
|
+
| Material | Source | Licence | Where | Licence text |
|
|
15
|
+
| --- | --- | --- | --- | --- |
|
|
16
|
+
| Document model (type names and JSON form) | `pandoc-types` 1.23.1.2 | BSD-3-Clause | `crates/weavon-ast` | [`third_party/licences/pandoc-types.txt`](third_party/licences/pandoc-types.txt) |
|
|
17
|
+
| Layout engine, width rules and character width table | `doclayout` 0.6 (https://github.com/jgm/doclayout) | BSD-3-Clause | `crates/weavon-layout/src` | [`third_party/licences/doclayout.txt`](third_party/licences/doclayout.txt) |
|
|
18
|
+
| First code points of the base emoji (from the Unicode emoji data) | `emojis` 0.1.5, `baseEmojis` (https://github.com/jgm/emojis) | BSD-3-Clause | `crates/weavon-layout/src/tables.rs` | [`third_party/licences/emojis.txt`](third_party/licences/emojis.txt) |
|
|
19
|
+
| Layout rules of the native writer (the `valToDoc` layout and the `sep`, `hang` and ribbon rules). Reimplemented from a description and from the output of the oracle. No code is copied. | `pretty-show` 1.10, `pretty` 1.1.3 | MIT, BSD-3-Clause | `crates/weavon-native/src/pretty.rs` | Not applicable: no code and no data is copied |
|
|
20
|
+
| Digit generation of `show` for `Double` (`floatToDigits`, ported from `GHC.Internal.Float`), and the `show` forms of `Double` (`formatRealFloat`) and of `Char` and `String` (`showLitChar`) | GHC 9.12.2 (tag `ghc-9.12.2-release`), library `base` 4.21 with `ghc-internal` 9.1202 | BSD-3-Clause | `crates/weavon-ast/src/json/haskell.rs` | [`third_party/licences/GHC-base.txt`](third_party/licences/GHC-base.txt) |
|
|
21
|
+
| JSON error texts and error paths | `aeson` 2.2: the texts were observed with the oracle. No `aeson` code is ported. | BSD-3-Clause | `crates/weavon-ast/src/json/` | none: no code or text is copied |
|
|
22
|
+
| General categories L and N (tables generated from `UnicodeData.txt`) | Unicode Character Database 15.1.0 | Unicode License v3 | `crates/weavon-ast/src/json/categories.rs`, `crates/weavon-templates/src/categories.rs` | [`third_party/licences/Unicode.txt`](third_party/licences/Unicode.txt) |
|
|
23
|
+
| DocBook XML entity mappings | [W3C combined XML entity set](https://www.w3.org/2003/entities/2007/w3centities-f.ent), Copyright 1998-2011 W3C | W3C permissive derivative-work grant | `crates/weavon-xmlformats/src/entities.rs` | [W3C entity set notice](third_party/licences/w3centities-f.txt), [`weavon-xmlformats` notice](crates/weavon-xmlformats/NOTICE.md) |
|
|
24
|
+
| Typst symbol and emoji mappings (2,457 entries) | `typst/codex` v0.1.1 | Apache-2.0 | `crates/weavon-typst/src/reader/symbols.rs` | [Upstream licence](https://github.com/typst/codex/blob/v0.1.1/LICENSE), [local licence](third_party/licences/typst-codex.txt), [`weavon-typst` notice](crates/weavon-typst/NOTICE.md) |
|
|
25
|
+
| HTML entity table (`ENTITIES`) | `commonmark` 0.3.1 (`src/Commonmark/Entity.hs` of `commonmark-hs` commit e67a048), which comes from TagSoup | BSD-3-Clause | `crates/weavon-core/src/shared/tables.rs` | [`third_party/licences/commonmark-hs.txt`](third_party/licences/commonmark-hs.txt), [`third_party/licences/tagsoup.txt`](third_party/licences/tagsoup.txt) |
|
|
26
|
+
| ASCII table of CommonMark identifiers (`COMMONMARK_ASCII`) | `commonmark-extensions` 0.2.7.3 (`AutoIdentifiers.hs` `asciiMap`, `commonmark-hs` commit e67a048) | BSD-3-Clause | `crates/weavon-core/src/shared/tables.rs` | [`third_party/licences/commonmark-hs.txt`](third_party/licences/commonmark-hs.txt) |
|
|
27
|
+
| Emoji alias tables (`EMOJI_BY_ALIAS`, `ALIAS_BY_EMOJI`) | `emojis` 0.1.5 (`src/Text/emojis.inc`, commit 880b6a2), data from GitHub `gemoji` | BSD-3-Clause (package), MIT (gemoji data) | `crates/weavon-core/src/shared/tables.rs` | [`third_party/licences/emojis.txt`](third_party/licences/emojis.txt), [`third_party/licences/gemoji.txt`](third_party/licences/gemoji.txt) |
|
|
28
|
+
| Character classes and ASCII forms (`CLASSES`, `PANDOC_ASCII`) | Unicode Character Database 15.1.0 (`UnicodeData.txt`) and the canonical decompositions of Unicode 16.0.0 (Python `unicodedata`) | Unicode-3.0 | `crates/weavon-core/src/shared/tables.rs` | [`third_party/licences/Unicode.txt`](third_party/licences/Unicode.txt) |
|
|
29
|
+
| NFC tables (`COMBINING_CLASSES`, `DECOMPOSITIONS`, `COMPOSITIONS`, `UNSAFE`) | Unicode Character Database 18.0.0 (`UnicodeData.txt`, `CompositionExclusions.txt`) | Unicode-3.0 | `crates/weavon-core/src/shared/nfc_tables.rs` | [`third_party/licences/Unicode.txt`](third_party/licences/Unicode.txt) |
|
|
30
|
+
| Template language: parser, renderer, pipes and tests | `doctemplates` 0.11.1 (https://github.com/jgm/doctemplates) | BSD-3-Clause | `crates/weavon-templates` | [`third_party/licences/doctemplates.txt`](third_party/licences/doctemplates.txt) |
|
|
31
|
+
| Error semantics and error text of the parser combinators | `parsec` 3.1.17.0 (https://github.com/haskell/parsec) | BSD-2-Clause | `crates/weavon-templates/src/parsec.rs`, `src/parser.rs` | [`third_party/licences/parsec.txt`](third_party/licences/parsec.txt) |
|
|
32
|
+
| Default templates and partials (62 files from `data/templates`; `COPYRIGHT` gives the BSD-3-Clause option; copyright notice in `crates/weavon-data/data/templates/LICENSE`) | Pandoc 3.13 `data/templates` | BSD-3-Clause | `crates/weavon-data/data/templates` | [`third_party/licences/pandoc-templates.txt`](third_party/licences/pandoc-templates.txt) |
|
|
33
|
+
| dzslides template (JavaScript and CSS of Paul Rouget) | Pandoc 3.13 `data/dzslides/template.html`; https://github.com/paulrouget/dzslides | WTFPL | `crates/weavon-data/data/dzslides` | [`third_party/licences/dzslides.txt`](third_party/licences/dzslides.txt) |
|
|
34
|
+
| CSL processor: types, style parser, locale parser, primary dialect table, locale merge, reference model, CSL JSON markup, evaluation, output, case transformation, document evaluation, sort keys, disambiguation, collapse, subsequent author substitute, abbreviations | `citeproc` 0.14.1.1 (https://hackage.haskell.org/package/citeproc-0.14.1.1) | BSD-2-Clause | `crates/weavon-citeproc/src` | [`third_party/licences/citeproc.txt`](third_party/licences/citeproc.txt) |
|
|
35
|
+
| Unicode Collation Algorithm and NFD normalization for citation sorting (code only; no tailoring and no CJK data) | `unicode-collation` 0.1.3.7 `src/Text/Collate/Collation.hs`, `Collator.hs`, `Normalize.hs`, `Trie.hs` | BSD-2-Clause | `crates/weavon-citeproc/src/collate/mod.rs` | [`third_party/licences/unicode-collation.txt`](third_party/licences/unicode-collation.txt) |
|
|
36
|
+
| Collation table, canonical decompositions and combining classes (generated by `crates/weavon-citeproc/tools/collation_tables.py`) | Unicode Collation Algorithm `allkeys.txt` 13.0.0 and Unicode Character Database 13.0.0 (`UnicodeData.txt`) | Unicode License v3 | `crates/weavon-citeproc/src/collate/ducet.bin` | [`third_party/licences/Unicode.txt`](third_party/licences/Unicode.txt) |
|
|
37
|
+
| BCP 47 language tag parser and renderer (code only, no data file) | `unicode-collation` 0.1.3.7 `src/Text/Collate/Lang.hs` | BSD-2-Clause | `crates/weavon-citeproc/src/lang.rs` | [`third_party/licences/unicode-collation.txt`](third_party/licences/unicode-collation.txt) |
|
|
38
|
+
| XML reader (dependency) | `quick-xml` 0.42.0 | MIT | `crates/weavon-archive`, `crates/weavon-citeproc` | [`third_party/licences/quick-xml.txt`](third_party/licences/quick-xml.txt) |
|
|
39
|
+
| General categories for the CSL JSON markup, name particles and case transformation (generated by `crates/weavon-citeproc/tools/unicode_classes.py` from Python `unicodedata`) | Unicode Character Database 16.0.0 | Unicode-3.0 | `crates/weavon-citeproc/src/unicode_class.rs` | [`third_party/licences/Unicode.txt`](third_party/licences/Unicode.txt) |
|
|
40
|
+
| Full Unicode case folding of reference keys and raw format names (generated from Unicode `CaseFolding.txt` / Python `unicodedata`) | Unicode Character Database 16.0.0 | Unicode-3.0 | `crates/weavon-citeproc/src/case_fold.rs`, `crates/weavon-ast/src/case_fold.rs` | [`third_party/licences/Unicode.txt`](third_party/licences/Unicode.txt) |
|
|
41
|
+
| Candidate command names for the oracle probes (`katex-names.txt`: the names only, 1,013 names). The tables of `weavon-math` hold results of the oracle for these names. No KaTeX code and no KaTeX symbol data is copied. | KaTeX 0.16.11 (`dist/katex.js` of the npm package, SHA-256 `e0cf1ac3508a85a439800821de03c9b77d1bedbdfb47dc70738dc417ea1b5cbe`; https://github.com/KaTeX/KaTeX) | MIT | `crates/weavon-math/tools/katex-names.txt`, command names in `crates/weavon-math/src/symbols.rs` | [`third_party/licences/KaTeX.txt`](third_party/licences/KaTeX.txt) |
|
|
42
|
+
| Lua 5.4.8 sources, unchanged (59 files) | `lua-5.4.8.tar.gz` of lua.org | MIT | `crates/weavon-lua/lua-5.4.8` | [`third_party/licences/lua.txt`](third_party/licences/lua.txt) |
|
|
43
|
+
| LPeg 1.1.0 sources and `re.lua`, unchanged (14 files) | `lpeg-1.1.0.tar.gz` of the LPeg page of PUC-Rio | MIT | `crates/weavon-lua/lpeg-1.1.0` | [`third_party/licences/lpeg.txt`](third_party/licences/lpeg.txt) |
|
|
44
|
+
| Lua document types, list functions and object index functions (ported); the GPL files `Walk.hs`, `SpliceList.hs` and `Topdown.hs` are not used (ADR 16) | `pandoc-lua-marshal` 0.3.2.1, `hslua-objectorientation` 2.5.0, `hslua-marshalling` 2.3.2, `hslua-core` 2.3.2.1, `hslua-list` 1.1.4 | MIT | `crates/weavon-lua/src` | [`third_party/licences/hslua.txt`](third_party/licences/hslua.txt) |
|
|
45
|
+
| Lua binding (dependency, not copied) | `mlua` 0.12.2, `mlua-sys` 0.13.0 | MIT | `crates/weavon-lua` | [`third_party/licences/mlua.txt`](third_party/licences/mlua.txt) |
|
|
46
|
+
| ZIP reader and writer (dependency, not copied; ADR 9) | `zip` 9.5.0 | MIT | `crates/weavon-archive`, `crates/weavon-harness` | [`third_party/licences/zip.txt`](third_party/licences/zip.txt) |
|
|
47
|
+
| Deflate front end of `zip` (dependency, not copied) | `flate2` 1.1.11 | MIT OR Apache-2.0 | through `zip` and `weavon-embed` | [`third_party/licences/flate2.txt`](third_party/licences/flate2.txt) |
|
|
48
|
+
| Deflate implementation of `flate2` (dependency, not copied) | `zlib-rs` 0.6.8 | Zlib | through `zip` and `weavon-embed` | [`third_party/licences/zlib-rs.txt`](third_party/licences/zlib-rs.txt) |
|
|
49
|
+
| Serialization and JSON (dependencies) | `serde` 1.0.229, `serde_json` 1.0.154 | MIT OR Apache-2.0 | `weavon-cli`, `weavon-highlight`, `weavon-ipynb`, `weavon-server`, `weavon-harness`, and `weavon-docx` (`serde_json`) | [`serde` and `serde_json` licence](third_party/licences/serde.txt) |
|
|
50
|
+
| Unix file system calls (dependency) | `nix` 0.31.3 | MIT | `weavon-core` on Unix | [`nix` licence](third_party/licences/nix.txt) |
|
|
51
|
+
| Small-string storage for AST `Text` (dependency, not copied; ADR 35) | `compact_str` 0.10.0 | MIT | `crates/weavon-ast` | [`third_party/licences/compact_str.txt`](third_party/licences/compact_str.txt) |
|
|
52
|
+
| Other Rust dependencies linked by the program | [`Cargo.lock`](Cargo.lock) | MIT, MIT OR Apache-2.0, Zlib, Unlicense OR MIT, CC0-1.0 OR MIT-0 OR Apache-2.0 | The `weavon` program | `THIRD_PARTY_LICENSES.html` in each release archive. The [release workflow](.github/workflows/release.yml) generates it with `cargo-about`. |
|
|
53
|
+
| The merge of inline lists and the table normalization of `Text.Pandoc.Builder` (ported) | `pandoc-types` 1.23.1 (Hackage) | BSD-3-Clause | `crates/weavon-lua/src/utils.rs`, `crates/weavon-lua/src/normalize.rs` | [`third_party/licences/pandoc-types.txt`](third_party/licences/pandoc-types.txt) |
|
|
54
|
+
| Lua modules `pandoc.path` and `pandoc.text` (ported) | `hslua-module-path` 1.2.0, `hslua-module-text` 1.2.0 | MIT | `crates/weavon-lua/src/path.rs`, `crates/weavon-lua/src/text.rs` | [`third_party/licences/hslua-modules.txt`](third_party/licences/hslua-modules.txt) |
|
|
55
|
+
| Lua module `pandoc.system`: argument rules, function names, `xdg` name rule and `with_environment` steps (ported) | `hslua-module-system` 1.3.0 | MIT | `crates/weavon-lua/src/system.rs`, `crates/weavon-lua/src/os.rs` | [`third_party/licences/hslua-modules.txt`](third_party/licences/hslua-modules.txt) |
|
|
56
|
+
| The POSIX path rules of `System.FilePath` (ported) | `filepath` 1.5.4.0 | BSD-3-Clause | `crates/weavon-lua/src/path.rs` | [`third_party/licences/filepath.txt`](third_party/licences/filepath.txt) |
|
|
57
|
+
| HTML tokenizer and renderer in `weavon-tagsoup` (state machine, attribute and character reference rules, `canonicalizeTags`) | `tagsoup` 0.14.8 (https://hackage.haskell.org/package/tagsoup-0.14.8; `src/Text/HTML/TagSoup/Specification.hs`, `Implementation.hs`, `Render.hs`, `TagSoup.hs`) | BSD-3-Clause | `crates/weavon-tagsoup/src/tokens.rs` | [`third_party/licences/tagsoup.txt`](third_party/licences/tagsoup.txt); [`weavon-tagsoup` notice](crates/weavon-tagsoup/NOTICE.md) |
|
|
58
|
+
| Join rules of an inline list and grid rules of a table (`Text.Pandoc.Builder`: the `Inlines` monoid, `placeRowSection`, `clipRows`) | `pandoc-types` 1.23.1 | BSD-3-Clause | `crates/weavon-html-reader/src/text.rs`, `src/table.rs` | [`third_party/licences/pandoc-types.txt`](third_party/licences/pandoc-types.txt) |
|
|
59
|
+
| Join rules of an inline list (`Text.Pandoc.Builder`: the `Inlines` monoid) | `pandoc-types` 1.23.1 | BSD-3-Clause | `crates/weavon-latex-reader/src/inlines.rs` | [`third_party/licences/pandoc-types.txt`](third_party/licences/pandoc-types.txt); also in `crates/weavon-latex-reader/NOTICE.md` |
|
|
60
|
+
| CommonMark syntax rules, extension syntax and the conversion to the Pandoc tree (ported design) | `commonmark`, `commonmark-extensions`, `commonmark-pandoc` (https://github.com/jgm/commonmark-hs) | BSD-3-Clause | `crates/weavon-commonmark` | [`third_party/licences/commonmark-hs.txt`](third_party/licences/commonmark-hs.txt) |
|
|
61
|
+
| Structure of the block parser and the inline parser (line-by-line block parser, delimiter and bracket stacks) | `commonmark.js` (https://github.com/commonmark/commonmark.js) | BSD-2-Clause | `crates/weavon-commonmark/src/blocks.rs`, `inlines.rs` | [`third_party/licences/commonmark-js.txt`](third_party/licences/commonmark-js.txt) |
|
|
62
|
+
| Example inputs of the `regression.md` file and of the `commonmark-extensions` test files (inputs only; the expected results come from the oracle). The cases of the test files `autolinks.md`, `pipe_tables.md`, `footnotes.md` and `alerts.md` are not used, because their text comes from the GFM specification and the GitHub documentation. | `commonmark-hs` `regression.md`, `commonmark-extensions/test/*.md` | BSD-3-Clause | `conformance/cases/commonmark` | [`third_party/licences/commonmark-hs.txt`](third_party/licences/commonmark-hs.txt) |
|
|
63
|
+
| Ported rules: delimiter run matching (`processEmphasis`, `processEm`, `delimsMatch`), the path rule of `rebase_relative_paths` (`rebasePath`, `isURI`), the footnote finalizer, the start of a definition, the block of attribute lines (`attributeSpec`, `addNodeToStack`, `renderChildren`), the single quote after a bracket pair (`fixSingleQuote`), the table row rules (`pCells`, `pipeTableBlockSpec`) | `commonmark` 0.3.1, `commonmark-extensions` 0.2.7.3, `commonmark-pandoc` 0.3.0.2 (Hackage release archives) | BSD-3-Clause | `crates/weavon-commonmark/src/inlines.rs`, `rebase.rs`, `blocks.rs`, `convert.rs` | [`third_party/licences/commonmark-hs.txt`](third_party/licences/commonmark-hs.txt) |
|
|
64
|
+
| More ported rules: the blank line rules of `listItemSpec` and `listSpec`, `linkPath`, the item start and blank line rules of `taskListItemBlockSpec`, `pEscaped` and the link destination, title and label scanners, the absolute bottom of `processBs` | `commonmark` 0.3.1, `commonmark-extensions` 0.2.7.3 (Hackage release archives) | BSD-3-Clause | `crates/weavon-commonmark/src/blocks.rs`, `inlines.rs`, `scan.rs` | [`third_party/licences/commonmark-hs.txt`](third_party/licences/commonmark-hs.txt) |
|
|
65
|
+
| URI scheme list (`SCHEMES`, generated by `tools/commonmark-cases/schemes.py`) | `commonmark-extensions` 0.2.7.3 (`src/Commonmark/Extensions/RebaseRelativePaths.hs`, value `schemes`) | BSD-3-Clause | `crates/weavon-core/src/shared/schemes.rs`, `crates/weavon-commonmark/src/schemes.rs` | [`third_party/licences/commonmark-hs.txt`](third_party/licences/commonmark-hs.txt) |
|
|
66
|
+
| General categories Mn, Mc and Me (ranges generated by `tools/commonmark-cases/marks.py`) | Unicode Character Database 16.0.0 (Python module `unicodedata`) | Unicode-3.0 | `crates/weavon-commonmark/src/marks.rs` | [`third_party/licences/Unicode.txt`](third_party/licences/Unicode.txt) |
|
|
67
|
+
| Syntax highlighter: regular expression engine, definition parser, tokenizer, the 8 highlight styles, HTML and LaTeX formatters | `skylighting-core` 0.15, `skylighting-format-blaze-html` 0.1.2.2, `skylighting-format-latex` 0.1 (https://github.com/jgm/skylighting) | BSD-3-Clause | `crates/weavon-highlight/src` | [`third_party/licences/skylighting-core.txt`](third_party/licences/skylighting-core.txt) |
|
|
68
|
+
| 63 KDE syntax definitions with a permissive licence (62 languages plus the shared Alerts helper) | `skylighting-core` 0.15 (Hackage), directory `xml/`, from the KDE syntax-highlighting project | MIT, BSD-3-Clause, NCSA, WTFPL (per file) | `crates/weavon-highlight/data/syntax-definitions.txt` | [`third_party/licences/syntax-definitions.txt`](third_party/licences/syntax-definitions.txt) |
|
|
69
|
+
| Adobe Symbol encoding mapping table (`adobe_symbol_to_unicode`) | Unicode Consortium Public Mapping Table (`MAPPINGS/VENDORS/ADOBE/symbol.txt`) | Unicode-3.0 | `crates/weavon-docx/src/symbol.rs` | [`third_party/licences/Unicode.txt`](third_party/licences/Unicode.txt), [`weavon-docx` notice](crates/weavon-docx/NOTICE.md) |
|
|
70
|
+
| Clean-room syntax definitions (132 languages; 194/194 Pandoc 3.13 languages with the 62 permissive KDE language definitions plus Alerts) | Weavon contributors. Public language references and black-box Pandoc output. No KDE or skylighting XML file is a source. | MIT OR Apache-2.0 | `crates/weavon-highlight/clean_defs/` | Not applicable. See [ADR 25](docs/ADR.md#adr-25-clean-room-highlighting-definitions-in-rust). |
|
|
71
|
+
| Document labels and LaTeX language aliases | Weavon contributors. Caption conventions and language names from Babel and Polyglossia documentation. | MIT OR Apache-2.0 | `crates/weavon-data/data/terms.tsv`, `crates/weavon-data/data/babel_aliases.tsv` | [`weavon-data` notice](crates/weavon-data/NOTICE.md#document-labels-and-language-aliases) |
|
|
72
|
+
| Built-in CSL locale tables and Weavon Author-Date style | Weavon contributors. CSL 1.0.2 specification, linguistic knowledge, bibliographic conventions, and black-box Pandoc output. | MIT OR Apache-2.0 | `crates/weavon-data/data/csl/` | [`weavon-data` notice](crates/weavon-data/NOTICE.md#citation-data) |
|
|
73
|
+
| MediaWiki syntax-highlight language names (`mediawiki-highlight-languages.txt`: 542 accepted language names observed from black-box Pandoc 3.13 output; candidate names come from `pandoc --list-highlight-languages`, a fixed seed list, and optionally Pygments lexer alias names only; no Pygments code is copied) | Weavon contributors (oracle output); optional candidate names from Pygments (BSD-2-Clause) | MIT OR Apache-2.0 | `crates/weavon-wiki/src/mediawiki-highlight-languages.txt`, `crates/weavon-wiki/tools/probe_mediawiki_languages.py` | Not applicable: names observed from oracle output |
|
|
74
|
+
|
|
75
|
+
Add a row when a workstream adds material from a different project. Put the
|
|
76
|
+
full upstream licence file, with its copyright notice and disclaimer, in
|
|
77
|
+
`third_party/licences/` and link it in the last column. A licence name alone
|
|
78
|
+
is not sufficient for ported code. A crate that holds such material also
|
|
79
|
+
carries the notice in its own folder (`crates/NAME/NOTICE.md`), because a
|
|
80
|
+
source package of one crate does not include `third_party/`. Check the
|
|
81
|
+
licence of each file first. Record a file that the Weavon licence does not
|
|
82
|
+
permit as a gap in `spec/not-applicable.json` or `docs/ISSUES.md`.
|
weavon/__init__.py
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"""Weavon for Python. It converts documents in the process, with no subprocess.
|
|
2
|
+
|
|
3
|
+
The functions of this module use one shared ``WeavonClient``. Make a
|
|
4
|
+
``WeavonClient`` to load the library from a specific path.
|
|
5
|
+
|
|
6
|
+
import weavon
|
|
7
|
+
|
|
8
|
+
html = weavon.convert("# Hello", "html", "markdown")
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
from typing import Any, Dict, List, Optional, Union
|
|
14
|
+
|
|
15
|
+
from . import ast, compat
|
|
16
|
+
from ._ffi import (
|
|
17
|
+
CompatMode,
|
|
18
|
+
WeavonClient,
|
|
19
|
+
WeavonConvertError,
|
|
20
|
+
WeavonError,
|
|
21
|
+
WeavonInvalidArgError,
|
|
22
|
+
WeavonLibraryNotFoundError,
|
|
23
|
+
WeavonPanicError,
|
|
24
|
+
WeavonUtf8Error,
|
|
25
|
+
Source,
|
|
26
|
+
default_client,
|
|
27
|
+
)
|
|
28
|
+
from .ast import Attr, Block, Document, Inline, MetaValue, Node, Target, stringify, walk
|
|
29
|
+
|
|
30
|
+
__all__ = [
|
|
31
|
+
"Attr",
|
|
32
|
+
"Block",
|
|
33
|
+
"CompatMode",
|
|
34
|
+
"Document",
|
|
35
|
+
"Inline",
|
|
36
|
+
"MetaValue",
|
|
37
|
+
"Node",
|
|
38
|
+
"WeavonClient",
|
|
39
|
+
"WeavonConvertError",
|
|
40
|
+
"WeavonError",
|
|
41
|
+
"WeavonInvalidArgError",
|
|
42
|
+
"WeavonLibraryNotFoundError",
|
|
43
|
+
"WeavonPanicError",
|
|
44
|
+
"WeavonUtf8Error",
|
|
45
|
+
"Target",
|
|
46
|
+
"ast",
|
|
47
|
+
"chunk",
|
|
48
|
+
"compat",
|
|
49
|
+
"convert",
|
|
50
|
+
"convert_bytes",
|
|
51
|
+
"default_client",
|
|
52
|
+
"diff",
|
|
53
|
+
"lint",
|
|
54
|
+
"parse",
|
|
55
|
+
"render",
|
|
56
|
+
"render_bytes",
|
|
57
|
+
"stringify",
|
|
58
|
+
"version",
|
|
59
|
+
"walk",
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def version() -> str:
|
|
64
|
+
"""Returns the Weavon version, for example ``"0.1.0"``."""
|
|
65
|
+
return default_client().version()
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def convert(
|
|
69
|
+
source: Source,
|
|
70
|
+
to_format: str,
|
|
71
|
+
from_format: Optional[str] = None,
|
|
72
|
+
*,
|
|
73
|
+
mode: CompatMode = CompatMode.NATIVE,
|
|
74
|
+
main_content: bool = False,
|
|
75
|
+
clean: bool = False,
|
|
76
|
+
base_url: Optional[str] = None,
|
|
77
|
+
) -> str:
|
|
78
|
+
"""Converts a document and returns the output text. See ``WeavonClient.convert``."""
|
|
79
|
+
return default_client().convert(
|
|
80
|
+
source, to_format, from_format,
|
|
81
|
+
mode=mode, main_content=main_content, clean=clean, base_url=base_url,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def convert_bytes(
|
|
86
|
+
source: Source,
|
|
87
|
+
to_format: str,
|
|
88
|
+
from_format: Optional[str] = None,
|
|
89
|
+
*,
|
|
90
|
+
mode: CompatMode = CompatMode.NATIVE,
|
|
91
|
+
main_content: bool = False,
|
|
92
|
+
clean: bool = False,
|
|
93
|
+
base_url: Optional[str] = None,
|
|
94
|
+
) -> bytes:
|
|
95
|
+
"""Converts a document and returns the output bytes. See ``WeavonClient.convert_bytes``."""
|
|
96
|
+
return default_client().convert_bytes(
|
|
97
|
+
source, to_format, from_format,
|
|
98
|
+
mode=mode, main_content=main_content, clean=clean, base_url=base_url,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def diff(
|
|
103
|
+
old: Source,
|
|
104
|
+
new: Source,
|
|
105
|
+
to_format: str = "criticmarkup",
|
|
106
|
+
*,
|
|
107
|
+
old_format: Optional[str] = None,
|
|
108
|
+
new_format: Optional[str] = None,
|
|
109
|
+
author: Optional[str] = None,
|
|
110
|
+
) -> Union[str, bytes]:
|
|
111
|
+
"""Compares two documents. See ``WeavonClient.diff``."""
|
|
112
|
+
return default_client().diff(
|
|
113
|
+
old, new, to_format, old_format=old_format, new_format=new_format, author=author
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def chunk(
|
|
118
|
+
source: Source,
|
|
119
|
+
from_format: Optional[str] = None,
|
|
120
|
+
*,
|
|
121
|
+
max_tokens: int = 512,
|
|
122
|
+
overlap_tokens: int = 64,
|
|
123
|
+
main_content: bool = False,
|
|
124
|
+
clean: bool = False,
|
|
125
|
+
) -> List[Dict[str, Any]]:
|
|
126
|
+
"""Splits a document into chunks for retrieval. See ``WeavonClient.chunk``."""
|
|
127
|
+
return default_client().chunk(
|
|
128
|
+
source, from_format,
|
|
129
|
+
max_tokens=max_tokens, overlap_tokens=overlap_tokens,
|
|
130
|
+
main_content=main_content, clean=clean,
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def lint(source: Source, from_format: Optional[str] = None, *, format: str = "json") -> Any:
|
|
135
|
+
"""Checks a document. See ``WeavonClient.lint``."""
|
|
136
|
+
return default_client().lint(source, from_format, format=format)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def parse(
|
|
140
|
+
source: Source,
|
|
141
|
+
from_format: Optional[str] = None,
|
|
142
|
+
*,
|
|
143
|
+
mode: CompatMode = CompatMode.NATIVE,
|
|
144
|
+
main_content: bool = False,
|
|
145
|
+
clean: bool = False,
|
|
146
|
+
base_url: Optional[str] = None,
|
|
147
|
+
) -> Document:
|
|
148
|
+
"""Reads a document into a typed ``Document``. See ``WeavonClient.parse``."""
|
|
149
|
+
return default_client().parse(
|
|
150
|
+
source, from_format,
|
|
151
|
+
mode=mode, main_content=main_content, clean=clean, base_url=base_url,
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def render(doc: Document, to_format: str, *, mode: CompatMode = CompatMode.NATIVE) -> str:
|
|
156
|
+
"""Writes a ``Document`` and returns the output text. See ``WeavonClient.render``."""
|
|
157
|
+
return default_client().render(doc, to_format, mode=mode)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def render_bytes(doc: Document, to_format: str, *, mode: CompatMode = CompatMode.NATIVE) -> bytes:
|
|
161
|
+
"""Writes a ``Document`` and returns the output bytes. See ``WeavonClient.render_bytes``."""
|
|
162
|
+
return default_client().render_bytes(doc, to_format, mode=mode)
|
weavon/_errors.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""The exceptions of Weavon. Each error that Weavon raises is a ``WeavonError``."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Optional
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class WeavonError(Exception):
|
|
9
|
+
"""An error of Weavon. ``status`` is the status code of the C ABI."""
|
|
10
|
+
|
|
11
|
+
def __init__(self, message: str, status: Optional[int] = None) -> None:
|
|
12
|
+
super().__init__(message)
|
|
13
|
+
self.status = status
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class WeavonInvalidArgError(WeavonError):
|
|
17
|
+
"""An argument is not valid (``WEAVON_ERR_INVALID_ARG``)."""
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class WeavonConvertError(WeavonError):
|
|
21
|
+
"""The conversion failed (``WEAVON_ERR_CONVERT``)."""
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class WeavonPanicError(WeavonError):
|
|
25
|
+
"""Weavon stopped on an internal error (``WEAVON_ERR_PANIC``)."""
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class WeavonUtf8Error(WeavonError):
|
|
29
|
+
"""A string argument or a text input is not valid UTF-8 (``WEAVON_ERR_UTF8``)."""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class WeavonLibraryNotFoundError(WeavonError):
|
|
33
|
+
"""The ``libweavon_c`` shared library is not available."""
|