wikitextparser 0.55.12__tar.gz → 0.55.13__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.12 → wikitextparser-0.55.13}/CHANGELOG.rst +4 -0
  2. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/PKG-INFO +1 -1
  3. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/wikitextparser/__init__.py +1 -1
  4. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/wikitextparser/_parser_function.py +1 -4
  5. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/wikitextparser/_section.py +2 -2
  6. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/wikitextparser/_wikitext.py +7 -19
  7. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/.coveragerc +0 -0
  8. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/.github/workflows/tests.yml +0 -0
  9. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/.gitignore +0 -0
  10. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/.readthedocs.yaml +0 -0
  11. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/LICENSE.md +0 -0
  12. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/README.rst +0 -0
  13. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/docs/CHANGELOG.rst +0 -0
  14. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/docs/Makefile +0 -0
  15. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/docs/README.rst +0 -0
  16. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/docs/conf.py +0 -0
  17. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/docs/index.rst +0 -0
  18. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/docs/make.bat +0 -0
  19. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/pyproject.toml +0 -0
  20. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/wikitextparser/_argument.py +0 -0
  21. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/wikitextparser/_cell.py +0 -0
  22. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/wikitextparser/_comment_bold_italic.py +0 -0
  23. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/wikitextparser/_config.py +0 -0
  24. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/wikitextparser/_externallink.py +0 -0
  25. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/wikitextparser/_parameter.py +0 -0
  26. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/wikitextparser/_spans.py +0 -0
  27. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/wikitextparser/_table.py +0 -0
  28. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/wikitextparser/_tag.py +0 -0
  29. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/wikitextparser/_template.py +0 -0
  30. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/wikitextparser/_wikilink.py +0 -0
  31. {wikitextparser-0.55.12 → wikitextparser-0.55.13}/wikitextparser/_wikilist.py +0 -0
@@ -1,3 +1,7 @@
1
+ v0.55.13
2
+ --------
3
+ * Fixed a bug in ``Section.level`` resulting in malformed section titles when multiple levels are added (#135)
4
+
1
5
  v0.55.12
2
6
  --------
3
7
  * Performance improvements in extracting bold and italic nodes. (#133)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wikitextparser
3
- Version: 0.55.12
3
+ Version: 0.55.13
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>
@@ -1,5 +1,5 @@
1
1
  # Scheme: [N!]N(.N)*[{a|b|rc}N][.postN][.devN]
2
- __version__ = '0.55.12'
2
+ __version__ = '0.55.13'
3
3
 
4
4
  from . import _wikitext
5
5
  from ._argument import Argument # noqa: F401
@@ -60,10 +60,7 @@ class SubWikiTextWithArgs(SubWikiText):
60
60
  else:
61
61
  arg_span = old_span
62
62
  arg = Argument(lststr, type_to_spans, arg_span, type_, self)
63
- arg._shadow_cache = (
64
- lststr[0][s:e],
65
- shadow[arg_self_start:arg_self_end],
66
- )
63
+ arg._span_data[3] = shadow[arg_self_start:arg_self_end]
67
64
  arguments_append(arg)
68
65
  return arguments
69
66
 
@@ -42,9 +42,9 @@ class Section(SubWikiText):
42
42
  if level_diff == 0:
43
43
  return
44
44
  if level_diff < 0:
45
- new_equals = '=' * abs(level_diff)
45
+ new_equals = '=' * -level_diff
46
46
  self.insert(0, new_equals)
47
- self.insert(m.end(2) + 1, new_equals)
47
+ self.insert(m.end(2) - level_diff, new_equals)
48
48
  return
49
49
  del self[:level_diff]
50
50
  del self[m.end(2) : m.end(2) + level_diff]
@@ -40,7 +40,6 @@ from ._spans import (
40
40
  END_TAG_PATTERN,
41
41
  EXTERNAL_LINK_URL_TAIL,
42
42
  INVALID_URL_CHARS,
43
- PARSABLE_TAG_EXTENSION_NAME,
44
43
  START_TAG_PATTERN,
45
44
  parse_to_spans,
46
45
  rc,
@@ -52,10 +51,6 @@ NAME_CAPTURING_HTML_START_TAG_FINDITER = rc(
52
51
  )
53
52
  ).finditer
54
53
 
55
- PARSABLE_TAG_EXTENSIONS_MATCH = rc(
56
- rb'<' + PARSABLE_TAG_EXTENSION_NAME + rb'\b', IGNORECASE
57
- ).match
58
-
59
54
  # External links
60
55
  BRACKET_EXTERNAL_LINK_SCHEMES = regex_pattern(
61
56
  _bare_external_link_schemes | {'//'}
@@ -113,11 +108,7 @@ TABLE_FINDITER = rc(
113
108
  DOTALL | MULTILINE | VERBOSE,
114
109
  ).finditer
115
110
 
116
- substitute_apostrophes = rc( # bold-italic, bold, or italic tokens
117
- rb"('\0*+){2,}+(?=[^']|$)",
118
- MULTILINE | VERBOSE,
119
- ).sub
120
- find_lines = rc(rb'(.*?)$').finditer
111
+ substitute_apostrophes = rc(rb"('\0*+){2,}+(?=[^']|$)", MULTILINE).sub
121
112
 
122
113
  BOLD_FINDITER = rc(
123
114
  rb"""
@@ -213,7 +204,7 @@ class WikiText:
213
204
  # The following class attribute acts as a default value.
214
205
  _type = 'WikiText'
215
206
 
216
- __slots__ = '_type_to_spans', '_lststr', '_span_data', '_shadow_cache'
207
+ __slots__ = '_type_to_spans', '_lststr', '_span_data'
217
208
 
218
209
  def __init__(
219
210
  self,
@@ -241,7 +232,6 @@ class WikiText:
241
232
  if _type not in SPAN_PARSER_TYPES:
242
233
  type_to_spans = self._type_to_spans = parse_to_spans(byte_array)
243
234
  type_to_spans[_type] = [span]
244
- self._shadow_cache = string, byte_array
245
235
  else:
246
236
  # In SPAN_PARSER_TYPES, we can't pass the original byte_array to
247
237
  # parser to generate the shadow because it will replace the whole
@@ -259,7 +249,6 @@ class WikiText:
259
249
  byte_array[0] = 3
260
250
  byte_array[-1] = 32
261
251
  type_to_spans = parse_to_spans(byte_array)
262
- self._shadow_cache = string, byte_array
263
252
  type_to_spans[_type].insert(0, span)
264
253
  self._type_to_spans = type_to_spans
265
254
  if type(self) is Parameter:
@@ -1072,12 +1061,11 @@ class WikiText:
1072
1061
  s = starts[1]
1073
1062
  append_bold_start(s)
1074
1063
  return b'_' * (s - starts[0]) + m.string[s : m.end()]
1075
- if n > 5: # more than 5 apostrophes -> hide the prior ones
1076
- odd_bold_italics ^= True
1077
- odd_italics ^= True
1078
- s = starts[-5]
1079
- return b'_' * (s - starts[0]) + m.string[s : m.end()]
1080
- raise # execution should never reach here
1064
+ # more than 5 apostrophes -> hide the prior ones
1065
+ odd_bold_italics ^= True
1066
+ odd_italics ^= True
1067
+ s = starts[-5]
1068
+ return b'_' * (s - starts[0]) + m.string[s : m.end()]
1081
1069
 
1082
1070
  return bytearray(b'\n').join(
1083
1071
  [