summaryrefslogtreecommitdiffstats
path: root/docs/layouts/shortcodes
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-06-26 20:46:06 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-06-26 20:46:06 +0200
commita7765bb3c117efa93866556d2b5b129dae7768bf (patch)
treed0df162c8d2801006863cb89c9640c89213644b2 /docs/layouts/shortcodes
parent31393f6024416ea1b2e61d1080dfd7104df36eda (diff)
parentdd78d5b23fe597f4461aa4199401b4e07c0612e2 (diff)
Diffstat (limited to 'docs/layouts/shortcodes')
-rw-r--r--docs/layouts/shortcodes/datatable-vertical.html26
-rw-r--r--docs/layouts/shortcodes/datatable.html23
-rw-r--r--docs/layouts/shortcodes/directoryindex.html13
-rw-r--r--docs/layouts/shortcodes/gh.html9
-rw-r--r--docs/layouts/shortcodes/nohighlight.html1
-rw-r--r--docs/layouts/shortcodes/readfile.html1
-rw-r--r--docs/layouts/shortcodes/youtube.html4
7 files changed, 77 insertions, 0 deletions
diff --git a/docs/layouts/shortcodes/datatable-vertical.html b/docs/layouts/shortcodes/datatable-vertical.html
new file mode 100644
index 000000000..1d2629eca
--- /dev/null
+++ b/docs/layouts/shortcodes/datatable-vertical.html
@@ -0,0 +1,26 @@
+{{ $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">
+ {{ range $list }}
+ {{ range $k, $v := . }}
+ {{ $.Scratch.Set $k $v }}
+ {{ end }}
+ {{ end }}
+
+ {{ range $i, $_ := $fields }}
+ <tr>
+ {{ $.Scratch.Set "i" $i }}
+
+ {{ $field := (index $fields ($.Scratch.Get "i") ) }}
+ <th>{{ $field }}</th>
+ {{ range $list }}
+ <td>
+ {{ index . $field }}
+ </td>
+ {{ end }}
+
+ </tr>
+ {{ end }}
+</table> \ No newline at end of file
diff --git a/docs/layouts/shortcodes/datatable.html b/docs/layouts/shortcodes/datatable.html
new file mode 100644
index 000000000..f40605404
--- /dev/null
+++ b/docs/layouts/shortcodes/datatable.html
@@ -0,0 +1,23 @@
+{{ $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..02a4efadc
--- /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 }}"> {{ .Name }}</a></td>
+ </tr>
+{{- end }}
+</table>
diff --git a/docs/layouts/shortcodes/gh.html b/docs/layouts/shortcodes/gh.html
new file mode 100644
index 000000000..0a28bf121
--- /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/gohugoio/hugo/commit/{{ substr . 2 }}">{{ substr . 2 6 }}</a>
+{{ else }}
+<a href="//github.com/gohugoio/hugo/issues/{{ . }}">#{{ . }}</a>
+{{ end }}
+{{ end }}
diff --git a/docs/layouts/shortcodes/nohighlight.html b/docs/layouts/shortcodes/nohighlight.html
new file mode 100644
index 000000000..d9cb5f302
--- /dev/null
+++ b/docs/layouts/shortcodes/nohighlight.html
@@ -0,0 +1 @@
+<pre><code class="hljs nohighlight">{{ .Inner }}</code></pre>
diff --git a/docs/layouts/shortcodes/readfile.html b/docs/layouts/shortcodes/readfile.html
new file mode 100644
index 000000000..f5b3459bf
--- /dev/null
+++ b/docs/layouts/shortcodes/readfile.html
@@ -0,0 +1 @@
+{{- .Get 0 | readFile -}}
diff --git a/docs/layouts/shortcodes/youtube.html b/docs/layouts/shortcodes/youtube.html
new file mode 100644
index 000000000..ce7dd0508
--- /dev/null
+++ b/docs/layouts/shortcodes/youtube.html
@@ -0,0 +1,4 @@
+<div class="video-container">
+<iframe class="youtube-player" type="text/html" width="100%" height="auto" src="https://www.youtube.com/embed/{{ index .Params 0 }}" allowfullscreen frameborder="0">
+</iframe>
+</div>