mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
LRF Input: Handle ampersands and other XML reserved characters correctly when converting LRF documents. Fixes #4923 (Ampersands in input text get lost in output)
This commit is contained in:
parent
c2f655ad71
commit
f4bbf10ee3
@ -3,7 +3,7 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
|||||||
import struct, array, zlib, cStringIO, collections, re
|
import struct, array, zlib, cStringIO, collections, re
|
||||||
|
|
||||||
from calibre.ebooks.lrf import LRFParseError, PRS500_PROFILE
|
from calibre.ebooks.lrf import LRFParseError, PRS500_PROFILE
|
||||||
from calibre import entity_to_unicode
|
from calibre import entity_to_unicode, prepare_string_for_xml
|
||||||
from calibre.ebooks.lrf.tags import Tag
|
from calibre.ebooks.lrf.tags import Tag
|
||||||
|
|
||||||
ruby_tags = {
|
ruby_tags = {
|
||||||
@ -870,7 +870,7 @@ class Text(LRFStream):
|
|||||||
open_containers = collections.deque()
|
open_containers = collections.deque()
|
||||||
for c in self.content:
|
for c in self.content:
|
||||||
if isinstance(c, basestring):
|
if isinstance(c, basestring):
|
||||||
s += c
|
s += prepare_string_for_xml(c)
|
||||||
elif c is None:
|
elif c is None:
|
||||||
if open_containers:
|
if open_containers:
|
||||||
p = open_containers.pop()
|
p = open_containers.pop()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user