Merge pull request #1615 from ableeker/python3

Python 3 fix
This commit is contained in:
Apprentice Harper 2021-04-11 15:09:39 +01:00 committed by GitHub
commit aa41bba68c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -559,7 +559,7 @@ class DocParser(object):
if (link > 0): if (link > 0):
linktype = self.link_type[link-1] linktype = self.link_type[link-1]
title = self.link_title[link-1] title = self.link_title[link-1]
title = title.rstrip(b'. ') title = title.rstrip(b'. ').decode('utf-8')
alt_title = parares[lstart:] alt_title = parares[lstart:]
alt_title = alt_title.strip() alt_title = alt_title.strip()
# now strip off the actual printed page number # now strip off the actual printed page number
@ -770,10 +770,10 @@ class DocParser(object):
first_para_continued = False first_para_continued = False
(pclass, pdesc) = self.getParaDescription(start,end, regtype) (pclass, pdesc) = self.getParaDescription(start,end, regtype)
if not pclass: if not pclass:
if orig_regtype.endswith(b'.right') : pclass = 'cl-right' if orig_regtype.endswith(b'.right') : pclass = b'cl-right'
elif orig_regtype.endswith(b'.center') : pclass = 'cl-center' elif orig_regtype.endswith(b'.center') : pclass = b'cl-center'
elif orig_regtype.endswith(b'.left') : pclass = 'cl-left' elif orig_regtype.endswith(b'.left') : pclass = b'cl-left'
elif orig_regtype.endswith(b'.justify') : pclass = 'cl-justify' elif orig_regtype.endswith(b'.justify') : pclass = b'cl-justify'
if pclass and (ptype == 'full') and (len(pclass) >= 6): if pclass and (ptype == 'full') and (len(pclass) >= 6):
tag = 'p' tag = 'p'
if pclass[3:6] == b'h1-' : tag = 'h4' if pclass[3:6] == b'h1-' : tag = 'h4'

View file

@ -191,7 +191,7 @@ def unescape(text):
else: else:
# named entity # named entity
try: try:
text = chr(htmlentitydefs.name2codepoint[text[1:-1]]) text = chr(html.entities.name2codepoint[text[1:-1]])
except KeyError: except KeyError:
pass pass
return text # leave as is return text # leave as is