Separate ordinary headers and novel headers in the Tokenizer

This commit is contained in:
Veronica Berglyd Olsen
2025-01-25 14:58:06 +01:00
parent 5be1e2c954
commit 13e6199af2
5 changed files with 129 additions and 126 deletions
+3 -7
View File
@@ -113,19 +113,15 @@ class ToMarkdown(Tokenizer):
tTemp = self._formatText(tText, tFormat, mTags).replace("\n", " \n")
lines.append(f"{tTemp}\n\n")
elif tType == BlockTyp.TITLE:
elif tType in (BlockTyp.TITLE, BlockTyp.HEAD1, BlockTyp.PART, BlockTyp.CHAPTER):
tHead = tText.replace("\n", " - ")
lines.append(f"# {tHead}\n\n")
elif tType == BlockTyp.HEAD1:
tHead = tText.replace("\n", " - ")
lines.append(f"# {tHead}\n\n")
elif tType == BlockTyp.HEAD2:
elif tType in (BlockTyp.HEAD2, BlockTyp.SCENE):
tHead = tText.replace("\n", " - ")
lines.append(f"## {tHead}\n\n")
elif tType == BlockTyp.HEAD3:
elif tType in (BlockTyp.HEAD3, BlockTyp.SECTION):
tHead = tText.replace("\n", " - ")
lines.append(f"### {tHead}\n\n")