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.
Files changed (31) hide show
  1. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/.github/workflows/tests.yml +1 -1
  2. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/CHANGELOG.rst +16 -0
  3. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/PKG-INFO +3 -3
  4. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/README.rst +1 -1
  5. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/pyproject.toml +1 -1
  6. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/__init__.py +1 -1
  7. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_wikitext.py +12 -14
  8. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/.coveragerc +0 -0
  9. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/.gitignore +0 -0
  10. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/.readthedocs.yaml +0 -0
  11. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/LICENSE.md +0 -0
  12. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/docs/CHANGELOG.rst +0 -0
  13. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/docs/Makefile +0 -0
  14. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/docs/README.rst +0 -0
  15. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/docs/conf.py +0 -0
  16. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/docs/index.rst +0 -0
  17. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/docs/make.bat +0 -0
  18. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_argument.py +0 -0
  19. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_cell.py +0 -0
  20. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_comment_bold_italic.py +0 -0
  21. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_config.py +0 -0
  22. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_externallink.py +0 -0
  23. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_parameter.py +0 -0
  24. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_parser_function.py +0 -0
  25. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_section.py +0 -0
  26. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_spans.py +0 -0
  27. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_table.py +0 -0
  28. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_tag.py +0 -0
  29. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_template.py +0 -0
  30. {wikitextparser-0.55.13 → wikitextparser-0.56.2}/wikitextparser/_wikilink.py +0 -0
  31. {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.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
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.55.13
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
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.7+ is required
41
+ - Python 3.8+ is required
42
42
  - ``pip install wikitextparser``
43
43
 
44
44
  Usage
@@ -19,7 +19,7 @@ The purpose is to allow users easily extract and/or manipulate templates, templa
19
19
  Installation
20
20
  ============
21
21
 
22
- - Python 3.7+ is required
22
+ - Python 3.8+ is required
23
23
  - ``pip install wikitextparser``
24
24
 
25
25
  Usage
@@ -19,7 +19,7 @@ classifiers = [
19
19
  "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
20
20
  "Topic :: Text Processing",
21
21
  ]
22
- requires-python = ">= 3.7"
22
+ requires-python = ">= 3.8"
23
23
  dependencies = [
24
24
  "regex >= 2022.9.11",
25
25
  "wcwidth",
@@ -1,5 +1,5 @@
1
1
  # Scheme: [N!]N(.N)*[{a|b|rc}N][.postN][.devN]
2
- __version__ = '0.55.13'
2
+ __version__ = '0.56.2'
3
3
 
4
4
  from . import _wikitext
5
5
  from ._argument import Argument # noqa: F401
@@ -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
- INVALID_EXT_CHARS_SUB = rc( # the [:-4] slice allows \[ and \]
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
- SUBSECTION_HEADING = rb'^(?P=equals)=[^\n]+?(?P=equals)=[ \t]*+$'
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
- + SUBSECTION_HEADING
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
- # In Python 3.7 and earlier, generalized iterable unpacking in yield
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] = INVALID_EXT_CHARS_SUB(b' ', 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