Fix line breaks from fixed-width lines in webclient. Resolve #1837.
This commit is contained in:
parent
607004f2eb
commit
56bfc10828
2 changed files with 6 additions and 5 deletions
|
|
@ -99,7 +99,8 @@ class TextToHTMLparser(object):
|
||||||
re_uline = re.compile("(?:%s)(.*?)(?=%s|%s)" % (underline.replace("[", r"\["), fgstop, bgstop))
|
re_uline = re.compile("(?:%s)(.*?)(?=%s|%s)" % (underline.replace("[", r"\["), fgstop, bgstop))
|
||||||
re_blink = re.compile("(?:%s)(.*?)(?=%s|%s)" % (blink.replace("[", r"\["), fgstop, bgstop))
|
re_blink = re.compile("(?:%s)(.*?)(?=%s|%s)" % (blink.replace("[", r"\["), fgstop, bgstop))
|
||||||
re_inverse = re.compile("(?:%s)(.*?)(?=%s|%s)" % (inverse.replace("[", r"\["), fgstop, bgstop))
|
re_inverse = re.compile("(?:%s)(.*?)(?=%s|%s)" % (inverse.replace("[", r"\["), fgstop, bgstop))
|
||||||
re_string = re.compile(r'(?P<htmlchars>[<&>])|(?P<space> [ \t]+)|(?P<spacestart>^ )|(?P<lineend>\r\n|\r|\n)', re.S | re.M | re.I)
|
re_string = re.compile(r'(?P<htmlchars>[<&>])|(?P<firstspace>(?<=\S)\s+)|(?P<space>\s[ \t]+)|'
|
||||||
|
r'(?P<spacestart>^ )|(?P<lineend>\r\n|\r|\n)', re.S | re.M | re.I)
|
||||||
re_url = re.compile(r'((?:ftp|www|https?)\W+(?:(?!\.(?:\s|$)|&\w+;)[^"\',;$*^\\(){}<>\[\]\s])+)(\.(?:\s|$)|&\w+;|)')
|
re_url = re.compile(r'((?:ftp|www|https?)\W+(?:(?!\.(?:\s|$)|&\w+;)[^"\',;$*^\\(){}<>\[\]\s])+)(\.(?:\s|$)|&\w+;|)')
|
||||||
re_mxplink = re.compile(r'\|lc(.*?)\|lt(.*?)\|le', re.DOTALL)
|
re_mxplink = re.compile(r'\|lc(.*?)\|lt(.*?)\|le', re.DOTALL)
|
||||||
|
|
||||||
|
|
@ -291,11 +292,11 @@ class TextToHTMLparser(object):
|
||||||
cdict = match.groupdict()
|
cdict = match.groupdict()
|
||||||
if cdict['htmlchars']:
|
if cdict['htmlchars']:
|
||||||
return cgi.escape(cdict['htmlchars'])
|
return cgi.escape(cdict['htmlchars'])
|
||||||
if cdict['lineend']:
|
elif cdict['lineend']:
|
||||||
return '<br>'
|
return '<br>'
|
||||||
elif cdict['space'] == '\t':
|
elif cdict['space'] == '\t':
|
||||||
return ' ' * self.tabstop
|
return ' ' * self.tabstop
|
||||||
elif cdict['space'] or cdict["spacestart"]:
|
elif cdict['space'] or cdict["spacestart"] or cdict['firstspace']:
|
||||||
text = match.group().replace('\t', ' ' * self.tabstop)
|
text = match.group().replace('\t', ' ' * self.tabstop)
|
||||||
text = text.replace(' ', ' ')
|
text = text.replace(' ', ' ')
|
||||||
return text
|
return text
|
||||||
|
|
@ -328,7 +329,7 @@ class TextToHTMLparser(object):
|
||||||
result = self.remove_backspaces(result)
|
result = self.remove_backspaces(result)
|
||||||
result = self.convert_urls(result)
|
result = self.convert_urls(result)
|
||||||
# clean out eventual ansi that was missed
|
# clean out eventual ansi that was missed
|
||||||
#result = parse_ansi(result, strip_ansi=True)
|
# result = parse_ansi(result, strip_ansi=True)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ body {
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
font-size: .9em;
|
font-size: .9em;
|
||||||
font-family: 'DejaVu Sans Mono', Consolas, Inconsolata, 'Lucida Console', monospace;
|
font-family: 'DejaVu Sans Mono', Consolas, Inconsolata, 'Lucida Console', monospace;
|
||||||
line-height: 1.1em;
|
line-height: 1.4em;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
@media screen and (max-width: 480px) {
|
@media screen and (max-width: 480px) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue