diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-13 19:40:29 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2011-02-13 19:40:29 -0500 |
commit | 09c9ca430e49449cc39cbeb7556230cb62df9b19 (patch) | |
tree | bf94e18ac8887851dcf84cb5140aa453a1b74316 /beautifulsoup/element.py | |
parent | 4191d5ff45015c6fac1db0bbdd7b3fcaff234424 (diff) |
Added tests for namespaced doctypes.
Diffstat (limited to 'beautifulsoup/element.py')
-rw-r--r-- | beautifulsoup/element.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/beautifulsoup/element.py b/beautifulsoup/element.py index b2e0e12..8749114 100644 --- a/beautifulsoup/element.py +++ b/beautifulsoup/element.py @@ -372,6 +372,16 @@ class Declaration(NavigableString): class Doctype(NavigableString): + @classmethod + def for_name_and_ids(cls, name, pub_id, system_id): + value = name + if pub_id is not None: + value += ' PUBLIC "%s"' % pub_id + if system_id is not None: + value += ' SYSTEM "%s"' % system_id + + return Doctype(value) + def decodeGivenEventualEncoding(self, eventualEncoding): return u'<!DOCTYPE ' + self + u'>' |