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

Commit6cb006a

Browse files
committed
Make sure lxml unesacpes xml names properly
1 parent1442bad commit6cb006a

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

‎src/html5lib/ihatexml.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,14 @@ def listToRegexpStr(charList):
7272
rv= []
7373
foritemincharList:
7474
ifitem[0]==item[1]:
75-
rv.append(intToUnicodeStr(item[0]))
75+
rv.append(unichar(item[0]))
7676
else:
77-
rv.append(intToUnicodeStr(item[0])+"-"+intToUnicodeStr(item[1]))
78-
return"[%s]"%"|".join(rv)
77+
rv.append(unichar(item[0])+"-"+unichar(item[1]))
78+
return"[%s]"%"".join(rv)
7979

8080
defhexToInt(hex_str):
8181
returnint(hex_str,16)
8282

83-
defintToUnicodeStr(intValue):
84-
#There must be a better (non-evil) way to do this
85-
returnescapeRegexp(eval(r"u'\u%s'"%hex(intValue)[2:].rjust(4,"0")))
86-
8783
defescapeRegexp(string):
8884
specialCharacters= (".","^","$","*","+","?","{","}",
8985
"[","]","|","(",")","-")

‎src/html5lib/treebuilders/etree_lxml.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,12 @@ def __init__(self, name, namespace):
203203
self._attributes=Attributes(self)
204204

205205
def_setName(self,name):
206-
self._name=filter.coerceElement(name)
206+
self._name=filter.coerceElement(name)
207207
self._element.tag=self._getETreeTag(
208208
self._name,self._namespace)
209209

210210
def_getName(self):
211-
returnself._name
211+
returnfilter.fromXmlName(self._name)
212212

213213
name=property(_getName,_setName)
214214

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp