From 9da99e31837d46604c8ec7269cacc9c425ea8abc Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Wed, 13 Mar 2024 15:53:28 +0100 Subject: [PATCH] Apply hide scene/section regardless of format being filled in --- novelwriter/core/tokenizer.py | 37 +++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/novelwriter/core/tokenizer.py b/novelwriter/core/tokenizer.py index 3d52e19a..215555c5 100644 --- a/novelwriter/core/tokenizer.py +++ b/novelwriter/core/tokenizer.py @@ -646,15 +646,18 @@ class Tokenizer(ABC): tFormat = self._fmtScene if isPlain else self._fmtHScene if self._isNovel: self._hFormatter.incScene() - tText = self._hFormatter.apply(tFormat, tText, nHead) - tStyle = self._sceneStyle - if tText == "": - tType = self.T_EMPTY if self._noSep or sHide else self.T_SKIP - tStyle = self.A_NONE - elif tText == tFormat: - tText = "" if self._noSep else tText - tType = self.T_EMPTY if self._noSep else self.T_SEP - tStyle = self.A_NONE if self._noSep else self.A_CENTRE + if sHide: + tText = "" + tType = self.T_EMPTY + else: + tText = self._hFormatter.apply(tFormat, tText, nHead) + tStyle = self._sceneStyle + if tText == "": # Empty Format + tType = self.T_EMPTY if self._noSep else self.T_SKIP + elif tText == tFormat: # Static Format + tText = "" if self._noSep else tText + tType = self.T_EMPTY if self._noSep else self.T_SEP + tStyle = self.A_NONE if self._noSep else self.A_CENTRE self._noSep = False self._tokens.append(( @@ -676,12 +679,16 @@ class Tokenizer(ABC): tType = self.T_HEAD4 tStyle = self.A_NONE if self._isNovel: - tText = self._hFormatter.apply(self._fmtSection, tText, nHead) - if tText == "": - tType = self.T_EMPTY if self._hideSection else self.T_SKIP - elif tText == self._fmtSection: - tType = self.T_SEP - tStyle = self.A_CENTRE + if self._hideSection: + tText = "" + tType = self.T_EMPTY + else: + tText = self._hFormatter.apply(self._fmtSection, tText, nHead) + if tText == "": # Empty Format + tType = self.T_SKIP + elif tText == self._fmtSection: # Static Format + tType = self.T_SEP + tStyle = self.A_CENTRE self._tokens.append(( tType, nHead, tText, [], tStyle