From d4d258e170d6ae01850c54fd4bb1d94ea09b3614 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sun, 9 Feb 2025 15:11:07 +0100 Subject: [PATCH] Fix document splitter not recognising alt scene format (#2233) --- .gitignore | 3 ++- novelwriter/dialogs/docsplit.py | 4 ++++ tests/test_dialogs/test_dlg_docsplit.py | 4 ++-- tests/test_gui/test_gui_projtree.py | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index a69e4f00..6986d20d 100644 --- a/.gitignore +++ b/.gitignore @@ -20,8 +20,9 @@ i18n/*.qph # Documentation /docs/build/ +/docs/source/locales/**/*.mo /novelwriter/assets/help/ -/novelwriter/assets/manual.pdf +/novelwriter/assets/manual*.pdf *.qch *.qhc .~lock.* diff --git a/novelwriter/dialogs/docsplit.py b/novelwriter/dialogs/docsplit.py index 80fd6418..71b1725c 100644 --- a/novelwriter/dialogs/docsplit.py +++ b/novelwriter/dialogs/docsplit.py @@ -247,6 +247,10 @@ class GuiDocSplit(NDialog): onLine = lineNo hLevel = 2 hLabel = aLine[4:].strip() + elif aLine.startswith("###! ") and spLevel >= 3: + onLine = lineNo + hLevel = 3 + hLabel = aLine[5:].strip() if onLine >= 0 and hLevel > 0: newItem = QListWidgetItem() diff --git a/tests/test_dialogs/test_dlg_docsplit.py b/tests/test_dialogs/test_dlg_docsplit.py index e1bcba8f..bd75ca01 100644 --- a/tests/test_dialogs/test_dlg_docsplit.py +++ b/tests/test_dialogs/test_dlg_docsplit.py @@ -43,10 +43,10 @@ def testDlgSplit_Main(qtbot, monkeypatch, nwGUI, projPath, mockRnd): "##! Prologue\n\nText\n\n" "## Chapter One\n\nText\n\n" "### Scene One\n\nText\n\n" - "### Scene Two\n\nText\n\n" + "###! Scene Two\n\nText\n\n" "## Chapter Two\n\nText\n\n" "### Scene Three\n\nText\n\n" - "### Scene Four\n\nText\n\n" + "###! Scene Four\n\nText\n\n" "#! New Title\n\nText\n\n" "## New Chapter\n\nText\n\n" "### New Scene\n\nText\n\n" diff --git a/tests/test_gui/test_gui_projtree.py b/tests/test_gui/test_gui_projtree.py index 3642ef4b..84a7ea9a 100644 --- a/tests/test_gui/test_gui_projtree.py +++ b/tests/test_gui/test_gui_projtree.py @@ -858,10 +858,10 @@ def testGuiProjTree_SplitDocument(qtbot, monkeypatch, nwGUI, projPath, mockRnd, "##! Prologue\n\nText\n\n" "## Chapter One\n\nText\n\n" "### Scene One\n\nText\n\n" - "### Scene Two\n\nText\n\n" + "###! Scene Two\n\nText\n\n" "## Chapter Two\n\nText\n\n" "### Scene Three\n\nText\n\n" - "### Scene Four\n\nText\n\n" + "###! Scene Four\n\nText\n\n" "#! New Title\n\nText\n\n" "## New Chapter\n\nText\n\n" "### New Scene\n\nText\n\n"