Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9344001

Browse files
committed
fixup! Google Code Issue 157: Add "escape invisible characters" option
1 parentf4f1fb8 commit9344001

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

‎html5lib/serializer/htmlserializer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def __init__(self, **kwargs):
167167
defencode(self,string):
168168
assert(isinstance(string,text_type))
169169
ifself.escape_invisible:
170-
text=utils.escapeInvisible(text,self.escape_invisible=='named')
170+
string=utils.escapeInvisible(string,self.escape_invisible=='named')
171171
ifself.encoding:
172172
returnstring.encode(self.encoding,unicode_encode_errors)
173173
else:

‎html5lib/utils.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
fromtypesimportModuleType
44

5+
fromsiximporttext_type
6+
57
from .constantsimportinvisibleChars
68

79

@@ -87,11 +89,11 @@ def escapeInvisible(text, useNamedEntities=False):
8789
iford(c)ininvisibleChars:
8890
escapable.add(c)
8991
ifuseNamedEntities:
92+
# for c in escapable:
93+
# name = codepoint2name.get(ord(c))
94+
# escape = "&%s;" % name if name else "&#x%X;" % ord(c)
95+
# text = text.replace(c, escape)
9096
raiseNotImplementedError("This doesn't work on Python 3")
91-
forcinescapable:
92-
name=codepoint2name.get(ord(c))
93-
escape="&%s;"%nameifnameelse"&#x%X;"%ord(c)
94-
text=text.replace(c,escape)
9597
else:
9698
forcinescapable:
9799
text=text.replace(c,"&#x%X;"%ord(c))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp