Revert "Features to add to our doc tooling"

This commit is contained in:
Mike Jang
2024-03-07 11:40:47 -08:00
committed by GitHub
parent 374f718da2
commit a75f2a5b1e
33 changed files with 0 additions and 908 deletions
@@ -1,34 +0,0 @@
---
title: POC - Test documentation for partials
weight: 1
hideInSidebar: true
---
This is a POC of features from Hugo (gohugo.io) that I'd like to incorporate into our
docs. We probably can also use this in our articles and blog posts.
This first feature relates to progressive disclosure. When we have a "lot" of content,
many readers may want to skip over content such as descriptions of HNSW that they
already know. (Tip, click on the right facing arrow.)
{{% expand "More info on HNSW" %}}
Once we have a canonical Qdrant definition for HNSW, we can add it here.
{{% /expand %}}
<br>
To review the code I used to set this up, see [my test-partials.md file](https://github.com/qdrant/landing_page/pull/690/files#diff-526e365af25822ada556c462693e51ebee57e500a3c7d0bfb5b07d78357f5014)
In addition, I've set up a variable for multitenancy in the
`layouts/shortcodes/multitenancy.md` file. I call that as a variable, specifically (without the backslash), as follows:
```markdown
"{{\% multitenancy %}}"
```
Once we set up the Qdrant definition for multitenancy, we can call it anywhere
in our docs. This will help us stay consistent.
And here's the content of multitenancy.md file, in the `qdrant-landing/layouts/shortcodes` directory:
> {{% multitenancy %}}
@@ -1,18 +0,0 @@
{{ .Page.Store.Set "hasmhchem" true -}}
{{/* set default delimiters */ -}}
{{ $delimiter_left := "$$" -}}
{{ $delimiter_right := "$$" -}}
{{/* override delimiters if set in config file */ -}}
{{ with $.Page.Site.Params.katex.options.delimiters -}}
{{ range first 1 ( where . "display" true ) -}}
{{ $delimiter_left = index . "left" -}}
{{ $delimiter_right = index . "right" -}}
{{ end -}}
{{ end -}}
{{/* output of chemical formulae */}}
<div class="chem">{{ $delimiter_left -}}
{{ .Inner | safeHTML -}}
{{ $delimiter_right -}}</div>{{ "" -}}
@@ -1,18 +0,0 @@
{{ .Page.Store.Set "hasKaTeX" true -}}
{{/* set default delimiters */ -}}
{{ $delimiter_left := "$$" -}}
{{ $delimiter_right := "$$" -}}
{{/* override delimiters if set in config file */ -}}
{{ with $.Page.Site.Params.katex.options.delimiters -}}
{{ range first 1 ( where . "display" true ) -}}
{{ $delimiter_left = index . "left" -}}
{{ $delimiter_right = index . "right" -}}
{{ end -}}
{{ end -}}
{{/* output of equation */}}
<div class="math">{{ $delimiter_left -}}
{{ .Inner | safeHTML -}}
{{ $delimiter_right }}</div>{{ "" -}}
@@ -1,5 +0,0 @@
{{ .Page.Store.Set "hasmermaid" true -}}
<pre class="mermaid">
{{- .Inner -}}
</pre>
@@ -1,8 +0,0 @@
<h{{ .Level }} id="{{- .Anchor | safeURL -}}">
{{- .Text | safeHTML -}}
{{ template "_default/_markup/_td-heading-self-link.html" . -}}
</h{{ .Level }}>
{{- define "_default/_markup/_td-heading-self-link.html" -}}
<a class="td-heading-self-link" href="#{{ .Anchor | safeURL }}" aria-label="Heading self-link"></a>
{{- end -}}
@@ -1,18 +0,0 @@
<div class="td-content">
<h1>{{ .Title }}</h1>
{{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }}
<header class="article-meta">
{{ partial "taxonomy_terms_article_wrapper.html" . -}}
{{ if (and (not .Params.hide_readingtime) (.Site.Params.ui.readingtime.enable)) -}}
{{ partial "reading-time.html" . -}}
{{ end -}}
</header>
{{ .Content }}
{{ partial "feedback.html" . -}}
{{ if (.Site.Params.DisqusShortname) -}}
<br />
{{- partial "disqus-comment.html" . -}}
{{ end -}}
{{ partial "page-meta-lastmod.html" . }}
</div>
{{/**/ -}}
@@ -1,3 +0,0 @@
{{ define "main" -}}
{{ .Content -}}
{{ end }}
@@ -1,43 +0,0 @@
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ .Site.Title }} – {{ .Title }}</title>
<link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{ with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{ if not $.Section }}
{{ $sections := .Site.Params.rss_sections | default (slice "blog") }}
{{ .Scratch.Set "rss_pages" (first 50 (where $.Site.RegularPages "Type" "in" $sections )) }}
{{ else }}
{{ if $.Parent.IsHome }}
{{ .Scratch.Set "rss_pages" (first 50 (where $.Site.RegularPages "Type" $.Section )) }}
{{ else }}
{{ .Scratch.Set "rss_pages" (first 50 $.Pages) }}
{{ end }}
{{ end }}
{{ range (.Scratch.Get "rss_pages") }}
<item>
<title>{{ .Section | title }}: {{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid>
<description>
{{ $img := (.Resources.ByType "image").GetMatch "*featured*" }}
{{ with $img }}
{{ $img := .Resize "640x" }}
{{ printf "<![CDATA[<img src=\"%s\" width=\"%d\" height=\"%d\"/>]]>" $img.Permalink $img.Width $img.Height | safeHTML }}
{{ end }}
{{ .Content | html }}
</description>
</item>
{{ end }}
</channel>
</rss>
@@ -1,21 +0,0 @@
{{ define "main" -}}
<section class="row td-search-result">
<div class="col-12 col-md-8 offset-md-2">
<h2 class="ms-4">{{ .Title }}</h2>
{{ with .Site.Params.gcs_engine_id -}}
<script>
(function() {
var cx = '{{ . }}';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:searchresults-only></gcse:searchresults-only>
{{ end -}}
</div>
</section>
{{ end }}
@@ -1,3 +0,0 @@
{{ define "main" -}}
{{ .Content -}}
{{ end }}
@@ -1,32 +0,0 @@
{{ define "main" }}
<div class="td-content">
<main class="taxonomy-taxonomy-page">
<h1>{{ with .Data.Singular }}{{ . | humanize }}: {{ end }}<span>{{ .Title }}</span></h1>
<div>
{{ .Content }}
</div>
<div>
{{ range .Pages }}
{{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) }}
<article class="card article-teaser article-type-{{ with .Type }}{{ ( urlize . ) }}{{ end }}">
<h3><a href="{{ $manualLink }}"{{ with .Params.manualLinkTitle }} title="{{ . }}"{{ end }}{{ with .Params.manualLinkTarget }} target="{{ . }}"{{ if eq . "_blank" }} rel="noopener"{{ end }}{{ end }}>{{- .Title -}}</a></h3>
{{ if not .Site.Params.ui.taxonomy_breadcrumb_disable -}}
{{/* Use breadcrumb partial, but remove attributes that are invalid or inappropriate in this page-summary context. */ -}}
{{ partial "breadcrumb.html" .
| replaceRE ` aria-\w+=\".*?\"|(breadcrumb-item) active` "$1" | safeHTML
-}}
{{ end -}}
<p>{{ .Description | markdownify }}</p>
<header class="article-meta">
{{ partial "taxonomy_terms_article_wrapper.html" . -}}
{{ if (and (not .Params.hide_readingtime) (.Site.Params.ui.readingtime.enable)) -}}
{{ partial "reading-time.html" . -}}
{{ end -}}
</header>
</article>
{{ end }}
</div>
<a href="{{ with .Site.GetPage (printf "/%s" ( lower .Data.Plural )) }}{{ .Permalink }}{{ end }}" class="all-taxonomy-terms">{{ humanize ( T "ui_all" ) }} {{ with .Data.Plural }}{{ . | humanize }}{{ end }}</a>
</main>
</div>
{{ end }}
@@ -1,8 +0,0 @@
{{ define "main" -}}
<div class="td-content">
<main class="taxonomy-terms-page">
<h1>{{ .Title }}</h1>
{{ partial "taxonomy_terms_cloud.html" (dict "context" . "taxo" ( lower .Title ) ) -}}
</main>
</div>
{{- end }}
@@ -1,10 +0,0 @@
{{ $_hugo_config := `{ "version": 1 }` }}
{{ $color := .Get "color" | default "primary" }}
<div class="alert alert-{{ $color }}" role="alert">
{{ with .Get "title" }}<h4 class="alert-heading">{{ . | safeHTML }}</h4>{{ end }}
{{ if eq .Page.File.Ext "md" }}
{{ .Inner | markdownify }}
{{ else }}
{{ .Inner | htmlUnescape | safeHTML }}
{{ end }}
</div>
@@ -1,54 +0,0 @@
{{ $_hugo_config := `{ "version": 1 }` -}}
{{ $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 := . -}}
{{ $promo_image_small := . -}}
{{ if ne $promo_image.MediaType.SubType "svg" -}}
{{ $promo_image_big = .Fill (printf "1920x1080 %s" $image_anchor) -}}
{{ $promo_image_small = .Fill (printf "960x540 %s" $image_anchor) -}}
{{ end -}}
<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 -}}
{{ if not .Site.Params.ui.navbar_translucent_over_cover_disable }} js-td-cover
{{- end }} td-overlay td-overlay--dark -bg-{{ $col_id }}">
<div class="col-12">
<div class="container td-overlay__inner">
<div class="text-center">
{{ with .Get "title" }}<h1 class="display-1 mt-0 mt-md-5 pb-4">{{ $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">
{{ if eq .Page.File.Ext "md" }}
{{ .Inner | markdownify }}
{{ else }}
{{ .Inner | htmlUnescape | safeHTML }}
{{ end }}
</div>
</div>
</div>
</div>
{{ with .Get "byline" | default "" -}}
<div class="byline">{{ . }}</div>
{{- end }}
</section>
{{/**/ -}}
@@ -1,13 +0,0 @@
{{ $icon := .Get "icon" | default "fa-lightbulb" -}}
<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 $.Get "url_text" }}{{ . }}{{ else }}{{ T "ui_read_more" }}{{ end }}</a></p>{{ end }}
</div>
@@ -1,20 +0,0 @@
{{ $col_id := .Get "color" | default .Ordinal -}}
{{ $height := .Get "height" | default "auto" -}}
{{ with .Get "height" -}}
{{ if not ( or ( eq . "auto" ) ( eq . "min" ) ( eq . "med" ) ( eq . "max" ) ( eq . "full" ) ) -}}
{{ errorf "shortcode 'lead': parameter height is %q, must be one of 'auto', 'min', 'med', 'max' or 'full'." . -}}
{{ end -}}
{{ end -}}
<div><a id="td-block-{{ .Ordinal }}" class="td-offset-anchor"></a></div>
<section class="row td-box td-box--{{ $col_id }} position-relative td-box--height-{{ $height }}">
<div class="col-12">
<div class="container text-center td-arrow-down">
<div class="h4 mb-0">
{{/* Do NOT remove this comment! It ends the HTML block above. See https://spec.commonmark.org/0.30/#html-blocks, 7. */}}
{{ .Inner }}
</div>
</div>
</div>
</section>
{{/**/ -}}
@@ -1,7 +0,0 @@
{{ with .Parent }}
{{ $id := $.Get "id" | default (printf "td-block-%d" ( add .Ordinal 1 )) }}
{{ $color := $.Get "color" | default "blue" }}
<a class="btn btn-link text-{{ $color }}" href="#{{ $id }}" aria-label="{{ T "ui_read_more"}}"><i class="fa-solid fa-circle-chevron-down" style="font-size: 400%"></i></a>
{{ else }}
{{ errorf "The link-down shortcode is supposed to be nested inside a shortcode"}}
{{ end }}
@@ -1,14 +0,0 @@
{{ $col_id := .Get "color" | default .Ordinal -}}
{{ $height := .Get "height" | default "auto" -}}
{{ $type := .Get "type" | default "container" -}}
<div><a id="td-block-{{ .Ordinal }}" class="td-offset-anchor"></a></div>
<section class="row td-box td-box--{{ $col_id }} td-box--height-{{ $height }}">
<div class="col">
<div class="{{ $type }}">
{{/* Do NOT remove this comment! It ends the HTML block above. See https://spec.commonmark.org/0.30/#html-blocks, 7. */}}
{{ .Inner -}}
</div>
</div>
</section>
{{/**/ -}}
@@ -1,16 +0,0 @@
{{ warnf `shortcode 'card-code' is deprecated: use shortcode 'card' with named parameter 'code=true' instead.` -}}
{{ $lang := default "" ($.Get "lang") -}}
{{ $highlight := default "" ($.Get "highlight") -}}
<div class="td-card card border me-4">
{{ with $.Get "header" -}}
<div class="card-header bg-white">
{{ . | markdownify -}}
</div>
{{ end -}}
<div class="card-body code p-0 m-0">
{{ with $.Inner -}}
{{ highlight . $lang $highlight -}}
{{ end -}}
</div>
</div>
@@ -1,47 +0,0 @@
{{/* Check parameter type */ -}}
{{ $code := false -}}
{{ with .Get "code" -}}
{{ $type := printf "%T" . -}}
{{ if ne $type "bool" -}}
{{ errorf `shortcode 'card': boolean value expected for parameter 'code', but got %s` $type -}}
{{ else }}
{{ $code = . -}}
{{ end -}}
{{ end -}}
{{ $lang := default "" (.Get "lang") -}}
{{ $highlight := default "" (.Get "highlight") -}}
<div class="td-card card border me-4">
{{ with $.Get "header" -}}
<div class="card-header{{- cond $code " bg-white" "" -}}">
{{ . | markdownify }}
</div>
{{ end -}}
<div class="card-body{{- cond $code " code p-0 m-0" "" -}}">
{{ with $.Get "title" -}}
<h5 class="card-title">
{{ . | markdownify -}}
</h5>
{{ end -}}
{{ with $.Get "subtitle" -}}
<h6 class="card-title ms-2 text-muted">
{{ . | markdownify -}}
</h6>
{{ end -}}
{{ with $.Inner -}}
{{ if $code -}}
{{ highlight . $lang $highlight -}}
{{ else -}}
<p class="card-text">
{{ . -}}
</p>
{{ end -}}
{{ end -}}
</div>
{{ with $.Get "footer" -}}
<div class="card-footer">
{{ . | markdownify -}}
</div>
{{ end -}}
</div>
@@ -1,3 +0,0 @@
<div class="td-card-group card-group p-0 mb-4">
{{- .Inner -}}
</div>
@@ -1,36 +0,0 @@
<!-- Get the current buildcondition from the config and lowercase it -->
{{- $condition := lower $.Site.Params.buildCondition -}}
{{- if ne $condition "" -}}
<!-- Get the parameters from the shortcode invocation and lowercase them.
TODO: to enable multiple conditions, we could accept comma-separated lists and split them -->
{{- $include_if := lower (.Get "include-if") -}}
{{- $exclude_if := lower (.Get "exclude-if") -}}
{{- if and (in $include_if $condition) (in $exclude_if $condition) -}}
<!-- condition appears in both parameters -->
{{- errorf "Build condition %q appears in both include-if and exclude-if parameters of conditional-txt shortcode on page %s" $condition .Position -}}
{{- end -}}
{{- if isset $.Params "include-if" -}}
<!-- WARNING substring matches are matches as well! That means, if include-if="foobar", and buildcondition is "foo", you have a match!-->
{{- if in $include_if $condition -}}
<!-- Do not indent the next Inner line, because the inner becomes a blockquote if the conditional-text is nested in another shortcode -->
{{- .Inner -}}
{{- else -}}
{{- end -}}
{{- else -}}
{{- if isset $.Params "exclude-if" -}}
<!-- WARNING substring matches are matches as well! That means, if exclude-if="foobar", and buildcondition is "foo", you have a match!-->
{{- if in $exclude_if $condition -}}
{{- else -}}
<!-- Do not indent the next Inner line, because the inner becomes a blockquote if the conditional-text is nested in another shortcode -->
{{- .Inner -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
@@ -1,17 +0,0 @@
{{ $_hugo_config := `{ "version": 1 }` }}
<div class="expand">
<div class="expand-label" style="cursor: pointer;" onclick="$h = $(this);$h.next('div').slideToggle(100,function () {$h.children('i').attr('class',function () {return $h.next('div').is(':visible') ? 'fas fa-chevron-down' : 'fas fa-chevron-right';});});">
<i style="font-size:x-large; color: #0047AB" class="fas fa-chevron-right"></i>
<span>
{{$expandMessage := T "Expand-title"}}
{{ if .IsNamedParams }}
{{.Get "default" | default $expandMessage}}
{{else}}
{{.Get 0 | default $expandMessage}}
{{end}}
</span>
</div>
<div class="expand-content" style="display: none;">
{{.Inner | safeHTML}}
</div>
</div>
@@ -1,29 +0,0 @@
{{ $src := (.Page.Resources.GetMatch (printf "**%s*" (.Get "src"))) }}
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
{{- if .Get "link" -}}
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
{{- end }}
<img src="{{ if $src }}{{ $src.RelPermalink }}{{ else }}{{ .Get "src" }}{{ end }}"
{{- if or (.Get "alt") (.Get "caption") }}
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
{{- end -}}
{{- with .Get "width" }} width="{{ . }}"{{ end -}}
{{- with .Get "height" }} height="{{ . }}"{{ end -}}
/> <!-- Closing img tag -->
{{- if .Get "link" }}</a>{{ end -}}
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
<figcaption>
{{ with (.Get "title") -}}
<h4>{{ . }}</h4>
{{- end -}}
{{- if or (.Get "caption") (.Get "attr") -}}<p>
{{- .Get "caption" | markdownify -}}
{{- with .Get "attrlink" }}
<a href="{{ . }}">
{{- end -}}
{{- .Get "attr" | markdownify -}}
{{- if .Get "attrlink" }}</a>{{ end }}</p>
{{- end }}
</figcaption>
{{- end }}
</figure>
@@ -1,21 +0,0 @@
{{ $src := .Get "src" | }}
{{ $width := .Get "width" | default "100%" }}
{{ $tryautoheight := .Get "tryautoheight" | default true }}
{{ $style := .Get "style" | default "min-height:98vh; border:none;" }}
{{ $sandbox := .Get "sandbox" | default false }}
{{ $name := .Get "name" | default "iframe-name" }}
{{ $id := .Get "id" | default "iframe-id" }}
{{ $class := .Get "class" }}
{{ $sub := .Get "sub" | default "Your browser can not display embedded frames. You can access the embedded page via the following link:" }}
{{ with $src }}
{{ if $tryautoheight }}
<script type="text/javascript">
function resizeIframe(iframe) {
iframe.height = iframe.contentWindow.document.body.scrollHeight + "px";
}
</script>
{{ end }}
<iframe id="{{ $id }}"{{ with $class }} class="{{ $class }}"{{ end }} src="{{ $src }}" width="{{ $width }}" name="{{ $name }}"{{ with $style }} style="{{ $style | safeCSS }}"{{ end }}{{ if $tryautoheight }} onload="resizeIframe(this)"{{ end }} referrerpolicy="no-referrer"{{ if (eq $sandbox false)}}{{ else if (eq $sandbox true) }} sandbox{{ else }} sandbox="{{ $sandbox }}"{{ end }}>
<p>{{ $sub }} <a href="{{ $src }}">{{ $src }}</a></p>
</iframe>
{{ end }}
@@ -1,27 +0,0 @@
{{ $original := .Page.Resources.GetMatch (printf "**%s*" (.Get 0)) -}}
{{ $command := .Get 1 -}}
{{ $options := .Get 2 -}}
{{ if eq $command "Fit" -}}
{{ .Scratch.Set "image" ($original.Fit $options) -}}
{{ else if eq $command "Resize" -}}
{{ .Scratch.Set "image" ($original.Resize $options) -}}
{{ else if eq $command "Fill" -}}
{{ .Scratch.Set "image" ($original.Fill $options) -}}
{{ else if eq $command "Crop" -}}
{{ .Scratch.Set "image" ($original.Crop $options) -}}
{{ else -}}
{{ errorf "Invalid image processing command: Must be one of Fit, Fill, Crop or Resize." -}}
{{ end -}}
{{ $image := .Scratch.Get "image" -}}
<figure class="card rounded p-2 td-post-card mb-4 mt-4" style="max-width: {{ add $image.Width 10 -}}px">
<img class="card-img-top" src="{{- $image.RelPermalink -}}" width="{{- $image.Width -}}" height="{{- $image.Height -}}">
{{ with .Inner -}}
<figcaption class="card-body px-0 pt-2 pb-0">
<p class="card-text">
{{/* Do **not** remove this comment! It ends above html block! See https://spec.commonmark.org/0.30/#html-blocks, 7. */}}
{{ . }}{{ with $image.Params.byline }}<small class="text-muted"><br/>{{ . }}</small>{{ end }}
</p>
</figcaption>
{{ end -}}
</figure>
@@ -1 +0,0 @@
Multitenancy is a definition that we need to add to this shortcode
@@ -1,5 +0,0 @@
{{ $_hugo_config := `{ "version": 1 }` }}
{{ $color := .Get "color" | default "primary" }}
<div class="pageinfo pageinfo-{{ $color }}">
{{ .Inner }}
</div>
@@ -1,41 +0,0 @@
{{/* Store ordinal, to be retrieved by parent element */}}
{{ if ge hugo.Version "0.93.0" }}
{{ .Page.Store.Add "Ordinal" 1 }}
{{ end }}
{{/* Handle the "file" named parameter or a single unnamed parameter as the file
path */}}
{{ if .IsNamedParams }}
{{ $.Scratch.Set "fparameter" ( .Get "file" ) }}
{{ else }}
{{ $.Scratch.Set "fparameter" ( .Get 0 ) }}
{{ end }}
{{/* If the first character is "/", the path is absolute from the site's
`baseURL`. Otherwise, construct an absolute path using the current directory */}}
{{ if eq (.Scratch.Get "fparameter" | printf "%.1s") "/" }}
{{ $.Scratch.Set "filepath" ($.Scratch.Get "fparameter") }}
{{ else }}
{{ $.Scratch.Set "filepath" "/" }}
{{ $.Scratch.Add "filepath" $.Page.File.Dir }}
{{ $.Scratch.Add "filepath" ($.Scratch.Get "fparameter") }}
{{ end }}
{{/* If the file exists, read it and highlight it if it's code.
Throw a compile error or print an error on the page if the file is not found */}}
{{ if fileExists ($.Scratch.Get "filepath") }}
{{ if eq (.Get "code") "true" }}
{{- highlight ($.Scratch.Get "filepath" | readFile | htmlUnescape |
safeHTML ) (.Get "lang") "" -}}
{{ else }}
{{- $.Scratch.Get "filepath" | os.ReadFile | .Page.RenderString | safeHTML -}}
{{ end }}
{{ else if eq (.Get "draft") "true" }}
<p style="color: #D74848"><b><i>The file <code>{{ $.Scratch.Get "filepath" }}</code> was not found.</i></b></p>
{{ else }}{{- errorf "Shortcode %q: file %q not found at %s" .Name ($.Scratch.Get "filepath") .Position -}}{{ end }}
@@ -1,91 +0,0 @@
{{- $file := .Get 0 -}}
{{- $url := "" -}}
{{- $otheroptions := .Get 1 -}}
{{ if hasPrefix $file "http"}}
{{- $url = $file -}}
{{ else }}
{{ if (fileExists (print .Page.File.Dir $file)) -}}
<!-- First try as relative path -->
{{- $url = (print .Page.Site.BaseURL .Page.File.Dir $file) -}}
{{ else }}
<!-- Then as project-relative path-->
{{- $url = (print .Page.Site.BaseURL $file) -}}
{{- end }}
{{- end -}}
<!-- CSS style overrides for Redoc API docs -->
<style>
#redoc input { height: 64px; }
#redoc span[type="put"], span[type="get"], span[type="delete"], span[type="post"], span[type="options"], span[type="patch"], span[type="basic"], span[type="link"], span[type="head"] {
border-radius: 4px;
}
#redoc h2 { margin-top: 0px;}
</style>
<!-- Back to top button start -->
<style>
#myBtn {
display: none;
position: fixed;
bottom: 20px;
right: 30px;
z-index: 99;
font-size: 18px;
border: none;
outline: none;
background-color: #30638E;
color: white;
cursor: pointer;
padding: 15px;
border-radius: 4px;
}
#myBtn:hover {
background-color: #555;
}
</style>
<button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
<script>
//Get the button
var mybutton = document.getElementById("myBtn");
// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
// When the user clicks on the button, scroll to the top of the document
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
</script>
<!-- Back to top button end -->
<!--
Redoc doesn't change outer page styles
-->
<style>
body {
margin: 0;
padding: 0;
}
</style>
<!--
Redoc element with link to your OpenAPI definition
-->
<div id="redoc-container">
<redoc spec-url='{{ $url }}' hide-hostname="true" suppress-warnings="true" lazy-rendering native-scrollbars scroll-y-offset=".js-navbar-scroll" {{ $otheroptions }}></redoc>
</div>
<!--
Link to Redoc JavaScript on CDN for rendering standalone element
-->
<script src="https://cdn.jsdelivr.net/npm/redoc@latest/bundles/redoc.standalone.js"></script>
@@ -1,15 +0,0 @@
{{ $original := .Get "src" }}
<div id="docsy_swagger_ui"></div>
<script>
window.onload = function () {
const ui = SwaggerUIBundle({
url: {{ $original | relURL }},
dom_id: '#docsy_swagger_ui',
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
]
});
window.ui = ui;
};
</script>
@@ -1,55 +0,0 @@
{{- /* Make sure that we are enclosed within a tabpane shortcode block */ -}}
{{ with $.Parent -}}
{{ if ne $.Parent.Name "tabpane" -}}
{{ errorf "Found shortcode %q enclosed inside a %q block, must be enclosed inside a %q block. Error position: %s" $.Name $.Parent.Name "tabpane" $.Position -}}
{{ end -}}
{{ else -}}
{{ errorf "shortcode %q must be enclosed inside a %q block, but no parent block was found. Error position: %s" $.Name "tabpane" $.Position -}}
{{ end -}}
{{ $header := "Tab" -}}
{{ if and (not .IsNamedParams) (.Get 0) -}}
{{ $header = (.Get 0) -}}
{{ else -}}
{{/* Prefill header if not given as named or unnamed parameter */ -}}
{{ $header = .Get "header" | default (printf "Tab %v" .Ordinal) -}}
{{ end -}}
{{/* store all tab info in dict tab */ -}}
{{ $tab := dict "header" $header -}}
{{ with $.Get "lang" -}}
{{ $tab = merge $tab (dict "language" .) -}}
{{ end -}}
{{ with $.Get "highlight" -}}
{{ $tab = merge $tab (dict "highlight" .) -}}
{{ end -}}
{{ with $.Get "text" -}}
{{ if ne ( printf "%T" . ) "bool" -}}
{{ errorf "Shortcode %q: boolean value expected for parameter %q, but got %s. Error position: %s" $.Name "text" (printf "%T" .) $.Position -}}
{{ end -}}
{{ $tab = merge $tab (dict "text" .) -}}
{{ end -}}
{{ with $.Get "right" -}}
{{ if ne ( printf "%T" . ) "bool" -}}
{{ errorf "Shortcode %q: boolean value expected for parameter %q, but got %s. Error position: %s" $.Name "right" (printf "%T" .) $.Position -}}
{{ end -}}
{{ $tab = merge $tab (dict "rightpush" .) -}}
{{ end -}}
{{ with $.Get "disabled" -}}
{{ if ne ( printf "%T" . ) "bool" -}}
{{ errorf "Shortcode %q: boolean value expected for parameter %q, but got %s. Error position: %s" $.Name "disabled" (printf "%T" .) $.Position -}}
{{ end -}}
{{ $tab = merge $tab (dict "disabled" .) -}}
{{ end -}}
{{ with $.Inner -}}
{{/* Trim any leading and trailing newlines from .Inner, this avoids
spurious lines during syntax highlighting */ -}}
{{ $tab = merge $tab (dict "content" .) -}}
{{ end -}}
{{/* add dict tab to parent's scratchpad */ -}}
{{ with .Parent -}}
{{ $.Parent.Scratch.SetInMap "tabs" (printf "%02v" $.Ordinal) $tab -}}
{{ end -}}
@@ -1,175 +0,0 @@
{{/* Check parameter types */ -}}
{{ $tpPersistAttrName := "data-td-tp-persist" -}}
{{ with .Get "langEqualsHeader" -}}
{{ if ne ( printf "%T" . ) "bool" -}}
{{ errorf "Shortcode %q: boolean value expected for parameter %q, but got %s. Error position: %s" $.Name "langEqualsHeader" (printf "%T" .) $.Position -}}
{{ end -}}
{{ end -}}
{{ with .Get "text" -}}
{{ if ne ( printf "%T" . ) "bool" -}}
{{ errorf "Shortcode %q: boolean value expected for parameter %q, but got %s. Error position: %s" $.Name "text" (printf "%T" .) $.Position -}}
{{ end -}}
{{ end -}}
{{ $_persistLang := .Get "persistLang" -}}
{{ if and (ne $_persistLang nil) (ne $_persistLang "") -}}
{{ if ne ( printf "%T" $_persistLang ) "bool" -}}
{{ errorf "Shortcode %q: boolean value expected for parameter %q, but got %s. Error position: %s" $.Name "persistLang" (printf "%T" $_persistLang) $.Position -}}
{{ else -}}
{{ warnf "Shortcode %q parameter `persistLang` is deprecated, use `persist` instead: %s" $.Name $.Position -}}
{{ end -}}
{{ end -}}
{{ $_persist := .Get "persist" -}}
{{ with $_persist -}}
{{ $matched := findRE "^(header|lang|disabled)$" . -}}
{{ if not $matched -}}
{{ errorf "Shortcode %q: parameter %q should be one of 'header', 'lang', or 'disabled'; but got %s. Error position: %s" $.Name "persist" $_persist $.Position -}}
{{ end -}}
{{ end -}}
{{ with .Get "right" -}}
{{ if ne ( printf "%T" . ) "bool" -}}
{{ errorf "Shortcode %q: boolean value expected for parameter %q, but got %s. Error position: %s" $.Name "right" (printf "%T" .) $.Position -}}
{{ end -}}
{{ end -}}
{{/* Set values given defined within tabpane */ -}}
{{ $langPane := default "" ($.Get "lang") -}}
{{ $hloptionsPane := default "" ($.Get "highlight") -}}
{{ $textPane := default false ($.Get "text") -}}
{{ $langEqualsHeader := default false ($.Get "langEqualsHeader") -}}
{{ $deprecatedPersistLang := $_persistLang | default true -}}
{{ $persistKeyKind := $_persist
| default (cond (or $textPane (ne "" $langPane)) "header" "lang") -}}
{{ $persistTabpane := and $deprecatedPersistLang (ne $persistKeyKind "disabled") -}}
{{ $rightPane := default false ($.Get "right") -}}
{{ $activeSet := false -}}
{{/* Scratchpad gets populated through call to .Inner */ -}}
{{ .Inner -}}
{{ $duplicate := false -}}
{{ $duplicateKey := "" -}}
{{ $persistKeyList := slice -}}
{{ $tabPaneOrdinal := .Ordinal -}}
{{/* Nav tabs */ -}}
<ul class="nav nav-tabs{{ if $rightPane }} justify-content-end{{ end }}" id="tabs-{{- $tabPaneOrdinal -}}" role="tablist">
{{ range $index, $element := $.Scratch.Get "tabs" -}}
{{ $enabled := not $element.disabled -}}
{{ $lang := $langPane -}}
{{ if $langEqualsHeader -}}
{{ $lang = $element.header -}}
{{ end -}}
{{ with $element.language -}}
{{ $lang = . -}}
{{ end -}}
{{ $persistKey := "" -}}
{{ if eq $persistKeyKind "lang" -}}
{{ with $lang -}}
{{ $persistKey = . -}}
{{ else -}}
{{ with findRE "```(\\S+)" $element.content 1 -}}
{{ $persistKey = index . 1 -}}
{{ end -}}
{{ end -}}
{{ else if eq $persistKeyKind "header" -}}
{{ $persistKey = $element.header -}}
{{ end -}}
{{ $persistKey = $persistKey | lower -}}
{{ $persistTab := and $persistTabpane $persistKey $enabled -}}
{{/* Check for duplicate tab-persistence keys */ -}}
{{ if $persistTab -}}
{{ if in $persistKeyList $persistKey -}}
{{ $duplicate = true -}}
{{ $duplicateKey = $persistKey -}}
{{ $persistTab = false -}}
{{ else -}}
{{ $persistKeyList = $persistKeyList | append $persistKey -}}
{{ end -}}
{{ end -}}
{{ $rightpush := false -}}
{{ with $element.rightpush -}}
{{ $rightpush = . -}}
{{ end -}}
<li class="nav-item{{ if $rightpush }} ms-auto{{ end -}}">
{{/* Generate the IDs for the <a> and the <div> elements */ -}}
{{ $tabid := printf "tabs-%02v-%v-tab" $tabPaneOrdinal $index | anchorize -}}
{{ $entryid := printf "tabs-%02v-%v" $tabPaneOrdinal $index | anchorize -}}
{{ $isActive := and $enabled (not $activeSet) -}}
<button class="nav-link
{{- if $isActive -}}
{{ $activeSet = true }} active
{{- end -}}
{{ if not $enabled }} disabled{{ end -}}"
id="{{ $tabid }}" data-bs-toggle="tab" data-bs-target="#{{ $entryid }}" role="tab"
{{ if $persistTab -}}
{{ printf "%s=%q " $tpPersistAttrName $persistKey | safeHTMLAttr -}}
{{ end -}}
aria-controls="{{- $entryid -}}" aria-selected="{{ $isActive }}">
{{ index . "header" | markdownify }}
</button>
</li>
{{- end }}
</ul>
{{ if $duplicate -}}
{{ warnf "Shortcode %q: duplicate tab-persistence key %q detected, disabling persistance to avoid multiple tab display. Position: %s" $.Name $duplicateKey $.Position -}}
{{ end -}}
{{ $activeSet = false -}}
{{/* Tab panes */ -}}
<div class="tab-content" id="tabs-{{ $tabPaneOrdinal }}-content">
{{- range $index, $element := $.Scratch.Get "tabs" -}}
{{ $lang := $langPane -}}
{{ if $langEqualsHeader -}}
{{ $lang = $element.header -}}
{{ end -}}
{{ with $element.language -}}
{{ $lang = . -}}
{{ end -}}
{{ $enabled := not $element.disabled -}}
{{ $hloptions := $hloptionsPane -}}
{{ with $element.highlight -}}
{{ $hloptions = . -}}
{{ end -}}
{{ $text := $textPane -}}
{{ with $element.text -}}
{{ $text = . }}
{{ end -}}
{{ $tabid := printf "tabs-%02v-%v-tab" $tabPaneOrdinal $index | anchorize -}}
{{ $entryid := printf "tabs-%02v-%v" $tabPaneOrdinal $index | anchorize }}
{{ $isActive := and $enabled (not $activeSet) -}}
<div class="{{ if $text }}tab-body {{end}}tab-pane fade
{{- if $isActive -}}
{{ $activeSet = true }} show active
{{- end }}"
id="{{ $entryid }}" role="tabpanel" aria-labelled-by="{{ $tabid }}" tabindex="{{ $tabPaneOrdinal }}">
{{ if $text -}}
{{ index . "content" -}}
{{ else -}}
{{ highlight (trim (index . "content") "\r\n") $lang $hloptions -}}
{{ end }}
</div>
{{- end }}
</div>