From 8e3fa892e1d6d141b1c06e099c0413635434191f Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Fri, 29 Jan 2021 11:55:36 +0100 Subject: [PATCH] Modify conditions according to #618 --- nw/core/tree.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/nw/core/tree.py b/nw/core/tree.py index 85791f42..f739a940 100644 --- a/nw/core/tree.py +++ b/nw/core/tree.py @@ -39,12 +39,11 @@ from nw.constants import ( logger = logging.getLogger(__name__) -# Translation map for item layouts -NOVEL_MAP = { +# Layout Translation Map +LAYOUT_MAP = { nwItemLayout.SCENE: { "H1": nwItemLayout.BOOK, "H2": nwItemLayout.CHAPTER, - "H4": nwItemLayout.SCENE, }, nwItemLayout.CHAPTER: { "H1": nwItemLayout.BOOK, @@ -56,7 +55,7 @@ NOVEL_MAP = { "H3": nwItemLayout.SCENE, "H4": nwItemLayout.SCENE, }, - nwItemLayout.BOOK: { + nwItemLayout.PARTITION: { "H2": nwItemLayout.CHAPTER, "H3": nwItemLayout.SCENE, "H4": nwItemLayout.SCENE, @@ -241,9 +240,9 @@ class NWTree(): return False iLayout = tItem.itemLayout - if iLayout in NOVEL_MAP: - if hLevel in NOVEL_MAP[iLayout]: - tItem.itemLayout = NOVEL_MAP[iLayout][hLevel] + if iLayout in LAYOUT_MAP: + if hLevel in LAYOUT_MAP[iLayout]: + tItem.itemLayout = LAYOUT_MAP[iLayout][hLevel] return True return False