Skip to content

Commit

Permalink
Back shortcodes
Browse files Browse the repository at this point in the history
Signed-off-by: mohin7 <[email protected]>
  • Loading branch information
mohin7 committed Jul 5, 2024
1 parent dd3b710 commit d05c123
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 0 deletions.
24 changes: 24 additions & 0 deletions shortcodes/catalogtable.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{/*
Usage: Render of a table of Stash addons
Format: {{% catalogtable "addon1" "addon2" "addon3" %}}
*/}}

<table>
<thead>
<tr>
<th>Addons</th>
<th>Usage</th>
<th>Available Versions</th>
</tr>
</thead>
<tbody>
{{- range $p := sort (index .Params) }}
{{- $versions := sort (index $.Page.Params "info" $p) -}}
<tr>
<td><a href="{{ printf `/docs/%s/addons/%s/README` (index $.Page.Params `info` `version`) $p }}">stash-{{ lower $p }}</a></td>
<td>Stash {{ title $p }} plugin</td>
<td><code>{{ index $versions 0 }}</code>{{ range after 1 $versions }}, <code>{{.}}</code>{{ end }}</td>
</tr>
{{- end }}
</tbody>
</table>
24 changes: 24 additions & 0 deletions shortcodes/code.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<div class="code-block-wrapper" id="codeblock-{{.Ordinal}}">
<div class="code-block-title">
<h4 class="is-hidden">{{ .Get "title" | default "sample" }}</h4>
<div class="copy-and-download">
<button class="download-here" title="Download">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="w-5 h-5">
<path
d="M10.75 2.75a.75.75 0 00-1.5 0v8.614L6.295 8.235a.75.75 0 10-1.09 1.03l4.25 4.5a.75.75 0 001.09 0l4.25-4.5a.75.75 0 00-1.09-1.03l-2.955 3.129V2.75z" />
<path
d="M3.5 12.75a.75.75 0 00-1.5 0v2.5A2.75 2.75 0 004.75 18h10.5A2.75 2.75 0 0018 15.25v-2.5a.75.75 0 00-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5z" />
</svg>

</button>
<button class="copy-here" data-clipboard-target="#codeblock-{{.Ordinal}} pre code" title="Copy"><svg
xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
class="w-6 h-6">
<path stroke-linecap="round" stroke-linejoin="round"
d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75" />
</svg>
</button>
</div>
</div>
{{.Inner | markdownify}}
</div>
13 changes: 13 additions & 0 deletions shortcodes/notice.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{/*
Usage: Show notice on a page.
Format: {{< notice type="notice-type" message="Your message" >}}
Available types: [warning, danger, success, info, dark, primary, link]
Ref: https://bulma.io/documentation/components/message/
*/}}


<article class="message is-{{ .Get "type" }}">
<div class="message-body">
{{- .Get "message" | markdownify -}} {{/* Use `markdownify` to render any markdown syntax of message */}}
</div>
</article>
14 changes: 14 additions & 0 deletions shortcodes/versionlist.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{/*
Usage: List all versions of a sub project.
Format: {{% versionlist "project-key" "link format used with printf" %}}
*/}}

{{ $p := .Get 0 }}
{{ $fmt := .Get 1 }}
{{ with sort (index $.Page.Params "info" $p) }}
<ul>
{{- range $v := . }}
<li><a href="{{printf $fmt $v}}">{{ $v }}</a></li>
{{- end }}
</ul>
{{ end }}

0 comments on commit d05c123

Please sign in to comment.