Fixed a few bugs
This commit is contained in:
@@ -73,7 +73,6 @@ class ToHtml(Tokenizer):
|
|||||||
self.theResult += "<h2%s>%s</h2>\n" % (hStyle,tText)
|
self.theResult += "<h2%s>%s</h2>\n" % (hStyle,tText)
|
||||||
|
|
||||||
elif tType == self.T_HEAD3:
|
elif tType == self.T_HEAD3:
|
||||||
print(tText)
|
|
||||||
self.theResult += "<h3%s>%s</h3>\n" % (hStyle,tText)
|
self.theResult += "<h3%s>%s</h3>\n" % (hStyle,tText)
|
||||||
|
|
||||||
elif tType == self.T_HEAD4:
|
elif tType == self.T_HEAD4:
|
||||||
|
|||||||
@@ -26,12 +26,12 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class Tokenizer():
|
class Tokenizer():
|
||||||
|
|
||||||
FMT_B_B = "" # Begin bold
|
FMT_B_B = 1 # Begin bold
|
||||||
FMT_B_E = "" # End bold
|
FMT_B_E = 2 # End bold
|
||||||
FMT_I_B = "" # Begin italics
|
FMT_I_B = 3 # Begin italics
|
||||||
FMT_I_E = "" # End italics
|
FMT_I_E = 4 # End italics
|
||||||
FMT_U_B = "" # Begin underline
|
FMT_U_B = 5 # Begin underline
|
||||||
FMT_U_E = "" # End underline
|
FMT_U_E = 6 # End underline
|
||||||
|
|
||||||
T_EMPTY = 1 # Empty line (new paragraph)
|
T_EMPTY = 1 # Empty line (new paragraph)
|
||||||
T_COMMENT = 2 # Comment line
|
T_COMMENT = 2 # Comment line
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class ToMarkdown(Tokenizer):
|
|||||||
|
|
||||||
def doConvert(self):
|
def doConvert(self):
|
||||||
|
|
||||||
htmlTags = {
|
mdTags = {
|
||||||
self.FMT_B_B : "**",
|
self.FMT_B_B : "**",
|
||||||
self.FMT_B_E : "**",
|
self.FMT_B_E : "**",
|
||||||
self.FMT_I_B : "_",
|
self.FMT_I_B : "_",
|
||||||
@@ -63,7 +63,7 @@ class ToMarkdown(Tokenizer):
|
|||||||
elif tType == self.T_TEXT:
|
elif tType == self.T_TEXT:
|
||||||
tTemp = tText
|
tTemp = tText
|
||||||
for xPos, xLen, xFmt in reversed(tFormat):
|
for xPos, xLen, xFmt in reversed(tFormat):
|
||||||
tTemp = tTemp[:xPos]+tTemp[xPos+xLen:]
|
tTemp = tTemp[:xPos]+mdTags[xFmt]+tTemp[xPos+xLen:]
|
||||||
tText = tTemp
|
tText = tTemp
|
||||||
|
|
||||||
tLen = len(tText)
|
tLen = len(tText)
|
||||||
|
|||||||
Reference in New Issue
Block a user