Update libhtml.py to handle html5 and make html5 the default -- extra stuff
svn: r18642
This commit is contained in:
parent
78e3584aec
commit
11a7aa2e8e
@ -60,6 +60,8 @@ __all__ = ['Html']
|
|||||||
#
|
#
|
||||||
# XHTML DOCTYPE constants to be used in <!DOCTYPE ... > statements
|
# XHTML DOCTYPE constants to be used in <!DOCTYPE ... > statements
|
||||||
#
|
#
|
||||||
|
# Reference: http://www.w3.org/QA/2002/04/valid-dtd-list.html
|
||||||
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
|
|
||||||
_XHTML10_STRICT = '"-//W3C//DTD XHTML 1.0 Strict//EN"\n' \
|
_XHTML10_STRICT = '"-//W3C//DTD XHTML 1.0 Strict//EN"\n' \
|
||||||
@ -427,8 +429,8 @@ class Html(list):
|
|||||||
)
|
)
|
||||||
self[0:0] = [xmldecl]
|
self[0:0] = [xmldecl]
|
||||||
#
|
#
|
||||||
def addDOCTYPE(self, name='html', public='PUBLIC',
|
def addDOCTYPE(self, name='HTML', public='',
|
||||||
external_id=_XHTML10_STRICT, *args):
|
external_id=_HTML5, *args):
|
||||||
"""
|
"""
|
||||||
Add a DOCTYPE statement to the start of the list
|
Add a DOCTYPE statement to the start of the list
|
||||||
|
|
||||||
@ -441,12 +443,14 @@ class Html(list):
|
|||||||
:param args: 0 or more positional parameters to be added to this
|
:param args: 0 or more positional parameters to be added to this
|
||||||
DOCTYPE.
|
DOCTYPE.
|
||||||
"""
|
"""
|
||||||
doctype = '<!DOCTYPE %s %s %s%s>' % (
|
doctype = (
|
||||||
|
'<!DOCTYPE %s %s %s%s' % (
|
||||||
name,
|
name,
|
||||||
public,
|
public,
|
||||||
external_id,
|
external_id,
|
||||||
' %s'*len(args) % args
|
' %s'*len(args) % args
|
||||||
)
|
)
|
||||||
|
).rstrip() + '>'
|
||||||
# Note: DOCTYPE declaration must follow XML declaration
|
# Note: DOCTYPE declaration must follow XML declaration
|
||||||
|
|
||||||
if len(self) and self[0][:6] == '<?xml ':
|
if len(self) and self[0][:6] == '<?xml ':
|
||||||
|
Loading…
Reference in New Issue
Block a user