From 3149e7ec0d34be716d7df2aee4eaaacf89e49189 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sun, 6 Jul 2025 17:29:19 +0200 Subject: [PATCH] Disable config parser interpolation with % (#2455) --- novelwriter/common.py | 5 +++-- tests/test_dialogs/test_dlg_preferences.py | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/novelwriter/common.py b/novelwriter/common.py index a4e37f62..2ad42935 100644 --- a/novelwriter/common.py +++ b/novelwriter/common.py @@ -680,11 +680,12 @@ class NWConfigParser(ConfigParser): """Common: Adapted Config Parser This is a subclass of the standard config parser that adds type safe - helper functions, and support for lists. + helper functions, and support for lists. It also turns off + interpolation, which would require % symbols to be escaped (#2455). """ def __init__(self) -> None: - super().__init__() + super().__init__(interpolation=None) return def rdStr(self, section: str, option: str, default: str) -> str: diff --git a/tests/test_dialogs/test_dlg_preferences.py b/tests/test_dialogs/test_dlg_preferences.py index 5572f430..ab5822be 100644 --- a/tests/test_dialogs/test_dlg_preferences.py +++ b/tests/test_dialogs/test_dlg_preferences.py @@ -271,8 +271,8 @@ def testDlgPreferences_Settings(qtbot, monkeypatch, nwGUI, fncPath, tstPaths): prefs.dialogLine.setText("–") prefs.narratorBreak.setCurrentData("–", "") prefs.narratorDialog.setCurrentData("–", "") - prefs.altDialogOpen.setText("<") - prefs.altDialogClose.setText(">") + prefs.altDialogOpen.setText("%") # Symbol also tests for #2455 + prefs.altDialogClose.setText("%") # Symbol also tests for #2455 prefs.highlightEmph.setChecked(False) prefs.showMultiSpaces.setChecked(False) @@ -401,8 +401,8 @@ def testDlgPreferences_Settings(qtbot, monkeypatch, nwGUI, fncPath, tstPaths): assert CONFIG.dialogLine == "–" assert CONFIG.narratorBreak == "–" assert CONFIG.narratorDialog == "–" - assert CONFIG.altDialogOpen == "<" - assert CONFIG.altDialogClose == ">" + assert CONFIG.altDialogOpen == "%" + assert CONFIG.altDialogClose == "%" assert CONFIG.highlightEmph is False assert CONFIG.showMultiSpaces is False