wikitextparser 0.55.13__tar.gz → 0.56.2__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.
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/.github/workflows/tests.yml +1 -1
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/CHANGELOG.rst +16 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/PKG-INFO +3 -3
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/README.rst +1 -1
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/pyproject.toml +1 -1
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/__init__.py +1 -1
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_wikitext.py +12 -14
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/.coveragerc +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/.gitignore +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/.readthedocs.yaml +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/LICENSE.md +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/docs/CHANGELOG.rst +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/docs/Makefile +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/docs/README.rst +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/docs/conf.py +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/docs/index.rst +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/docs/make.bat +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_argument.py +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_cell.py +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_comment_bold_italic.py +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_config.py +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_externallink.py +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_parameter.py +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_parser_function.py +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_section.py +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_spans.py +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_table.py +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_tag.py +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_template.py +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_wikilink.py +0 -0
- {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_wikilist.py +0 -0
|
@@ -13,7 +13,7 @@ jobs:
|
|
|
13
13
|
strategy:
|
|
14
14
|
matrix:
|
|
15
15
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
16
|
-
python-version: ["3.
|
|
16
|
+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
|
|
17
17
|
env:
|
|
18
18
|
OS: ${{ matrix.os }}
|
|
19
19
|
PYTHON: ${{ matrix.python-version }}
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
v0.56.2
|
|
2
|
+
-------
|
|
3
|
+
* Fixed a bug in ``external_links`` property where ``|`` was recognized as part of the link by mistake. (#139)
|
|
4
|
+
|
|
5
|
+
v0.56.1
|
|
6
|
+
-------
|
|
7
|
+
* Fixed a bug in ``get_sections`` when ``top_levels_only`` was ``True``.
|
|
8
|
+
|
|
9
|
+
v0.56.0
|
|
10
|
+
-------
|
|
11
|
+
* Drop Python 3.7 support.
|
|
12
|
+
|
|
13
|
+
v0.55.14
|
|
14
|
+
--------
|
|
15
|
+
* Fixed a bug in detecting the text of an external link. (#137)
|
|
16
|
+
|
|
1
17
|
v0.55.13
|
|
2
18
|
--------
|
|
3
19
|
* Fixed a bug in ``Section.level`` resulting in malformed section titles when multiple levels are added (#135)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: wikitextparser
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.56.2
|
|
4
4
|
Summary: A simple parsing tool for MediaWiki's wikitext markup.
|
|
5
5
|
Keywords: MediaWiki,wikitext,parser
|
|
6
6
|
Author-email: 5j9 <5j9@users.noreply.github.com>
|
|
7
|
-
Requires-Python: >= 3.
|
|
7
|
+
Requires-Python: >= 3.8
|
|
8
8
|
Description-Content-Type: text/x-rst
|
|
9
9
|
Classifier: Programming Language :: Python
|
|
10
10
|
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
@@ -38,7 +38,7 @@ The purpose is to allow users easily extract and/or manipulate templates, templa
|
|
|
38
38
|
Installation
|
|
39
39
|
============
|
|
40
40
|
|
|
41
|
-
- Python 3.
|
|
41
|
+
- Python 3.8+ is required
|
|
42
42
|
- ``pip install wikitextparser``
|
|
43
43
|
|
|
44
44
|
Usage
|
|
@@ -63,13 +63,13 @@ EXTERNAL_LINK = (
|
|
|
63
63
|
rb'(?>' + BARE_EXTERNAL_LINK + rb'|' + BRACKET_EXTERNAL_LINK + rb')'
|
|
64
64
|
)
|
|
65
65
|
EXTERNAL_LINK_FINDITER = rc(EXTERNAL_LINK, IGNORECASE).finditer
|
|
66
|
-
|
|
67
|
-
rb'[' + INVALID_URL_CHARS[:-4] + rb'{}]'
|
|
66
|
+
INVALID_EL_TPP_CHRS_SUB = rc( # the [:-4] slice allows \[ and \]
|
|
67
|
+
rb'[' + INVALID_URL_CHARS[:-4] + rb'{}|]'
|
|
68
68
|
).sub
|
|
69
69
|
|
|
70
70
|
# Sections
|
|
71
71
|
SECTION_HEADING = rb'^(?<equals>={1,6})[^\n]+?(?P=equals)[ \t]*+$'
|
|
72
|
-
|
|
72
|
+
SUB_SECTION = rb'(?:^(?P=equals)=[^\n]+?(?P=equals)=[ \t]*+$.*?)*'
|
|
73
73
|
LEAD_SECTION = rb'(?<section>(?<equals>).*?)'
|
|
74
74
|
SECTIONS_FULLMATCH = rc(
|
|
75
75
|
LEAD_SECTION
|
|
@@ -84,9 +84,8 @@ SECTIONS_TOP_LEVELS_ONLY = rc(
|
|
|
84
84
|
+ rb'(?<section>'
|
|
85
85
|
+ SECTION_HEADING
|
|
86
86
|
+ rb'.*?'
|
|
87
|
-
+
|
|
88
|
-
+ rb'
|
|
89
|
-
rb')*',
|
|
87
|
+
+ SUB_SECTION
|
|
88
|
+
+ rb')*',
|
|
90
89
|
DOTALL | MULTILINE | VERBOSE,
|
|
91
90
|
).fullmatch
|
|
92
91
|
|
|
@@ -432,10 +431,7 @@ class WikiText:
|
|
|
432
431
|
@property
|
|
433
432
|
def span(self) -> tuple:
|
|
434
433
|
"""Return the span of self relative to the start of the root node."""
|
|
435
|
-
|
|
436
|
-
# and return statements requires enclosing parentheses:
|
|
437
|
-
# https://docs.python.org/3.8/whatsnew/3.8.html#other-language-changes
|
|
438
|
-
return (*self._span_data[:2],) # noqa
|
|
434
|
+
return (*self._span_data[:2],)
|
|
439
435
|
|
|
440
436
|
@property
|
|
441
437
|
def string(self) -> str:
|
|
@@ -1194,7 +1190,7 @@ class WikiText:
|
|
|
1194
1190
|
)
|
|
1195
1191
|
|
|
1196
1192
|
@property
|
|
1197
|
-
def _ext_link_shadow(self):
|
|
1193
|
+
def _ext_link_shadow(self) -> bytearray:
|
|
1198
1194
|
"""Replace the invalid chars of SPAN_PARSER_TYPES with b'_'.
|
|
1199
1195
|
|
|
1200
1196
|
For comments, all characters are replaced, but for ('Template',
|
|
@@ -1204,12 +1200,14 @@ class WikiText:
|
|
|
1204
1200
|
byte_array = bytearray(self._lststr[0][ss:se], 'ascii', 'replace')
|
|
1205
1201
|
subspans = self._subspans
|
|
1206
1202
|
for s, e, _, _ in subspans('Comment'):
|
|
1207
|
-
byte_array[s:e] = (e - s) * b'_'
|
|
1203
|
+
byte_array[s - ss : e - ss] = (e - s) * b'_'
|
|
1208
1204
|
for s, e, _, _ in subspans('WikiLink'):
|
|
1209
|
-
byte_array[s:e] = (e - s) * b' '
|
|
1205
|
+
byte_array[s - ss : e - ss] = (e - s) * b' '
|
|
1210
1206
|
for type_ in 'Template', 'ParserFunction', 'Parameter':
|
|
1211
1207
|
for s, e, _, _ in subspans(type_):
|
|
1212
|
-
byte_array[s:e] =
|
|
1208
|
+
byte_array[s - ss : e - ss] = INVALID_EL_TPP_CHRS_SUB(
|
|
1209
|
+
b' ', byte_array[s:e]
|
|
1210
|
+
)
|
|
1213
1211
|
return byte_array
|
|
1214
1212
|
|
|
1215
1213
|
@property
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|