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>There's a hosted version of dygraphs on <a href="https://cdnjs.com/libraries/dygraph">cdnjs.com</a>:</p>
54 <pre><script src="//cdnjs.cloudflare.com/ajax/libs/dygraph/%(version)s/dygraph-combined.js"></script></pre>
56 <p>You can install dygraphs using <a href="https://www.npmjs.org/package/dygraphs">NPM</a> or <a href="http://bower.io/search/?q=dygraphs">Bower</a>.</p>
58 <p>To install using NPM:</p>
59 <pre>$ npm install dygraphs
60 # dygraphs is now in node_modules/dygraphs/dygraph-combined.js</pre>
62 <p>To install using bower:</p>
63 <pre>$ bower install dygraphs
64 # dygraphs is now in bower_components/dygraphs/dygraph-combined.js</pre>
66 <p>Most distributions include a source map. For non-concatenated 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>
68 <p>To generate your own minified JS, run:</p>
70 <pre>git clone https://github.com/danvk/dygraphs.git
71 ./generate-combined.sh
74 <p>This will create a dygraph.min.js file in the dygraphs directory.</p>
76 <p>You may also download files for previously-released versions:</p>
82 <p>See <a href="/versions.html">Version History</a> for more information on each release.</p>
85 <!--#include virtual="footer.html" -->
87 'version': releases
[0]['version'],
88 'current_html': current_html
,
89 'previous_lis': '\n'.join(previous_lis
)