Merge commit 'a024bc7d76fcc5e49e8210f9b0896db9ef21861a'

This commit is contained in:
Bjørn Erik Pedersen
2025-02-13 10:40:34 +01:00
817 changed files with 5301 additions and 14766 deletions

View File

@@ -0,0 +1,10 @@
<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }}
{{- if in (slice 2 3 4 6) .Level }}{{" " -}}
<a class="anchor" name="{{ .Anchor }}"></a>
<a class="inline-flex items-center" href="#{{ .Anchor | safeURL }}" aria-label="Anchor">
<svg class="fill-primary hover:fill-primary/70 w-4 h-4">
<use href="#icon--anchor"></use>
</svg>
</a>
{{- end -}}
</h{{ .Level }}>

View File

@@ -185,7 +185,7 @@ either of these shortcodes in conjunction with this render hook.
{{- end }}
{{- /* Render anchor element. */ -}}
<a
<a aria-label="{{ .PlainText }}"
{{- with .Title }} title="{{ . }}" {{- end }}
{{- range $k, $v := $attrs }}
{{- if $v }}
@@ -271,7 +271,7 @@ either of these shortcodes in conjunction with this render hook.
{{- $text := .text | transform.Plainify | strings.ToLower }}
{{- /* Initialize. */}}
{{- $glossaryPath := "/getting-started/glossary" }}
{{- $glossaryPath := "/quick-reference/glossary" }}
{{- $termGiven := $text }}
{{- $termActual := "" }}
{{- $termSingular := inflect.Singularize $termGiven }}
@@ -282,7 +282,7 @@ either of these shortcodes in conjunction with this render hook.
{{- errorf "The %q render hook was unable to find %s: see %s" $renderHookName $glossaryPath $contentPath }}
{{- end }}
{{- /* Theres a better way to handle this, but it works for now. */}}
{{- /* There's a better way to handle this, but it works for now. */}}
{{- $cheating := dict
"chaining" "chain"
"localize" "localization"

View File

@@ -0,0 +1,67 @@
<!doctype html>
<html
class="h-full antialiased scheme-light dark:scheme-dark"
lang="{{ with site.Language.LanguageCode }}
{{ . }}
{{ else }}
en-us
{{ end }}
">
<head>
<meta charset="utf-8" />
<title>
{{ .Title }}
</title>
<style>
[x-cloak] {
display: none !important;
}
</style>
<meta
name="description"
content="{{ .Description | default site.Params.description }}" />
{{ partial "layouts/head/head-js.html" . }}
{{ with (templates.Defer (dict "key" "global")) }}
{{ $t := debug.Timer "tailwindcss" }}
{{ with resources.Get "css/styles.css" }}
{{ $opts := dict
"inlineImports" true
"minify" (not hugo.IsDevelopment)
}}
{{ with . | css.TailwindCSS $opts }}
{{ partial "helpers/linkcss.html" (dict "r" .) }}
{{ end }}
{{ end }}
{{ $t.Stop }}
{{ end }}
{{ partial "layouts/head/head.html" . }}
</head>
<body class="flex flex-col min-h-full bg-white dark:bg-blue-950">
{{ partial "layouts/hooks/body-start.html" . }}
{{/* Layout. */}}
{{ block "header" . }}
{{ partial "layouts/header/header.html" . }}
{{ end }}
{{ block "hero" . }}
{{ end }}
<div class="flex w-full xl:w-6xl h-full flex-auto mx-auto">
<main
class="flex-1 mx-auto lg:mx-0 w-full max-w-3x lg:max-w-3x pt-8 lg:pt-14 pb-20 px-main">
{{ block "main" . }}{{ end }}
</main>
{{ block "rightsidebar" . }}
<aside
class="py-15 ml-4 xl:ml-12 w-60 hidden lg:relative lg:block lg:flex-none">
{{ block "rightsidebar_content" . }}{{ end }}
</aside>
{{ end }}
</div>
{{/* Common icons. */}}
{{ partial "layouts/icons.html" . }}
{{/* Footer. */}}
{{ block "footer" . }}
{{ partial "layouts/footer.html" . }}
{{ end }}
{{ partial "layouts/hooks/body-end.html" . }}
</body>
</html>

View File

@@ -0,0 +1,67 @@
{{ define "main" }}
{{ $pages := "" }}
{{ $showDate := false }}
{{ if .IsPage }}
{{/* We currently have a slightly odd content structure with no top level /docs section. */}}
{{ $pages = .CurrentSection.Pages }}
{{ else }}
{{ if eq .Section "news" }}
{{ $pages = partial "news/get-news-items.html" . }}
{{ $showDate = true }}
{{ else }}
{{ $pages = .Pages }}
{{ end }}
{{ end }}
<article class="">
{{ partial "layouts/docsheader.html" . }}
<div class="mt-6 sm:mt-8 grid grid-cols-2 xl:grid-cols-3 gap-4 min-h-40">
{{ range $pages }}
{{ if eq . $ }}
{{ continue }}
{{ end }}
<a
class="flex col-span-1 a--block cursor-pointer flex-col group border p-3 sm:p-4 hover:shadow-md dark:shadow-slate-800 border-gray-300 dark:border-gray-800 m-0"
href="{{ .RelPermalink }}">
{{ if $showDate }}
<p
class="text-gray-500 dark:text-gray-400 text-sm/5 md:text-base/2 mb-2 sm:mb-4">
{{ .Date.Format "January 2, 2006" }}
</p>
{{ end }}
<h3
class="text-lg/6 md:text-2xl tracking-tight p-0 -mt-1 sm:mt-0 mb-1 sm:mb-2 text-primary group-hover:text-primary/70 overflow-hidden">
{{ .LinkTitle }}
</h3>
{{ with .Params.action.signatures }}
{{/* Set in functions and methods pages. */}}
{{ with $signature := index . 0 }}
{{ if $.Params.action.returnType }}
{{ $signature = printf "%s ⟼ %s" $signature $.context.Params.action.returnType }}
{{ end }}
<div
class="font-mono font-light text-sm whitespace-nowrap mb-2 sm:mb-4 p-2 bg-slate-50 dark:bg-slate-700 border-0 mr-8 overflow-x-auto">
{{- $signature -}}
</div>
{{ end }}
{{ end }}
<p
class="text-black dark:text-gray-100 leading-6 text-sm md:text-base three-lines-ellipsis">
{{ if and (eq .Section "commands") .IsPage }}
{{ $simpleCobraCommandShort := .RawContent | strings.ReplaceRE `(?s)^##\s.+?\n\n(.+?)\n\n.*` "$1" }}
{{ printf "%s." $simpleCobraCommandShort }}
{{ else }}
{{ (or .Params.description .Summary) | plainify | safeHTML }}
{{ end }}
</p>
</a>
{{ end }}
</div>
</article>
{{ end }}
{{ define "rightsidebar" }}
{{ printf "%c" '\u00A0' }}
{{ end }}

View File

@@ -0,0 +1,71 @@
{{ define "main" }}
{{ $ttop := debug.Timer "single" }}
<article class="max-w-5xl lg:max-w-3xl">
{{ partial "layouts/docsheader.html" . }}
<div class="content" id="content">
{{ with .Params.description }}
<div class="lead">
{{ . | markdownify }}
</div>
{{ end }}
{{ $t := debug.Timer "single.categories" }}
{{ $categories := .GetTerms "categories" }}
{{ with $categories }}
<div class="mb-4 sm:mb-6 flex flex-wrap gap-2">
{{ range . }}
{{ $text := .LinkTitle }}
{{ $class := "" }}
{{ range (slice true false ) }}
{{ $color := partial "helpers/funcs/color-from-string.html" (dict "text" $text "dark" . "--single" "green" ) }}
{{ $prefix := "" }}
{{ if . }}
{{ $prefix = "dark:" }}
{{ end }}
{{ $class = printf "%sbg-%s-%d %stext-%s-%d border %sborder-%s-%d"
$prefix $color.color $color.shade1
$prefix $color.color $color.shade2
$prefix $color.color $color.shade3
}}
{{ end }}
<a
href="{{ .RelPermalink }}"
class="{{ $class }} text-xs h-auto tracking-widest uppercase font-light not-prose no-underline inline-block py-1 px-3 rounded-xl shadow-xs hover:opacity-80 hover:shadow-none">
{{ .LinkTitle }}
</a>
{{ end }}
</div>
{{ end }}
{{ $t.Stop }}
{{ if .Params.action.signatures }}
<div class="mb-4 not-prose">
{{- partial "docs/functions-signatures.html" . -}}
{{- partial "docs/functions-return-type.html" . -}}
{{- partial "docs/functions-aliases.html" . -}}
</div>
{{ end }}
{{ $t := debug.Timer "single.content" }}
{{ .Content }}
{{ $t.Stop }}
{{ $t := debug.Timer "single.page-edit" }}
{{ partial "layouts/page-edit.html" . }}
{{ $t.Stop }}
</div>
</article>
{{ $ttop.Stop }}
{{ end }}
{{ define "rightsidebar_content" }}
{{/* in-this-section.html depends on these being reneredc first. */}}
{{ $related := partial "layouts/related.html" . }}
{{ $toc := partial "layouts/toc.html" . }}
{{ if not .Params.hide_in_this_section }}
{{ partial "layouts/in-this-section.html" . }}
{{ end }}
{{ $related }}
{{ $toc }}
{{ end }}