-
Notifications
You must be signed in to change notification settings - Fork 512
/
Copy pathversions.js
90 lines (81 loc) · 2.44 KB
/
versions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/**
* Copyright (c) 2019-present, Facebook, Inc.
*
* This source code is licensed under the BSD license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
const React = require('react');
const CompLibrary = require('../../core/CompLibrary');
const Container = CompLibrary.Container;
const CWD = process.cwd();
const versions = require(`${CWD}/_versions.json`);
versions.sort().reverse();
function Versions(props) {
const {config: siteConfig} = props;
const baseUrl = siteConfig.baseUrl;
const latestVersion = versions[0];
return (
<div className="docMainWrapper wrapper">
<Container className="mainContainer versionsContainer">
<div className="post">
<header className="postHeader">
<h1>{siteConfig.title} Versions</h1>
</header>
<table className="versions">
<tbody>
<tr>
<th>Version</th>
<th>Install with</th>
<th>Documentation</th>
</tr>
<tr>
<td>{`stable (${latestVersion})`}</td>
<td>
<code>conda install -c pytorch captum</code>
</td>
<td>
<a href={`${baseUrl}index.html`}>stable</a>
</td>
</tr>
<tr>
<td>
{'latest'}
{' (master)'}
</td>
<td>
<code>
pip install git+ssh://git@github.com/pytorch/captum.git
</code>
</td>
<td>
<a href={`${baseUrl}versions/latest/index.html`}>latest</a>
</td>
</tr>
</tbody>
</table>
<h3 id="archive">Past Versions</h3>
<table className="versions">
<tbody>
{versions.map(
version =>
version !== latestVersion && (
<tr key={version}>
<th>{version}</th>
<td>
<a href={`${baseUrl}versions/${version}/index.html`}>
Documentation
</a>
</td>
</tr>
),
)}
</tbody>
</table>
</div>
</Container>
</div>
);
}
module.exports = Versions;