summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Merry <dev@randomguy3.me.uk>2011-08-14 12:38:18 +0100
committerAlex Merry <dev@randomguy3.me.uk>2011-08-14 12:38:18 +0100
commit5fc31cba870c1a0d8924638089b71a42278a1c6a (patch)
tree4c63c02812266f0c77ac3c6f84ba65b4efaad01d
parent8badc1d8fcaa46937585be6284b051444465d2ec (diff)
Import tooling fixes from telepathy-spec
-rw-r--r--doc/templates/index.html2
-rw-r--r--doc/templates/interface.html2
-rw-r--r--doc/templates/interfaces.html2
-rw-r--r--tools/specparser.py31
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 &mdash; 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 &mdash; 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'):