github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/tools/godoc/dl/tmpl.go (about)

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