Lines with hard line breaks should not have a justify property
This commit is contained in:
+6
-3
@@ -119,7 +119,7 @@ class ToHtml(Tokenizer):
|
|||||||
self.theResult = ""
|
self.theResult = ""
|
||||||
|
|
||||||
thisPar = []
|
thisPar = []
|
||||||
parStyle = ""
|
parStyle = None
|
||||||
tmpResult = []
|
tmpResult = []
|
||||||
for tType, tText, tFormat, tStyle in self.theTokens:
|
for tType, tText, tFormat, tStyle in self.theTokens:
|
||||||
|
|
||||||
@@ -158,11 +158,13 @@ class ToHtml(Tokenizer):
|
|||||||
|
|
||||||
# Process TextType
|
# Process TextType
|
||||||
if tType == self.T_EMPTY:
|
if tType == self.T_EMPTY:
|
||||||
|
if parStyle is None:
|
||||||
|
parStyle = ""
|
||||||
if len(thisPar) > 0:
|
if len(thisPar) > 0:
|
||||||
tTemp = "".join(thisPar)
|
tTemp = "".join(thisPar)
|
||||||
tmpResult.append("<p%s>%s</p>\n" % (parStyle, tTemp.rstrip()))
|
tmpResult.append("<p%s>%s</p>\n" % (parStyle, tTemp.rstrip()))
|
||||||
thisPar = []
|
thisPar = []
|
||||||
parStyle = ""
|
parStyle = None
|
||||||
|
|
||||||
elif tType == self.T_HEAD1:
|
elif tType == self.T_HEAD1:
|
||||||
tHead = tText.replace(r"\\", "<br/>")
|
tHead = tText.replace(r"\\", "<br/>")
|
||||||
@@ -188,7 +190,8 @@ class ToHtml(Tokenizer):
|
|||||||
|
|
||||||
elif tType == self.T_TEXT:
|
elif tType == self.T_TEXT:
|
||||||
tTemp = tText
|
tTemp = tText
|
||||||
parStyle = hStyle
|
if parStyle is None:
|
||||||
|
parStyle = hStyle
|
||||||
for xPos, xLen, xFmt in reversed(tFormat):
|
for xPos, xLen, xFmt in reversed(tFormat):
|
||||||
tTemp = tTemp[:xPos]+htmlTags[xFmt]+tTemp[xPos+xLen:]
|
tTemp = tTemp[:xPos]+htmlTags[xFmt]+tTemp[xPos+xLen:]
|
||||||
if tText.endswith(" "):
|
if tText.endswith(" "):
|
||||||
|
|||||||
@@ -366,9 +366,14 @@ class Tokenizer():
|
|||||||
# Save the line as is, but append the array of formatting locations
|
# Save the line as is, but append the array of formatting locations
|
||||||
# sorted by position
|
# sorted by position
|
||||||
fmtPos = sorted(fmtPos, key=itemgetter(0))
|
fmtPos = sorted(fmtPos, key=itemgetter(0))
|
||||||
self.theTokens.append((
|
if aLine.endswith(" "):
|
||||||
self.T_TEXT, aLine, fmtPos, defAlign
|
self.theTokens.append((
|
||||||
))
|
self.T_TEXT, aLine, fmtPos, self.A_LEFT
|
||||||
|
))
|
||||||
|
else:
|
||||||
|
self.theTokens.append((
|
||||||
|
self.T_TEXT, aLine, fmtPos, defAlign
|
||||||
|
))
|
||||||
tmpMarkdown.append("%s\n" % aLine)
|
tmpMarkdown.append("%s\n" % aLine)
|
||||||
|
|
||||||
# Always add an empty line at the end
|
# Always add an empty line at the end
|
||||||
|
|||||||
Reference in New Issue
Block a user