...

Text file src/golang.org/x/tools/cmd/present/templates/article.tmpl

Documentation: golang.org/x/tools/cmd/present/templates

     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          {{if .Authors}}
    35            {{range .Authors}}
    36              <div class="author">
    37                {{range .Elem}}{{elem $.Template .}}{{end}}
    38              </div>
    39            {{end}}
    40          {{end}}
    41        </div>
    42      </div>
    43    </div>
    44    <div id="page" class="wide">
    45      <div class="container">
    46        {{with .Sections}}
    47          <div id="toc" class="no-print">
    48            <div id="tochead">Contents</div>
    49            {{template "TOC" .}}
    50          </div>
    51        {{end}}
    52
    53        {{range .Sections}}
    54          {{elem $.Template .}}
    55        {{end}}{{/* of Section block */}}
    56
    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 class="toc-outer">
    80  {{range .}}
    81    <li><a href="#TOC_{{.FormattedNumber}}">{{.Title}}</a></li>
    82    {{with .Sections}}{{template "TOC-Inner" .}}{{end}}
    83  {{end}}
    84  </ul>
    85{{end}}
    86
    87{{define "TOC-Inner"}}
    88  <ul class="toc-inner">
    89  {{range .}}
    90    <li><a href="#TOC_{{.FormattedNumber}}">{{.Title}}</a></li>
    91    {{with .Sections}}{{template "TOC-Inner" .}}{{end}}
    92  {{end}}
    93  </ul>
    94{{end}}
    95
    96{{define "newline"}}
    97{{/* No automatic line break. Paragraphs are free-form. */}}
    98{{end}}

View as plain text