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

Commitf61e328

Browse files
mikewestgsnedders
authored andcommitted
Fix warnings xgettext gives in html5lib.
This is relatively trivially resolved by changing the bare `%s`,`%r`, etc. into named substitutions.
1 parent9f42786 commitf61e328

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

‎html5lib/filters/lint.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,24 @@ def __iter__(self):
2323
iftypein ("StartTag","EmptyTag"):
2424
name=token["name"]
2525
ifcontentModelFlag!="PCDATA":
26-
raiseLintError(_("StartTag not in PCDATA content model flag: %s")%name)
26+
raiseLintError(_("StartTag not in PCDATA content model flag: %(tag)s")%{"tag":name})
2727
ifnotisinstance(name,str):
28-
raiseLintError(_("Tag name is not a string: %r")%name)
28+
raiseLintError(_("Tag name is not a string: %(tag)r")%{"tag":name})
2929
ifnotname:
3030
raiseLintError(_("Empty tag name"))
3131
iftype=="StartTag"andnameinvoidElements:
32-
raiseLintError(_("Void element reported as StartTag token: %s")%name)
32+
raiseLintError(_("Void element reported as StartTag token: %(tag)s")%{"tag":name})
3333
eliftype=="EmptyTag"andnamenotinvoidElements:
34-
raiseLintError(_("Non-void element reported as EmptyTag token: %s")%token["name"])
34+
raiseLintError(_("Non-void element reported as EmptyTag token: %(tag)s")%{"tag":token["name"]})
3535
iftype=="StartTag":
3636
open_elements.append(name)
3737
forname,valueintoken["data"]:
3838
ifnotisinstance(name,str):
39-
raiseLintError(_("Attribute name is not a string: %r")%name)
39+
raiseLintError(_("Attribute name is not a string: %(name)r")%{"name":name})
4040
ifnotname:
4141
raiseLintError(_("Empty attribute name"))
4242
ifnotisinstance(value,str):
43-
raiseLintError(_("Attribute value is not a string: %r")%value)
43+
raiseLintError(_("Attribute value is not a string: %(value)r")%{"value":value})
4444
ifnameincdataElements:
4545
contentModelFlag="CDATA"
4646
elifnameinrcdataElements:
@@ -51,14 +51,14 @@ def __iter__(self):
5151
eliftype=="EndTag":
5252
name=token["name"]
5353
ifnotisinstance(name,str):
54-
raiseLintError(_("Tag name is not a string: %r")%name)
54+
raiseLintError(_("Tag name is not a string: %(tag)r")%{"tag":name})
5555
ifnotname:
5656
raiseLintError(_("Empty tag name"))
5757
ifnameinvoidElements:
58-
raiseLintError(_("Void element reported as EndTag token: %s")%name)
58+
raiseLintError(_("Void element reported as EndTag token: %(tag)s")%{"tag":name})
5959
start_name=open_elements.pop()
6060
ifstart_name!=name:
61-
raiseLintError(_("EndTag (%s) does not match StartTag (%s)")%(name,start_name))
61+
raiseLintError(_("EndTag (%(end)s) does not match StartTag (%(start)s)")%{"end":name,"start":start_name})
6262
contentModelFlag="PCDATA"
6363

6464
eliftype=="Comment":
@@ -68,26 +68,26 @@ def __iter__(self):
6868
eliftypein ("Characters","SpaceCharacters"):
6969
data=token["data"]
7070
ifnotisinstance(data,str):
71-
raiseLintError(_("Attribute name is not a string: %r")%data)
71+
raiseLintError(_("Attribute name is not a string: %(name)r")%{"name":data})
7272
ifnotdata:
73-
raiseLintError(_("%s token with empty data")%type)
73+
raiseLintError(_("%(type)s token with empty data")%{"type":type})
7474
iftype=="SpaceCharacters":
7575
data=data.strip(spaceCharacters)
7676
ifdata:
77-
raiseLintError(_("Non-space character(s) found in SpaceCharacters token: ")%data)
77+
raiseLintError(_("Non-space character(s) found in SpaceCharacters token:%(token)r")%{"token":data})
7878

7979
eliftype=="Doctype":
8080
name=token["name"]
8181
ifcontentModelFlag!="PCDATA":
82-
raiseLintError(_("Doctype not in PCDATA content model flag: %s")%name)
82+
raiseLintError(_("Doctype not in PCDATA content model flag: %(name)s")%{"name":name})
8383
ifnotisinstance(name,str):
84-
raiseLintError(_("Tag name is not a string: %r")%name)
84+
raiseLintError(_("Tag name is not a string: %(tag)r")%{"tag":name})
8585
# XXX: what to do with token["data"] ?
8686

8787
eliftypein ("ParseError","SerializeError"):
8888
pass
8989

9090
else:
91-
raiseLintError(_("Unknown token type: %s")%type)
91+
raiseLintError(_("Unknown token type: %(type)s")%{"type":type})
9292

9393
yieldtoken

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp