You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

279 lines
7.8 KiB

  1. // Copyright 2015 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. // +build appengine
  5. package dl
  6. // TODO(adg): refactor this to use the tools/godoc/static template.
  7. const templateHTML = `
  8. {{define "root"}}
  9. <!DOCTYPE html>
  10. <html>
  11. <head>
  12. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  13. <title>Downloads - The Go Programming Language</title>
  14. <link type="text/css" rel="stylesheet" href="/lib/godoc/style.css">
  15. <script type="text/javascript">window.initFuncs = [];</script>
  16. <style>
  17. table.codetable {
  18. margin-left: 20px; margin-right: 20px;
  19. border-collapse: collapse;
  20. }
  21. table.codetable tr {
  22. background-color: #f0f0f0;
  23. }
  24. table.codetable tr:nth-child(2n), table.codetable tr.first {
  25. background-color: white;
  26. }
  27. table.codetable td, table.codetable th {
  28. white-space: nowrap;
  29. padding: 6px 10px;
  30. }
  31. table.codetable tt {
  32. font-size: xx-small;
  33. }
  34. table.codetable tr.highlight td {
  35. font-weight: bold;
  36. }
  37. a.downloadBox {
  38. display: block;
  39. color: #222;
  40. border: 1px solid #375EAB;
  41. border-radius: 5px;
  42. background: #E0EBF5;
  43. width: 280px;
  44. float: left;
  45. margin-left: 10px;
  46. margin-bottom: 10px;
  47. padding: 10px;
  48. }
  49. a.downloadBox:hover {
  50. text-decoration: none;
  51. }
  52. .downloadBox .platform {
  53. font-size: large;
  54. }
  55. .downloadBox .filename {
  56. color: #375EAB;
  57. font-weight: bold;
  58. line-height: 1.5em;
  59. }
  60. a.downloadBox:hover .filename {
  61. text-decoration: underline;
  62. }
  63. .downloadBox .size {
  64. font-size: small;
  65. font-weight: normal;
  66. }
  67. .downloadBox .reqs {
  68. font-size: small;
  69. font-style: italic;
  70. }
  71. .downloadBox .checksum {
  72. font-size: 5pt;
  73. }
  74. </style>
  75. </head>
  76. <body>
  77. <div id="topbar"><div class="container">
  78. <div class="top-heading"><a href="/">The Go Programming Language</a></div>
  79. <form method="GET" action="/search">
  80. <div id="menu">
  81. <a href="/doc/">Documents</a>
  82. <a href="/pkg/">Packages</a>
  83. <a href="/project/">The Project</a>
  84. <a href="/help/">Help</a>
  85. <a href="/blog/">Blog</a>
  86. <span class="search-box"><input type="search" id="search" name="q" placeholder="Search" aria-label="Search" required><button type="submit"><span><!-- magnifying glass: --><svg width="24" height="24" viewBox="0 0 24 24"><title>submit search</title><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/><path d="M0 0h24v24H0z" fill="none"/></svg></span></button></span>
  87. </div>
  88. </form>
  89. </div></div>
  90. <div id="page">
  91. <div class="container">
  92. <h1>Downloads</h1>
  93. <p>
  94. After downloading a binary release suitable for your system,
  95. please follow the <a href="/doc/install">installation instructions</a>.
  96. </p>
  97. <p>
  98. If you are building from source,
  99. follow the <a href="/doc/install/source">source installation instructions</a>.
  100. </p>
  101. <p>
  102. See the <a href="/doc/devel/release.html">release history</a> for more
  103. information about Go releases.
  104. </p>
  105. {{with .Featured}}
  106. <h3 id="featured">Featured downloads</h3>
  107. {{range .}}
  108. {{template "download" .}}
  109. {{end}}
  110. {{end}}
  111. <div style="clear: both;"></div>
  112. {{with .Stable}}
  113. <h3 id="stable">Stable versions</h3>
  114. {{template "releases" .}}
  115. {{end}}
  116. {{with .Unstable}}
  117. <h3 id="unstable">Unstable version</h3>
  118. {{template "releases" .}}
  119. {{end}}
  120. {{with .Archive}}
  121. <div class="toggle" id="archive">
  122. <div class="collapsed">
  123. <h3 class="toggleButton" title="Click to show versions">Archived versions</h3>
  124. </div>
  125. <div class="expanded">
  126. <h3 class="toggleButton" title="Click to hide versions">Archived versions</h3>
  127. {{template "releases" .}}
  128. </div>
  129. </div>
  130. {{end}}
  131. <div id="footer">
  132. <p>
  133. Except as
  134. <a href="https://developers.google.com/site-policies#restrictions">noted</a>,
  135. the content of this page is licensed under the Creative Commons
  136. Attribution 3.0 License,<br>
  137. and code is licensed under a <a href="http://golang.org/LICENSE">BSD license</a>.<br>
  138. <a href="http://golang.org/doc/tos.html">Terms of Service</a> |
  139. <a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a>
  140. </p>
  141. </div><!-- #footer -->
  142. </div><!-- .container -->
  143. </div><!-- #page -->
  144. <script>
  145. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  146. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  147. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  148. })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  149. ga('create', 'UA-11222381-2', 'auto');
  150. ga('send', 'pageview');
  151. </script>
  152. </body>
  153. <script src="/lib/godoc/jquery.js"></script>
  154. <script src="/lib/godoc/godocs.js"></script>
  155. <script>
  156. $(document).ready(function() {
  157. $('a.download').click(function(e) {
  158. // Try using the link text as the file name,
  159. // unless there's a child element of class 'filename'.
  160. var filename = $(this).text();
  161. var child = $(this).find('.filename');
  162. if (child.length > 0) {
  163. filename = child.text();
  164. }
  165. // This must be kept in sync with the filenameRE in godocs.js.
  166. var filenameRE = /^go1\.\d+(\.\d+)?([a-z0-9]+)?\.([a-z0-9]+)(-[a-z0-9]+)?(-osx10\.[68])?\.([a-z.]+)$/;
  167. var m = filenameRE.exec(filename);
  168. if (!m) {
  169. // Don't redirect to the download page if it won't recognize this file.
  170. // (Should not happen.)
  171. return;
  172. }
  173. var dest = "/doc/install";
  174. if (filename.indexOf(".src.") != -1) {
  175. dest += "/source";
  176. }
  177. dest += "?download=" + filename;
  178. e.preventDefault();
  179. e.stopPropagation();
  180. window.location = dest;
  181. });
  182. });
  183. </script>
  184. </html>
  185. {{end}}
  186. {{define "releases"}}
  187. {{range .}}
  188. <div class="toggle{{if .Visible}}Visible{{end}}" id="{{.Version}}">
  189. <div class="collapsed">
  190. <h2 class="toggleButton" title="Click to show downloads for this version">{{.Version}} </h2>
  191. </div>
  192. <div class="expanded">
  193. <h2 class="toggleButton" title="Click to hide downloads for this version">{{.Version}} </h2>
  194. {{if .Stable}}{{else}}
  195. <p>This is an <b>unstable</b> version of Go. Use with caution.</p>
  196. <p>If you already have Go installed, you can install this version by running:</p>
  197. <pre>
  198. go get golang.org/x/build/version/{{.Version}}
  199. </pre>
  200. <p>Then, use the <code>{{.Version}}</code> command instead of the <code>go</code> command to use {{.Version}}.</p>
  201. {{end}}
  202. {{template "files" .}}
  203. </div>
  204. </div>
  205. {{end}}
  206. {{end}}
  207. {{define "files"}}
  208. <table class="codetable">
  209. <thead>
  210. <tr class="first">
  211. <th>File name</th>
  212. <th>Kind</th>
  213. <th>OS</th>
  214. <th>Arch</th>
  215. <th>Size</th>
  216. {{/* Use the checksum type of the first file for the column heading. */}}
  217. <th>{{(index .Files 0).ChecksumType}} Checksum</th>
  218. </tr>
  219. </thead>
  220. {{if .SplitPortTable}}
  221. {{range .Files}}{{if .PrimaryPort}}{{template "file" .}}{{end}}{{end}}
  222. {{/* TODO(cbro): add a link to an explanatory doc page */}}
  223. <tr class="first"><th colspan="6" class="first">Other Ports</th></tr>
  224. {{range .Files}}{{if not .PrimaryPort}}{{template "file" .}}{{end}}{{end}}
  225. {{else}}
  226. {{range .Files}}{{template "file" .}}{{end}}
  227. {{end}}
  228. </table>
  229. {{end}}
  230. {{define "file"}}
  231. <tr{{if .Highlight}} class="highlight"{{end}}>
  232. <td class="filename"><a class="download" href="{{.URL}}">{{.Filename}}</a></td>
  233. <td>{{pretty .Kind}}</td>
  234. <td>{{.PrettyOS}}</td>
  235. <td>{{pretty .Arch}}</td>
  236. <td>{{.PrettySize}}</td>
  237. <td><tt>{{.PrettyChecksum}}</tt></td>
  238. </tr>
  239. {{end}}
  240. {{define "download"}}
  241. <a class="download downloadBox" href="{{.URL}}">
  242. <div class="platform">{{.Platform}}</div>
  243. {{with .Requirements}}<div class="reqs">{{.}}</div>{{end}}
  244. <div>
  245. <span class="filename">{{.Filename}}</span>
  246. {{if .Size}}<span class="size">({{.PrettySize}})</span>{{end}}
  247. </div>
  248. </a>
  249. {{end}}
  250. `