3 # Generates docs/download.html
5 # ./generate-download.py > docs/download.html
9 releases
= json
.load(file('releases.json'))
11 def file_links(release
):
12 v
= release
['version']
13 return ['<a href="%(v)s/%(f)s">%(f)s</a>' %
{
14 'f': f
, 'v': v
} for f
in release
['files']]
17 # Validation of releases.json
18 for idx
, release
in enumerate(releases
):
20 assert 'version' in release
, 'Release missing version: %s' % release
21 assert 'files' in release
, 'Release missing files: %s' % release
22 assert release
['version'] < releases
[idx
- 1]['version'], (
23 'Releases should be in reverse chronological order in releases.json')
25 current_html
= '<p>' + ('</p><p>'.join(file_links(releases
[0]))) + '</p>'
29 for release
in releases
[1:]:
30 previous_lis
.append('<li>%(v)s: %(files)s (<a href="%(v)s/">%(v)s docs</a>)' %
{
31 'v': release
['version'],
32 'files': ', '.join(file_links(release
))
37 <!--#include virtual="header.html" -->
40 DO NOT EDIT THIS FILE!
42 This file is generated by generate-download.py.
45 <script src="modernizr.custom.18445.js"></script>
46 <p>The current version of dygraphs is <b>%(version)s</b>. Most users will want to download minified files for this version:</p>
48 <div id="current-release" class="panel">
52 <p>For dev (non-minified) JS, see <a href="https://github.com/danvk/dygraphs/blob/master/dygraph-dev.js">dygraph-dev.js</a> on <a href="https://github.com/danvk/dygraphs/">github</a>.</a>
54 <p>To generate your own minified JS, run:</p>
56 <pre>git clone https://github.com/danvk/dygraphs.git
57 ./generate-combined.sh
60 <p>This will create a dygraph.min.js file in the dygraphs directory.</p>
62 <p>You may also download files for previously-released versions:</p>
68 <p>See <a href="/versions.html">Version History</a> for more information on each release.</p>
71 <!--#include virtual="footer.html" -->
73 'version': releases
[0]['version'],
74 'current_html': current_html
,
75 'previous_lis': '\n'.join(previous_lis
)