summaryrefslogtreecommitdiffstats
path: root/docs/layouts/shortcodes
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-08-10 17:18:22 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-08-10 17:18:22 +0200
commita1900826b93847ce2d88ce9f99666e5ef4808741 (patch)
treee567840e067bce976958e8a04bcca100a8cab531 /docs/layouts/shortcodes
parentd384c661fef16fcfb5551db4cc1a2e60fb7cbed2 (diff)
parentec4e6f9df2ab9ffdc62a3f59675369096e0d3f77 (diff)
Diffstat (limited to 'docs/layouts/shortcodes')
-rw-r--r--docs/layouts/shortcodes/asciicast.html2
-rw-r--r--docs/layouts/shortcodes/code.html17
-rw-r--r--docs/layouts/shortcodes/datatable.html22
-rw-r--r--docs/layouts/shortcodes/directoryindex.html13
-rw-r--r--docs/layouts/shortcodes/docfile.html11
-rw-r--r--docs/layouts/shortcodes/exfile.html12
-rw-r--r--docs/layouts/shortcodes/exfm.html13
-rw-r--r--docs/layouts/shortcodes/gh.html9
-rw-r--r--docs/layouts/shortcodes/ghrepo.html1
-rw-r--r--docs/layouts/shortcodes/nohighlight.html1
-rw-r--r--docs/layouts/shortcodes/note.html8
-rw-r--r--docs/layouts/shortcodes/output.html8
-rw-r--r--docs/layouts/shortcodes/readfile.html6
-rw-r--r--docs/layouts/shortcodes/tip.html8
-rw-r--r--docs/layouts/shortcodes/todo.html1
-rw-r--r--docs/layouts/shortcodes/warning.html8
-rw-r--r--docs/layouts/shortcodes/yt.html11
17 files changed, 151 insertions, 0 deletions
diff --git a/docs/layouts/shortcodes/asciicast.html b/docs/layouts/shortcodes/asciicast.html
new file mode 100644
index 000000000..ee23adc2d
--- /dev/null
+++ b/docs/layouts/shortcodes/asciicast.html
@@ -0,0 +1,2 @@
+{{ $id := .Get 0 }}
+<script type="text/javascript" src="https://asciinema.org/a/{{ $id }}.js" id="asciicast-{{ $id }}" data-rows="10" async></script>
diff --git a/docs/layouts/shortcodes/code.html b/docs/layouts/shortcodes/code.html
new file mode 100644
index 000000000..009aeb711
--- /dev/null
+++ b/docs/layouts/shortcodes/code.html
@@ -0,0 +1,17 @@
+{{ $file := .Get "file" }}
+{{ $isHTML := strings.HasSuffix $file "html" }}
+<div class="code relative bg-primary-color" id="{{ $file | urlize}}">
+ {{- with $file -}}
+ <div class="filename san-serif f6 dib lh-solid pl2 pv2">{{.}}</div>
+ {{- end -}}
+
+ {{ if ne (.Get "copy") "false" }}
+ <button class="needs-js copy bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button">
+ </button>
+ {{/* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}}
+ {{end}}
+ <div class="code-copy-content nt3" {{with .Get "download"}}id="{{.}}"{{end}}>
+ {{ if $isHTML }}{{- highlight .Inner "html" "" | -}}{{ else }}<pre><code>{{- .Inner | string -}}</code></pre>{{ end }}
+ </div>
+
+</div>
diff --git a/docs/layouts/shortcodes/datatable.html b/docs/layouts/shortcodes/datatable.html
new file mode 100644
index 000000000..4e2814f5a
--- /dev/null
+++ b/docs/layouts/shortcodes/datatable.html
@@ -0,0 +1,22 @@
+{{ $package := (index .Params 0) }}
+{{ $listname := (index .Params 1) }}
+{{ $list := (index (index .Site.Data.docs $package) $listname) }}
+{{ $fields := after 2 .Params }}
+
+<table class="table table-bordered">
+ <tr>
+ {{ range $fields }}
+ <th>{{ . }}</th>
+ {{ end }}
+ </tr>
+ {{ range $list }}
+ <tr>
+ {{ range $k, $v := . }}
+ {{ $.Scratch.Set $k $v }}
+ {{ end }}
+ {{ range $fields }}
+ <td>{{ $.Scratch.Get . }}</td>
+ {{ end }}
+ </tr>
+ {{ end }}
+</table>
diff --git a/docs/layouts/shortcodes/directoryindex.html b/docs/layouts/shortcodes/directoryindex.html
new file mode 100644
index 000000000..37e7d3ad1
--- /dev/null
+++ b/docs/layouts/shortcodes/directoryindex.html
@@ -0,0 +1,13 @@
+{{- $pathURL := .Get "pathURL" -}}
+{{- $path := .Get "path" -}}
+{{- $files := readDir $path -}}
+<table>
+ <th>Size in bytes</th>
+ <th>Name</th>
+{{- range $files }}
+ <tr>
+ <td>{{ .Size }}</td>
+ <td><a href="{{ $pathURL }}{{ .Name | relURL }}" target="_blank"> {{ .Name }}</a></td>
+ </tr>
+{{- end }}
+</table>
diff --git a/docs/layouts/shortcodes/docfile.html b/docs/layouts/shortcodes/docfile.html
new file mode 100644
index 000000000..2f982aae8
--- /dev/null
+++ b/docs/layouts/shortcodes/docfile.html
@@ -0,0 +1,11 @@
+{{ $file := .Get 0}}
+{{ $filepath := $file }}
+{{ $syntax := index (split $file ".") 1 }}
+{{ $syntaxoverride := eq (len .Params) 2 }}
+<div class="code-copy" id="{{$file | urlize}}">
+ <div class="code-copy-header"><div class="action-buttons"></div><span title="" class="filename">{{$filepath}}</span><i class="icon-{{$syntax}} input"></i></div>
+ <button class="copy-button" title="Copy to clipboard" data-clipboard-snippet>
+ <div class="copy-text"><i class="icon-clipboard"></i> COPY</div>
+ </button>
+ <pre><code class="language-{{if $syntaxoverride}}{{.Get 1}}{{else}}{{$syntax}}{{end}}">{{- readFile $file -}}</code></pre>
+</div>
diff --git a/docs/layouts/shortcodes/exfile.html b/docs/layouts/shortcodes/exfile.html
new file mode 100644
index 000000000..226782957
--- /dev/null
+++ b/docs/layouts/shortcodes/exfile.html
@@ -0,0 +1,12 @@
+{{ $file := .Get 0}}
+{{ $filepath := replace $file "static/" ""}}
+{{ $syntax := index (split $file ".") 1 }}
+{{ $syntaxoverride := eq (len .Params) 2 }}
+<div class="code-copy" id="{{$file | urlize}}">
+ <div class="code-copy-header examplesite"><div class="action-buttons"></div><span class="filename"><i class="icon-website"></i>{{$filepath}}</span><i class="icon-{{$syntax}} input"></i></div>
+ <button class="copy-button" title="Copy to clipboard" data-clipboard-snippet>
+ <div class="copy-text"><i class="icon-clipboard"></i> COPY</div>
+ </button>
+ <pre><code class="language-{{if $syntaxoverride}}{{.Get 1}}{{else}}{{$syntax}}{{end}}">{{- readFile $file -}}</code></pre>
+ <a role="button" target="_blank" href="{{$.Site.Params.ghdocsrepo}}{{$file}}" title="See {{$filepath}} source on GitHub" class="tooltip see-on-github" data-tooltip="See {{$filepath}} source on GitHub">Source<i class="icon-github"></i></a>
+</div>
diff --git a/docs/layouts/shortcodes/exfm.html b/docs/layouts/shortcodes/exfm.html
new file mode 100644
index 000000000..c0429bbe1
--- /dev/null
+++ b/docs/layouts/shortcodes/exfm.html
@@ -0,0 +1,13 @@
+<!-- Similar to exfile.html but *only* pulls the front matter from the example/content/*md -->
+{{ $file := .Get 0}}
+{{ $filepath := replace $file "static/" ""}}
+{{ $syntax := index (split $file ".") 1 }}
+{{ $syntaxoverride := eq (len .Params) 2 }}
+<div class="code-copy" id="{{$file | urlize}}">
+ <div class="code-copy-header examplesite"><div class="action-buttons"></div><span title="" class="filename">{{$filepath}}</span><i class="icon-{{$syntax}} input"></i></div>
+ <button class="copy-button" title="Copy to clipboard" data-clipboard-snippet>
+ <div class="copy-text"><i class="icon-clipboard"></i> COPY</div>
+ </button>
+ <pre><code class="language-{{if $syntaxoverride}}{{.Get 1}}{{else}}{{$syntax}}{{end}}">{{- readFile $file -}}</code></pre>
+ <a role="button" target="_blank" href="{{$.Site.Params.ghdocsrepo}}{{$file}}" title="See {{$filepath}} on GitHub" class="see-on-github">Source<i class="icon-github"></i></a>
+</div> \ No newline at end of file
diff --git a/docs/layouts/shortcodes/gh.html b/docs/layouts/shortcodes/gh.html
new file mode 100644
index 000000000..0d1a9498e
--- /dev/null
+++ b/docs/layouts/shortcodes/gh.html
@@ -0,0 +1,9 @@
+{{ range .Params }}
+ {{ if eq (substr . 0 1) "@" }}
+ <a href="//github.com/{{ substr . 1 }}">{{ . }}</a>
+ {{ else if eq (substr . 0 2) "0x" }}
+ <a href="//github.com/spf13/hugo/commit/{{ substr . 2 }}">{{ substr . 2 6 }}</a>
+ {{ else }}
+ <a href="//github.com/spf13/hugo/issues/{{ . }}">#{{ . }}</a>
+ {{ end }}
+{{ end }} \ No newline at end of file
diff --git a/docs/layouts/shortcodes/ghrepo.html b/docs/layouts/shortcodes/ghrepo.html
new file mode 100644
index 000000000..e9df40d6a
--- /dev/null
+++ b/docs/layouts/shortcodes/ghrepo.html
@@ -0,0 +1 @@
+<a href="{{$.Site.Params.ghrepo}}" target="_blank">GitHub repository</a> \ No newline at end of file
diff --git a/docs/layouts/shortcodes/nohighlight.html b/docs/layouts/shortcodes/nohighlight.html
new file mode 100644
index 000000000..238234f17
--- /dev/null
+++ b/docs/layouts/shortcodes/nohighlight.html
@@ -0,0 +1 @@
+<pre><code class="hljs nohighlight">{{ .Inner }}</code></pre> \ No newline at end of file
diff --git a/docs/layouts/shortcodes/note.html b/docs/layouts/shortcodes/note.html
new file mode 100644
index 000000000..fcf081bd5
--- /dev/null
+++ b/docs/layouts/shortcodes/note.html
@@ -0,0 +1,8 @@
+<aside class="admonition note">
+ <div class="note-icon">
+ {{partial "svg/exclamation.svg" (dict "size" "20px" ) }}
+ </div>
+ <!-- <h2 id="{{if .Get 0}}{{.Get 0 | urlize}}{{else}}note{{end}}">{{if .Get 0}}{{.Get 0 | markdownify}}{{else}}Note{{end}}</h2> -->
+ <!-- <h3>Note</h3> -->
+ <div class="admonition-content">{{- .Inner -}}</div>
+</aside>
diff --git a/docs/layouts/shortcodes/output.html b/docs/layouts/shortcodes/output.html
new file mode 100644
index 000000000..e51d284bb
--- /dev/null
+++ b/docs/layouts/shortcodes/output.html
@@ -0,0 +1,8 @@
+{{$file := .Get "file"}}
+{{$icon := index (split $file ".") 1 }}
+<div class="code" id="{{$file | urlize}}">
+ <div class="filename" title="{{$file}}">{{$file}}</div>
+ <div class="code-copy-content output-content">
+ <pre><code>{{- .Inner | string -}}</code></pre>
+ </div>
+</div> \ No newline at end of file
diff --git a/docs/layouts/shortcodes/readfile.html b/docs/layouts/shortcodes/readfile.html
new file mode 100644
index 000000000..f777abe26
--- /dev/null
+++ b/docs/layouts/shortcodes/readfile.html
@@ -0,0 +1,6 @@
+{{$file := .Get "file"}}
+{{- if eq (.Get "markdown") "true" -}}
+{{- $file | readFile | markdownify -}}
+{{- else -}}
+{{ $file | readFile | safeHTML }}
+{{- end -}} \ No newline at end of file
diff --git a/docs/layouts/shortcodes/tip.html b/docs/layouts/shortcodes/tip.html
new file mode 100644
index 000000000..0b56ac560
--- /dev/null
+++ b/docs/layouts/shortcodes/tip.html
@@ -0,0 +1,8 @@
+<aside class="admonition tip">
+ <div class="tip-icon">
+ {{partial "svg/exclamation.svg" .}}
+ </div>
+ <!-- <h2 id="{{if .Get 0}}{{.Get 0 | urlize}}{{else}}tip{{end}}">{{if .Get 0}}{{.Get 0 | markdownify}}{{else}}Tip{{end}}</h2> -->
+ <!-- <h3>Tip</h3> -->
+ <div class="admonition-content">{{- .Inner -}}</div>
+</aside>
diff --git a/docs/layouts/shortcodes/todo.html b/docs/layouts/shortcodes/todo.html
new file mode 100644
index 000000000..50a099267
--- /dev/null
+++ b/docs/layouts/shortcodes/todo.html
@@ -0,0 +1 @@
+{{ if .Inner }}{{ end }} \ No newline at end of file
diff --git a/docs/layouts/shortcodes/warning.html b/docs/layouts/shortcodes/warning.html
new file mode 100644
index 000000000..d05057e59
--- /dev/null
+++ b/docs/layouts/shortcodes/warning.html
@@ -0,0 +1,8 @@
+<aside class="admonition warning">
+ <div class="admonition-icon">
+ {{partial "svg/exclamation.svg" .}}
+ </div>
+ <!-- <h2 id="{{if .Get 0}}{{.Get 0 | urlize}}{{else}}warning{{end}}">{{if .Get 0}}{{.Get 0 | markdownify}}{{else}}Warning{{end}}</h2> -->
+ <!-- <h3>Warning</h3> -->
+ <div class="admonition-content">{{- .Inner -}}</div>
+</aside>
diff --git a/docs/layouts/shortcodes/yt.html b/docs/layouts/shortcodes/yt.html
new file mode 100644
index 000000000..6915cec5f
--- /dev/null
+++ b/docs/layouts/shortcodes/yt.html
@@ -0,0 +1,11 @@
+<div class="video-wrapper" data-streaming="youtube" data-videoid="{{.Get "id"}}" >
+ <i class="icon-video-play-button shortcode"></i>
+ {{if (.Get "thumbnail")}}
+ <div style="background-image:url(/images/thumbnails/{{.Get "thumbnail"}})" alt="YouTube Thumbnail" class="video-thumbnail"></div>
+ {{else}}
+ <div style="background-image:url(//img.youtube.com/vi/{{.Get "id"}}/0.jpg)" alt="YouTube Thumbnail" class="video-thumbnail"></div>
+ {{end}}
+</div>
+{{ if (.Get "description") }}
+<div class="video-description">{{ .Get "description" | markdownify }}</div>
+{{ end }} \ No newline at end of file