Update converter classes to handle only single paragraphs

This commit is contained in:
Veronica Berglyd Olsen
2024-05-21 22:32:07 +02:00
parent d8bb2ad3ae
commit ba6259f08a
3 changed files with 60 additions and 90 deletions
+3 -8
View File
@@ -139,17 +139,11 @@ class ToMarkdown(Tokenizer):
mTags = EXT_MD
cSkip = nwUnicode.U_MMSP
para = []
lines = []
lineSep = " \n" if self._preserveBreaks else " "
for tType, _, tText, tFormat, tStyle in self._tokens:
if tType == self.T_EMPTY:
if para:
tTemp = (lineSep.join(para)).rstrip(" ")
lines.append(f"{tTemp}\n\n")
para = []
pass
elif tType == self.T_TITLE:
tHead = tText.replace(nwHeadFmt.BR, "\n")
@@ -178,7 +172,8 @@ class ToMarkdown(Tokenizer):
lines.append(f"{cSkip}\n\n")
elif tType == self.T_TEXT:
para.append(self._formatText(tText, tFormat, mTags).rstrip())
tTemp = self._formatText(tText, tFormat, mTags).replace("\n", " \n")
lines.append(f"{tTemp}\n\n")
elif tType == self.T_SYNOPSIS and self._doSynopsis:
label = self._localLookup("Synopsis")