From c55f4be734d769d3dba6f06602930f5f4b34b1aa Mon Sep 17 00:00:00 2001 From: BenCantCode Date: Fri, 19 Apr 2024 03:47:52 -0700 Subject: [PATCH] Fix malformed section titles when multiple levels are added --- wikitextparser/_section.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wikitextparser/_section.py b/wikitextparser/_section.py index 55b011c..50bda6b 100644 --- a/wikitextparser/_section.py +++ b/wikitextparser/_section.py @@ -44,7 +44,7 @@ def level(self, value: int) -> None: if level_diff < 0: new_equals = '=' * abs(level_diff) self.insert(0, new_equals) - self.insert(m.end(2) + 1, new_equals) + self.insert(m.end(2) + abs(level_diff), new_equals) return del self[:level_diff] del self[m.end(2) : m.end(2) + level_diff]