5b6400f35b38710f63dae18fee99f3b41c8ae245
8 for line
in file('dygraph.js'):
11 elif '</JSON>' in line
:
16 # TODO(danvk): better errors here.
20 # Go through the tests and find uses of each option.
22 docs
[opt
]['tests'] = []
25 """Really primitive method to find text inside of {..} braces.
26 Doesn't work if there's an unmatched brace in a string, e.g. '{'. """
38 prop_re
= re
.compile(r
'\b([a-zA-Z]+):')
39 for test_file
in glob
.glob('tests/*.html'):
40 braced_html
= find_braces(file(test_file
).read())
41 ms
= re
.findall(prop_re
, braced_html
)
43 if opt
in docs
and test_file
not in docs
[opt
]['tests']:
44 docs
[opt
]['tests'].append(test_file
)
47 return f
.replace('tests/', '').replace('.html', '')
49 for opt_name
in sorted(docs
.keys()):
53 examples_html
= '<font color=red>NONE</font>'
55 examples_html
= ' '.join(
56 '<a href="%s">%s</a>' %
(f
, name(f
)) for f
in tests
)
59 <p><b>%(name)s</b><br/>
61 <i>Type: %(type)s<br/>
62 Default: %(default)s</i><br/>
63 Examples: %(examples_html)s<br/>
65 """ %
{ 'name': opt_name
,
67 'default': opt
['default'],
68 'desc': opt
['description'],
69 'examples_html': examples_html
}