Skip to content

Commit

Permalink
fixes #530 pull out the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Sep 9, 2017
1 parent 3cca134 commit 9eb7e58
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
12 changes: 12 additions & 0 deletions utils/dev_units2rst.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env python

'''
Developers: use this code to develop and test nxdl2rst.py
'''

import sys
from units2rst import worker


sys.argv.append("../nxdlTypes.xsd")
worker('anyUnitsAttr')
10 changes: 9 additions & 1 deletion utils/units2rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,15 @@ def worker(nodeMatchString, section = 'units'):
node_name = node.get('name')
if 'nxdl:' + node_name in members:
words = node.xpath('xs:annotation/xs:documentation', namespaces=ns)[0]
db[node_name] = words.text
examples = []
for example in words.iterchildren():
nm = example.attrib.get("name")
if nm is not None and nm == "example":
examples.append("``"+example.text+"``")
a = words.text
if len(examples) > 0:
a = a.strip() + " -- example(s): " + " | ".join(examples)
db[node_name] = a

# for item in node.xpath('xs:restriction//xs:enumeration', namespaces=ns):
# key = '%s' % item.get('value')
Expand Down

0 comments on commit 9eb7e58

Please sign in to comment.