Fixed a few bugs

This commit is contained in:
Veronica K. B. Olsen
2019-10-19 15:05:28 +02:00
parent 16401f4c1f
commit 691717ce96
3 changed files with 8 additions and 9 deletions
-1
View File
@@ -73,7 +73,6 @@ class ToHtml(Tokenizer):
self.theResult += "<h2%s>%s</h2>\n" % (hStyle,tText)
elif tType == self.T_HEAD3:
print(tText)
self.theResult += "<h3%s>%s</h3>\n" % (hStyle,tText)
elif tType == self.T_HEAD4:
+6 -6
View File
@@ -26,12 +26,12 @@ logger = logging.getLogger(__name__)
class Tokenizer():
FMT_B_B = "" # Begin bold
FMT_B_E = "" # End bold
FMT_I_B = "" # Begin italics
FMT_I_E = "" # End italics
FMT_U_B = "" # Begin underline
FMT_U_E = "" # End underline
FMT_B_B = 1 # Begin bold
FMT_B_E = 2 # End bold
FMT_I_B = 3 # Begin italics
FMT_I_E = 4 # End italics
FMT_U_B = 5 # Begin underline
FMT_U_E = 6 # End underline
T_EMPTY = 1 # Empty line (new paragraph)
T_COMMENT = 2 # Comment line
+2 -2
View File
@@ -27,7 +27,7 @@ class ToMarkdown(Tokenizer):
def doConvert(self):
htmlTags = {
mdTags = {
self.FMT_B_B : "**",
self.FMT_B_E : "**",
self.FMT_I_B : "_",
@@ -63,7 +63,7 @@ class ToMarkdown(Tokenizer):
elif tType == self.T_TEXT:
tTemp = tText
for xPos, xLen, xFmt in reversed(tFormat):
tTemp = tTemp[:xPos]+tTemp[xPos+xLen:]
tTemp = tTemp[:xPos]+mdTags[xFmt]+tTemp[xPos+xLen:]
tText = tTemp
tLen = len(tText)