diff options
author | Adin Scannell <ascannell@google.com> | 2019-11-18 13:40:27 -0800 |
---|---|---|
committer | Adin Scannell <ascannell@google.com> | 2020-04-21 12:00:59 -0700 |
commit | 957e26a6f30d40e2bff042d76a327d0a2cfbabae (patch) | |
tree | 3e95d46355585ae4661de5cef30cdca72a7c94bb /layouts | |
parent | dc2f198866c5fd8162a79978eb3633975d3ba11f (diff) |
Move website to a simpler jekyll-based template
This will allow us to merge the site into the main repository.
This merge allows the documentation to be kept up-to-date and
synchronized with the main project. Builds will be triggered on any
update, removing the need for the cron-based reploy.
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/content.html | 13 | ||||
-rw-r--r-- | layouts/blog/baseof.html | 32 | ||||
-rw-r--r-- | layouts/blog/content.html | 14 | ||||
-rw-r--r-- | layouts/docs/list.html | 30 | ||||
-rw-r--r-- | layouts/partials/footer.html | 43 | ||||
-rw-r--r-- | layouts/partials/head.html | 25 | ||||
-rw-r--r-- | layouts/partials/navbar.html | 27 | ||||
-rw-r--r-- | layouts/partials/page-meta-links.html | 24 | ||||
-rw-r--r-- | layouts/partials/scripts.html | 23 | ||||
-rw-r--r-- | layouts/shortcodes/blocks/cover.html | 56 | ||||
-rw-r--r-- | layouts/shortcodes/blocks/feature.html | 10 | ||||
-rw-r--r-- | layouts/shortcodes/blocks/lead.html | 11 | ||||
-rw-r--r-- | layouts/shortcodes/blocks/section.html | 12 | ||||
-rw-r--r-- | layouts/shortcodes/graph.html | 203 | ||||
-rw-r--r-- | layouts/shortcodes/required_linux.html | 1 |
15 files changed, 0 insertions, 524 deletions
diff --git a/layouts/_default/content.html b/layouts/_default/content.html deleted file mode 100644 index 7db3f3405..000000000 --- a/layouts/_default/content.html +++ /dev/null @@ -1,13 +0,0 @@ -<div class="td-content"> - <h1>{{ .Title }}</h1> - {{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }} - {{ .Content }} - {{ if (and (not .Params.hide_feedback) (.Site.Params.ui.feedback.enable) (.Site.GoogleAnalytics)) }} - {{ partial "feedback.html" .Site.Params.ui.feedback }} - <br /> - {{ end }} - {{ if (.Site.DisqusShortname) }} - <br /> - {{ partial "disqus-comment.html" . }} - {{ end }} -</div> diff --git a/layouts/blog/baseof.html b/layouts/blog/baseof.html deleted file mode 100644 index 21af06116..000000000 --- a/layouts/blog/baseof.html +++ /dev/null @@ -1,32 +0,0 @@ -<!doctype html> -<html lang="{{ .Site.Language.Lang }}" class="no-js"> - <head> - {{ partial "head.html" . }} - <title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }}</title> - </head> - <body class="td-{{ .Kind }} td-blog"> - <header> - {{ partial "navbar.html" . }} - </header> - <div class="container-fluid td-outer"> - <div class="td-main"> - <div class="row flex-xl-nowrap"> - <div class="col-12 col-md-3 col-xl-2 td-sidebar d-print-none"> - {{ partial "sidebar.html" . }} - </div> - <div class="d-none d-xl-block col-xl-2 td-toc d-print-none"> </div> - <main class="col-12 col-md-9 col-xl-8 pl-md-5 pr-md-4" role="main"> - {{ with .CurrentSection.OutputFormats.Get "rss" -}} - <a class="btn btn-lg -bg-orange td-rss-button d-none d-lg-block" href="{{ .Permalink | safeURL }}" target="_blank"> - RSS <i class="fa fa-rss ml-2 "></i> - </a> - {{ end -}} - {{ block "main" . }}{{ end }} - </main> - </div> - </div> - {{ partial "footer.html" . }} - </div> - {{ partial "scripts.html" . }} - </body> -</html> diff --git a/layouts/blog/content.html b/layouts/blog/content.html deleted file mode 100644 index f3f89cb28..000000000 --- a/layouts/blog/content.html +++ /dev/null @@ -1,14 +0,0 @@ -<div class="td-content"> - <h1>{{ .Title }}</h1> - {{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }} - <div class="td-byline mb-4"> - {{ with .Params.author }}{{ T "post_byline_by" }} <b>{{ . | markdownify }}</b> |{{ end}} - <time datetime="{{ $.Date.Format "2006-01-02" }}" class="text-muted">{{ $.Date.Format $.Site.Params.time_format_blog }}</time> - </div> - {{ .Content }} - {{ if (.Site.DisqusShortname) }} - <br /> - {{ partial "disqus-comment.html" . }} - <br /> - {{ end }} -</div> diff --git a/layouts/docs/list.html b/layouts/docs/list.html deleted file mode 100644 index 4afc32653..000000000 --- a/layouts/docs/list.html +++ /dev/null @@ -1,30 +0,0 @@ -{{ define "title"}} {{ .Title}} {{end}} -{{ define "main" }} - -{{ if .Content }} -{{ .Render "content" }} -{{ else }} -<div id="hero" class="wrap td-content "> - <h1>{{ .Title }}</h1> - {{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }} -</div> - -<section id="pageContent"> - -{{ range .Sections.ByWeight }} - <li> - <a href="{{.Permalink}}">{{.Title}}</a> - </li> -{{ end }} - -{{ range .Paginator.Pages.ByWeight }} - <li> - <a href="{{.Permalink}}">{{.Title}}</a> - </li> -{{ end }} - -</section> - -{{ end }} - -{{ end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html deleted file mode 100644 index 0ad97db94..000000000 --- a/layouts/partials/footer.html +++ /dev/null @@ -1,43 +0,0 @@ -{{ $links := .Site.Params.links }} -<footer class="bg-dark py-5 row d-print-none"> - <div class="container-fluid mx-sm-5"> - <div class="row"> - <div class="col-6 col-sm-4 text-xs-center order-sm-2"> - {{ with $links }} - {{ with index . "user"}} - {{ template "footer-links-block" . }} - {{ end }} - {{ end }} - </div> - <div class="col-6 col-sm-4 text-right text-xs-center order-sm-3"> - {{ with $links }} - {{ with index . "developer"}} - <ul class="list-inline mb-0"> - {{ template "footer-links-block" . }} - {{ end }} - <li class="list-inline-item mx-2" > </li> - <li class="list-inline-item mx-2" > - <img src="/img/powered-gvisor.png" alt="Powered by gVisor"> - </li> - </ul> - {{ end }} - </div> - <div class="col-12 col-sm-4 text-center py-2 order-sm-2"> - {{ with .Site.Params.copyright }}<div><small class="text-white">© {{ now.Year}} {{ .}} {{ T "footer_all_rights_reserved" }}</small></div>{{ end }} - {{ with .Site.Params.privacy_policy }}<div><small class="ml-1"><a href="{{ . }}">{{ T "footer_privacy_policy" }}</a></small></div>{{ end }} - {{ if not .Site.Params.ui.footer_about_disable }} - {{ with .Site.GetPage "about" }}<p class="mt-2"><a href="{{ .RelPermalink }}">{{ .Title }}</a></p>{{ end }} - {{ end }} - </div> - </div> - </div> -</footer> -{{ define "footer-links-block" }} - {{ range . }} - <li class="list-inline-item mx-2 h3" data-toggle="tooltip" data-placement="top" title="{{ .name }}"> - <a class="text-white" target="_blank" rel="noopener" href="{{ .url }}"> - <i class="{{ .icon }}"></i> - </a> - </li> - {{ end }} -{{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html deleted file mode 100644 index 1587dbddc..000000000 --- a/layouts/partials/head.html +++ /dev/null @@ -1,25 +0,0 @@ -<meta charset="utf-8"> -<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> -{{ .Hugo.Generator }} -{{ if eq (getenv "HUGO_ENV") "production" }} -<META NAME="ROBOTS" CONTENT="INDEX, FOLLOW"> -{{ else }} -<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"> -{{ end }} -{{ range .AlternativeOutputFormats -}} -<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}"> -{{ end -}} -{{ partialCached "favicons.html" . }} -<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }}</title> -<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}"> -{{- template "_internal/opengraph.html" . -}} -{{- template "_internal/google_news.html" . -}} -{{- template "_internal/schema.html" . -}} -{{- template "_internal/twitter_cards.html" . -}} -{{ if eq (getenv "HUGO_ENV") "production" }} -{{ template "_internal/google_analytics_async.html" . }} -{{ end }} -{{ partialCached "head-css.html" . "asdf" }} -<script src="/js/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> -<script src="/js/d3.v4.min.js" integrity="sha384-1EOYqz4UgZkewWm70NbT1JBUXSQpOIS2AaJy6/evZH+lXOrt9ITSJbFctNeyBoIJ" crossorigin="anonymous"></script> -{{ partial "hooks/head-end.html" . }} diff --git a/layouts/partials/navbar.html b/layouts/partials/navbar.html deleted file mode 100644 index 393684b8c..000000000 --- a/layouts/partials/navbar.html +++ /dev/null @@ -1,27 +0,0 @@ -<!-- Forked from main theme. Not uppercase. --> -{{ $cover := .HasShortcode "blocks/cover" }} -<nav class="js-navbar-scroll navbar navbar-expand navbar-dark {{ if $cover}} td-navbar-cover {{ end }}flex-column flex-md-row td-navbar"> - <a class="navbar-brand" href="{{ .Site.Home.RelPermalink }}"> - <span class="navbar-logo">{{ with resources.Get "icons/logo.svg" }}{{ ( . | minify).Content | safeHTML }} {{ end }}</span><span class="font-weight-bold">{{ .Site.Title }}</span> - </a> - <div class="td-navbar-nav-scroll ml-md-auto" id="main_navbar"> - <ul class="navbar-nav mt-2 mt-lg-0"> - {{ $p := . }} - {{ range .Site.Menus.main }} - <li class="nav-item mr-4 mb-2 mb-lg-0"> - {{ $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) }} - {{ with .Page }} - {{ $active = or $active ( $.IsDescendant .) }} - {{ end }} - <a class="nav-link{{if $active }} active{{end}}" href="{{ with .Page }}{{ .RelPermalink }}{{ else }}{{ .URL | relLangURL }}{{ end }}"><span{{if $active }} class="active"{{end}}>{{ .Name }}</span></a> - </li> - {{ end }} - {{ if (gt (len .Site.Home.Translations) 0) }} - <li class="nav-item dropdown d-none d-lg-block"> - {{ partial "navbar-lang-selector.html" . }} - </li> - {{ end }} - </ul> - </div> - <div class="navbar-nav d-none d-lg-block">{{ partial "search-input.html" . }}</div> -</nav> diff --git a/layouts/partials/page-meta-links.html b/layouts/partials/page-meta-links.html deleted file mode 100644 index ce75b8163..000000000 --- a/layouts/partials/page-meta-links.html +++ /dev/null @@ -1,24 +0,0 @@ -{{ if .Path }} -{{ $gh_repo := ($.Param "github_repo") }} -{{ $gh_subdir := ($.Param "github_subdir") }} -{{ $gh_project_repo := ($.Param "github_project_repo") }} -{{ if $gh_repo }} -<div class="td-page-meta ml-2 pb-1 pt-2 mb-0"> -{{ $editURL := printf "%s/edit/master/content/%s" $gh_repo .Path }} -{{ if and ($gh_subdir) (.Site.IsMultiLingual) }} -{{ $editURL = printf "%s/edit/master/%s/content/%s/%s" $gh_repo $gh_subdir ($.Site.Language.Lang) $.Path }} -{{ else if .Site.IsMultiLingual }} -{{ $editURL = printf "%s/edit/master/content/%s/%s" $gh_repo ($.Site.Language.Lang) .Path }} -{{ else if $gh_subdir }} -{{ $editURL = printf "%s/edit/master/%s/content/%s" $gh_repo $gh_subdir $.Path }} -{{ end }} -{{ $issuesURL := printf "%s/issues/new?title=%s" $gh_repo (htmlEscape $.Title )}} -<a href="{{ $editURL }}" target="_blank"><i class="fa fa-edit fa-fw"></i> {{ T "post_edit_this" }}</a> -<a href="{{ $issuesURL }}" target="_blank"><i class="fab fa-github fa-fw"></i> {{ T "post_create_issue" }}</a> -{{ if $gh_project_repo }} -{{ $project_issueURL := printf "%s/issues/new" $gh_project_repo }} -<a href="{{ $project_issueURL }}" target="_blank"><i class="fas fa-tasks fa-fw"></i> {{ T "post_create_project_issue" }}</a> -{{ end }} -</div> -{{ end }} -{{ end }} diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html deleted file mode 100644 index 08f400598..000000000 --- a/layouts/partials/scripts.html +++ /dev/null @@ -1,23 +0,0 @@ -<script src="/js/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> -<script src="/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script> -{{ $jsBase := resources.Get "js/base.js" }} -{{ $jsSearch := resources.Get "js/search.js" | resources.ExecuteAsTemplate "js/search.js" .Site.Home }} -{{ $js := (slice $jsBase $jsSearch) | resources.Concat "js/main.js" }} -{{ if .Site.IsServer }} -<script src="{{ $js.RelPermalink }}"></script> -{{ else }} -{{ $js := $js | minify | fingerprint }} -<script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}"></script> -{{ end }} -{{ partial "hooks/body-end.html" . }} - -<script type="text/javascript"> - if (location.pathname == "/docs" || location.pathname.startsWith("/docs/")) { - $("body.td-page,body.td-section").find("main h2,h3,h4").each(function() { - var fragment = $(this).attr('id'); - if (fragment !== undefined && fragment !== "") { - $(this).append(' <a href="#'+fragment+'" class="header-link"><i class="fas fa-link"></i></a>'); - } - }); - } -</script> diff --git a/layouts/shortcodes/blocks/cover.html b/layouts/shortcodes/blocks/cover.html deleted file mode 100644 index 367d93b69..000000000 --- a/layouts/shortcodes/blocks/cover.html +++ /dev/null @@ -1,56 +0,0 @@ -{{ $blockID := printf "td-cover-block-%d" .Ordinal }} -{{ $promo_image := (.Page.Resources.ByType "image").GetMatch "**background*" }} -{{ $logo_image := (.Page.Resources.ByType "image").GetMatch "**logo*" }} -{{ $col_id := .Get "color" | default "dark" }} -{{ $image_anchor := .Get "image_anchor" | default "smart" }} -{{ $logo_anchor := .Get "logo_anchor" | default "smart" }} -{{/* Height can be one of: auto, min, med, max, full. */}} -{{ $height := .Get "height" | default "max" }} -{{ with $promo_image }} -{{ $promo_image_big := (.Fill (printf "1920x1080 %s" $image_anchor)) }} -{{ $promo_image_small := (.Fill (printf "960x540 %s" $image_anchor)) }} -<link rel="preload" as="image" href="{{ $promo_image_small.RelPermalink }}" media="(max-width: 1200px)"> -<link rel="preload" as="image" href="{{ $promo_image_big.RelPermalink }}" media="(min-width: 1200px)"> -<style> -#{{ $blockID }} { - background-image: url({{ $promo_image_small.RelPermalink }}); -} -@media only screen and (min-width: 1200px) { - #{{ $blockID }} { - background-image: url({{ $promo_image_big.RelPermalink }}); - } -} -</style> -{{ end }} -<section id="{{ $blockID }}" class="row td-cover-block td-cover-block--height-{{ $height }} js-td-cover td-overlay td-overlay--dark -bg-{{ $col_id }}"> - <div class="container td-overlay__inner"> - <div class="row"> - <div class="cover-content col-12"> - <nav class="navbar navbar-expand navbar-dark flex-column flex-md-row"> - <div class="td-navbar-nav-scroll ml-md-auto" id="cover_navbar"> - <ul class="navbar-nav mt-2 mt-lg-0"> - {{ $p := . }} - {{ range .Site.Menus.main }} - <li class="nav-item mr-4 mb-2 mb-lg-0"> - <a class="nav-link" href="{{ with .Page }}{{ .RelPermalink }}{{ else }}{{ .URL | relLangURL }}{{ end }}"><span>{{ .Name }}</span></a> - </li> - {{ end }} - {{ if (gt (len .Site.Home.Translations) 0) }} - <li class="nav-item dropdown d-none d-lg-block"> - {{ partial "navbar-lang-selector.html" . }} - </li> - {{ end }} - </ul> - </div> - <div class="navbar-nav d-none d-lg-block">{{ partial "search-input.html" . }}</div> - </nav> - - {{ with .Get "title" }}<h1 class="display-1 mt-0 mt-md-5">{{ $title := . }}{{ with $logo_image }}{{ $logo_image_resized := (.Fit (printf "70x70 %s" $logo_anchor)) }}<img class="td-cover-logo" src="{{ $logo_image_resized.RelPermalink }}" alt="{{ $title | html }} Logo">{{ end }}{{ $title | html }}</h1>{{ end }} - {{ with .Get "subtitle" }}<p class="display-2 text-uppercase mb-0">{{ . | html }}</p>{{ end }} - <div class="pt-3 lead"> - {{ .Inner }} - </div> - </div> - </div> - </div> -</section> diff --git a/layouts/shortcodes/blocks/feature.html b/layouts/shortcodes/blocks/feature.html deleted file mode 100644 index f0b4b37c8..000000000 --- a/layouts/shortcodes/blocks/feature.html +++ /dev/null @@ -1,10 +0,0 @@ -{{ $icon := .Get "icon" | default "fa-lightbulb" }} -{{ $url_text := .Get "url_text" }} -<div class="col-lg-4 mb-5 mb-lg-0 text-center "> - <div class="mb-4 h1"> - <i class="{{ if not (or (hasPrefix $icon "fas ") (hasPrefix $icon "fab ")) }}fas {{ end }}{{ $icon }}"></i> - </div> - <h4 class="h3">{{ .Get "title" | markdownify }}</h4> - <div class="mb-0">{{ .Inner }}</div> - {{ with .Get "url" }}<p><a href="{{ . }}">{{ with $url_text }}{{ $url_text }}{{ else }}{{ T "ui_read_more" }}{{ end }} …</a></p>{{ end }} -</div> diff --git a/layouts/shortcodes/blocks/lead.html b/layouts/shortcodes/blocks/lead.html deleted file mode 100644 index 7825eac70..000000000 --- a/layouts/shortcodes/blocks/lead.html +++ /dev/null @@ -1,11 +0,0 @@ -{{ $col_id := .Get "color" | default .Ordinal }} -{{ $height := .Get "height" | default "auto" }} -{{/* Height can be one of: auto, min, med, max, full. */}} -<a id="td-block-{{ .Ordinal }}" class="td-offset-anchor"></a> -<section class="row td-box td-box--{{ $col_id }} position-relative td-box--gradient td-box--height-{{ $height }}"> - <div class="container td-arrow-down"> - <span class="h4 mb-0"> - {{ .Inner }} - </span> - </div> -</section> diff --git a/layouts/shortcodes/blocks/section.html b/layouts/shortcodes/blocks/section.html deleted file mode 100644 index de7e6c8f1..000000000 --- a/layouts/shortcodes/blocks/section.html +++ /dev/null @@ -1,12 +0,0 @@ -{{ $col_id := .Get "color" | default .Ordinal }} -{{ $height := .Get "height" | default "auto" }} -<a id="td-block-{{ .Ordinal }}" class="td-offset-anchor"></a> -<section class="row td-box td-box--{{ $col_id }} td-box--gradient td-box--height-{{ $height }}"> - <div class="col"> - <div class="container"> - <div class="row"> - {{ .Inner }} - </div> - </div> - </div> -</section> diff --git a/layouts/shortcodes/graph.html b/layouts/shortcodes/graph.html deleted file mode 100644 index 73f98ba5d..000000000 --- a/layouts/shortcodes/graph.html +++ /dev/null @@ -1,203 +0,0 @@ -<svg id="{{ .Get "id" }}" width=500 height=200> - <title>{{ .Get "title" }}</title> -</svg> - -<script type="text/javascript"> -d3.csv("{{ .Get "url" }}", function(d, i, columns) { - return d; // Transformed below. -}, function(error, data) { - if (error) throw(error); - - // Create a new data that pivots on runtime. - // - // To start, we have: - // runtime, ..., result - // runc, ..., 1 - // runsc, ..., 2 - // - // In the end we want: - // ..., runsc, runc - // ..., 1, 2 - - // Filter by metric, if required. - if ("{{ .Get "metric" }}" != "") { - orig_columns = data.columns; - data = data.filter(d => d.metric == "{{ .Get "metric" }}"); - data.columns = orig_columns; - } - - // Filter by method, if required. - if ("{{ .Get "method" }}" != "") { - orig_columns = data.columns; - data = data.filter(d => d.method == "{{ .Get "method" }}"); - data.columns = orig_columns.filter(key => key != "method"); - } - - // Enumerate runtimes. - var runtimes = Array.from(new Set(data.map(d => d.runtime))); - var metrics = Array.from(new Set(data.map(d => d.metric))); - if (metrics.length < 1) { - console.log(data); - throw("need at least one metric"); - } else if (metrics.length == 1) { - metric = metrics[0]; - data.columns = data.columns.filter(key => key != "metric"); - } else { - metric = ""; // Used for grouping. - } - - var isSubset = function(a, sup) { - var ap = Object.getOwnPropertyNames(a); - for (var i = 0; i < ap.length; i++) { - if (a[ap[i]] !== sup[ap[i]]) { - return false; - } - } - return true; - }; - - // Execute a pivot to include runtimes as attributes. - var new_data = data.map(function(data_item) { - // Generate a prototype data item. - var proto_item = Object.assign({}, data_item); - delete proto_item.runtime; - delete proto_item.result; - var next_item = Object.assign({}, proto_item); - - // Find all matching runtime items. - data.forEach(function(d) { - if (isSubset(proto_item, d)) { - // Add the result result. - next_item[d.runtime] = d.result; - } - }); - return next_item; - }); - - // Remove any duplication. - new_data = Array.from(new Set(new_data)); - new_data.columns = data.columns; - new_data.columns = new_data.columns.filter(key => key != "runtime" && key != "result"); - new_data.columns = new_data.columns.concat(runtimes); - data = new_data; - - // Slice based on the first key. - if (data.columns.length != runtimes.length) { - x0_key = new_data.columns[0]; - var x1_domain = data.columns.slice(1); - } else { - x0_key = "runtime"; - var x1_domain = runtimes; - } - - // Determine varaible margins. - var x0_domain = data.map(d => d[x0_key]); - var margin_bottom_pad = 0; - if (x0_domain.length > 8) { - margin_bottom_pad = 50; - } - - // Use log scale if required. - var y_min = 0; - if ({{ .Get "log" | default false }}) { - // Need to cap lower end of the domain at 1. - y_min = 1; - } - - if ({{ .Get "y_min" | default false }}) { - y_min = "{{ .Get "y_min" }}"; - } - - var svg = d3.select("#{{ .Get "id" }}"), - margin = {top: 20, right: 20, bottom: 30 + margin_bottom_pad, left: 50}, - width = +svg.attr("width") - margin.left - margin.right, - height = +svg.attr("height") - margin.top - margin.bottom, - g = svg.append("g").attr("transform", "translate(" + margin.left + "," + margin.top + ")"); - - var x0 = d3.scaleBand() - .rangeRound([margin.left / 2, width - (4 * margin.right)]) - .paddingInner(0.1); - - var x1 = d3.scaleBand() - .padding(0.05); - - var y = d3.scaleLinear() - .rangeRound([height, 0]); - if ({{ .Get "log" | default false }}) { - y = d3.scaleLog() - .rangeRound([height, 0]); - } - - var z = d3.scaleOrdinal() - .range(["#262362", "#FBB03B", "#286FD7", "#6b486b"]); - - // Set all domains. - x0.domain(x0_domain); - x1.domain(x1_domain).rangeRound([0, x0.bandwidth()]); - y.domain([y_min, d3.max(data, d => d3.max(x1_domain, key => parseFloat(d[key])))]).nice(); - - // The data. - g.append("g") - .selectAll("g") - .data(data) - .enter().append("g") - .attr("transform", function(d) { return "translate(" + x0(d[x0_key]) + ",0)"; }) - .selectAll("rect") - .data(d => x1_domain.map(key => ({key, value: d[key]}))) - .enter().append("rect") - .attr("x", d => x1(d.key)) - .attr("y", d => y(d.value)) - .attr("width", x1.bandwidth()) - .attr("height", d => y(y_min) - y(d.value)) - .attr("fill", d => z(d.key)); - - // X0 ticks and labels. - var x0_axis = g.append("g") - .attr("class", "axis") - .attr("transform", "translate(0," + height + ")") - .call(d3.axisBottom(x0)); - if (x0_domain.length > 8) { - x0_axis.selectAll("text") - .style("text-anchor", "end") - .attr("dx", "-.8em") - .attr("dy", ".15em") - .attr("transform", "rotate(-65)"); - } - - // Y ticks and top-label. - if (metric == "default") { - metric = ""; // Don't display. - } - g.append("g") - .attr("class", "axis") - .call(d3.axisLeft(y).ticks(null, "s")) - .append("text") - .attr("x", -30.0) - .attr("y", y(y.ticks().pop()) - 10.0) - .attr("dy", "0.32em") - .attr("fill", "#000") - .attr("font-weight", "bold") - .attr("text-anchor", "start") - .text(metric); - - // The legend. - var legend = g.append("g") - .attr("font-family", "sans-serif") - .attr("font-size", 10) - .attr("text-anchor", "end") - .selectAll("g") - .data(x1_domain.slice().reverse()) - .enter().append("g") - .attr("transform", function(d, i) { return "translate(0," + i * 20 + ")"; }); - legend.append("rect") - .attr("x", width - 19) - .attr("width", 19) - .attr("height", 19) - .attr("fill", z); - legend.append("text") - .attr("x", width - 24) - .attr("y", 9.5) - .attr("dy", "0.32em") - .text(function(d) { return d; }); -}); -</script> diff --git a/layouts/shortcodes/required_linux.html b/layouts/shortcodes/required_linux.html deleted file mode 100644 index af6158606..000000000 --- a/layouts/shortcodes/required_linux.html +++ /dev/null @@ -1 +0,0 @@ -{{ .Site.Params.vars.required_linux }} |