diff options
author | Alex Merry <dev@randomguy3.me.uk> | 2011-08-14 12:38:18 +0100 |
---|---|---|
committer | Alex Merry <dev@randomguy3.me.uk> | 2011-08-14 12:38:18 +0100 |
commit | 5fc31cba870c1a0d8924638089b71a42278a1c6a (patch) | |
tree | 4c63c02812266f0c77ac3c6f84ba65b4efaad01d | |
parent | 8badc1d8fcaa46937585be6284b051444465d2ec (diff) |
Import tooling fixes from telepathy-spec
-rw-r--r-- | doc/templates/index.html | 2 | ||||
-rw-r--r-- | doc/templates/interface.html | 2 | ||||
-rw-r--r-- | doc/templates/interfaces.html | 2 | ||||
-rw-r--r-- | tools/specparser.py | 31 |
4 files changed, 34 insertions, 3 deletions
diff --git a/doc/templates/index.html b/doc/templates/index.html index 6b9b62f..a47070e 100644 --- a/doc/templates/index.html +++ b/doc/templates/index.html @@ -2,7 +2,7 @@ <!DOCTYPE html PUBLIC "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" ""> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> - <title>$spec.title &mdash v$spec.version</title> + <title>$spec.title — v$spec.version</title> <link rel="stylesheet" href="style.css" type="text/css"/> </head> <body> diff --git a/doc/templates/interface.html b/doc/templates/interface.html index a736478..c6b6062 100644 --- a/doc/templates/interface.html +++ b/doc/templates/interface.html @@ -440,7 +440,7 @@ <div class="annotation connection-parameter"> <p><span class='note'>Note:</span> Connections implementing this property SHOULD provide a corresponding parameter named - <tt>$interface.name</tt> with the <a + <tt>$property.name</tt> with the <a href="Connection_Manager.html#Conn_Mgr_Param_Flags">DBus_Property</a> flag. Clients SHOULD update this property by calling <a diff --git a/doc/templates/interfaces.html b/doc/templates/interfaces.html index 85504d7..acf110c 100644 --- a/doc/templates/interfaces.html +++ b/doc/templates/interfaces.html @@ -2,7 +2,7 @@ <!DOCTYPE html PUBLIC "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" ""> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> - <title>$spec.title &mdash v$spec.version</title> + <title>$spec.title — v$spec.version</title> <link rel="stylesheet" href="style.css" type="text/css"/> </head> <body> diff --git a/tools/specparser.py b/tools/specparser.py index 697d4af..d680896 100644 --- a/tools/specparser.py +++ b/tools/specparser.py @@ -305,6 +305,37 @@ class Base(object): n.namespaceURI = None n.setAttribute('href', t.get_url()) + # rewrite <tp:value-ref> + for n in node.getElementsByTagNameNS(XMLNS_TP, 'value-ref'): + if n.hasAttribute('type'): + type_name = n.getAttribute('type') + value_name = getText(n) + t = spec.lookup_type(type_name) + assert isinstance(t, EnumLike), ("%s is not an enum or flags type" + % type_name) + else: + type_name = getText(n) + value_name_parts = [] + while type_name not in spec.types: + type_name, _, rest = type_name.rpartition('_') + value_name_parts.insert(0, rest) + if not type_name: + raise ValueError("No substrings of '%s' describe " + "a valid type." % getText(n)) + value_name = '_'.join(value_name_parts) + t = spec.lookup_type(type_name) + assert isinstance(t, EnumLike), ("%s is not an enum or flags type" + % type_name) + + n.tagName = 'a' + n.namespaceURI = None + n.setAttribute('href', t.get_url()) + short_names = [val.short_name for val in t.values] + if value_name not in short_names: + raise ValueError("'%s' is not a valid value of '%s'. " + "Valid values are %s" % + (value_name, type_name, short_names)) + # rewrite <tp:error-ref> error_ns = spec.spec_namespace + '.Error.' for n in node.getElementsByTagNameNS(XMLNS_TP, 'error-ref'): |