github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/tools/cmd/present/templates/article.tmpl (about)

     1  {/* This is the article template. It defines how articles are formatted. */}
     2  
     3  {{define "root"}}
     4  <!DOCTYPE html>
     5  <html>
     6    <head>
     7      <title>{{.Title}}</title>
     8      <link type="text/css" rel="stylesheet" href="/static/article.css">
     9      <meta charset='utf-8'>
    10      <script>
    11        // Initialize Google Analytics tracking code on production site only.
    12        if (window["location"] && window["location"]["hostname"] == "talks.golang.org") {
    13          var _gaq = _gaq || [];
    14          _gaq.push(["_setAccount", "UA-11222381-6"]);
    15          _gaq.push(["b._setAccount", "UA-49880327-6"]);
    16          window.trackPageview = function() {
    17            _gaq.push(["_trackPageview", location.pathname+location.hash]);
    18            _gaq.push(["b._trackPageview", location.pathname+location.hash]);
    19          };
    20          window.trackPageview();
    21          window.trackEvent = function(category, action, opt_label, opt_value, opt_noninteraction) {
    22            _gaq.push(["_trackEvent", category, action, opt_label, opt_value, opt_noninteraction]);
    23            _gaq.push(["b._trackEvent", category, action, opt_label, opt_value, opt_noninteraction]);
    24          };
    25        }
    26      </script>
    27    </head>
    28  
    29    <body>
    30      <div id="topbar" class="wide">
    31        <div class="container">
    32          <div id="heading">{{.Title}}
    33            {{with .Subtitle}}{{.}}{{end}}
    34          </div>
    35        </div>
    36      </div>
    37      <div id="page" class="wide">
    38        <div class="container">
    39          {{with .Sections}}
    40            <div id="toc">
    41              {{template "TOC" .}}
    42            </div>
    43          {{end}}
    44  
    45          {{range .Sections}}
    46            {{elem $.Template .}}
    47          {{end}}{{/* of Section block */}}
    48  
    49          {{if .Authors}}
    50            <h2>Authors</h2>
    51            {{range .Authors}}
    52              <div class="author">
    53                {{range .Elem}}{{elem $.Template .}}{{end}}
    54              </div>
    55            {{end}}
    56          {{end}}
    57        </div>
    58      </div>
    59  
    60      {{if .PlayEnabled}}
    61      <script src='/play.js'></script>
    62      {{end}}
    63  
    64      <script>
    65        (function() {
    66          // Load Google Analytics tracking code on production site only.
    67          if (window["location"] && window["location"]["hostname"] == "talks.golang.org") {
    68            var ga = document.createElement("script"); ga.type = "text/javascript"; ga.async = true;
    69            ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";
    70            var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s);
    71          }
    72        })();
    73      </script>
    74    </body>
    75  </html>
    76  {{end}}
    77  
    78  {{define "TOC"}}
    79    <ul>
    80    {{range .}}
    81      <li><a href="#TOC_{{.FormattedNumber}}">{{.Title}}</a></li>
    82      {{with .Sections}}{{template "TOC" .}}{{end}}
    83    {{end}}
    84    </ul>
    85  {{end}}
    86  
    87  {{define "newline"}}
    88  {{/* No automatic line break. Paragraphs are free-form. */}}
    89  {{end}}