Modify conditions according to #618

This commit is contained in:
Veronica K. B. Olsen
2021-01-29 11:55:36 +01:00
parent 8de0c55b68
commit 8e3fa892e1
+6 -7
View File
@@ -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