mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-04-10 07:03:35 +02:00
Moved entity_to_unicode function to utils.entities module.
This commit is contained in:
@@ -21,7 +21,6 @@ import math
|
||||
import bs4
|
||||
from PIL import Image as PILImage
|
||||
|
||||
from ebook_converter import entity_to_unicode
|
||||
from ebook_converter.constants_old import __appname__, filesystem_encoding, \
|
||||
preferred_encoding
|
||||
from ebook_converter.devices.interface import DevicePlugin as Device
|
||||
@@ -39,6 +38,7 @@ from ebook_converter.ebooks.lrf.pylrs.pylrs import (
|
||||
from ebook_converter.ptempfile import PersistentTemporaryFile
|
||||
from ebook_converter.utils import encoding as uenc
|
||||
from ebook_converter.utils import img as uimg
|
||||
from ebook_converter.utils import entities
|
||||
|
||||
|
||||
def strip_style_comments(match):
|
||||
@@ -90,7 +90,7 @@ MARKUP_MASSAGE = [ # Close <a /> tags
|
||||
|
||||
# Replace entities
|
||||
(re.compile(r'&(\S+?);'),
|
||||
functools.partial(entity_to_unicode,
|
||||
functools.partial(entities.entity_to_unicode,
|
||||
exceptions=['lt', 'gt', 'amp', 'quot'])),
|
||||
|
||||
# Remove comments from within style tags as they can mess up
|
||||
|
||||
@@ -6,8 +6,9 @@ import struct
|
||||
import zlib
|
||||
|
||||
from ebook_converter.ebooks.lrf import LRFParseError, PRS500_PROFILE
|
||||
from ebook_converter import entity_to_unicode, prepare_string_for_xml
|
||||
from ebook_converter import prepare_string_for_xml
|
||||
from ebook_converter.ebooks.lrf.tags import Tag
|
||||
from ebook_converter.utils import entities
|
||||
|
||||
ruby_tags = {0xF575: ['rubyAlignAndAdjust', 'W'],
|
||||
0xF576: ['rubyoverhang', 'W', {0: 'none', 1: 'auto'}],
|
||||
@@ -713,7 +714,8 @@ class Text(LRFStream):
|
||||
s = str(text, "utf-16-le")
|
||||
if s:
|
||||
s = s.translate(self.text_map)
|
||||
self.content.append(self.entity_pattern.sub(entity_to_unicode, s))
|
||||
self.content.append(self.entity_pattern
|
||||
.sub(entities.entity_to_unicode, s))
|
||||
|
||||
def end_container(self, tag, stream):
|
||||
self.content.append(None)
|
||||
|
||||
@@ -50,7 +50,7 @@ DEFAULT_SOURCE_ENCODING = "cp1252" # default is us-windows character set
|
||||
DEFAULT_GENREADING = "fs" # default is yes to both lrf and lrs
|
||||
|
||||
from ebook_converter.constants_old import __appname__, __version__
|
||||
from ebook_converter import entity_to_unicode
|
||||
from ebook_converter.utils import entities
|
||||
|
||||
|
||||
class LrsError(Exception):
|
||||
@@ -737,7 +737,8 @@ class TableOfContents(object):
|
||||
class TocLabel(object):
|
||||
|
||||
def __init__(self, label, textBlock):
|
||||
self.label = escape(re.sub(r'&(\S+?);', entity_to_unicode, label))
|
||||
self.label = escape(re.sub(r'&(\S+?);', entities.entity_to_unicode,
|
||||
label))
|
||||
self.textBlock = textBlock
|
||||
|
||||
def toElement(self, se):
|
||||
|
||||
Reference in New Issue
Block a user