From d05edb0fe040d458dee8f42e5ac8522e561e8a0f Mon Sep 17 00:00:00 2001 From: Ryan Watters Date: Sun, 4 Jun 2017 16:55:36 -0500 Subject: [PATCH] Move all shortcodes out of theme and into project dir --- layouts/shortcodes/articlelist.html | 18 ++++++++++++++++++ layouts/shortcodes/code.html | 15 +++++++++++++++ layouts/shortcodes/directoryindex.html | 13 +++++++++++++ layouts/shortcodes/docfile.html | 11 +++++++++++ layouts/shortcodes/exfile.html | 12 ++++++++++++ layouts/shortcodes/exfm.html | 13 +++++++++++++ layouts/shortcodes/gh.html | 9 +++++++++ layouts/shortcodes/ghrepo.html | 1 + layouts/shortcodes/needsexamples.html | 7 +++++++ layouts/shortcodes/nohighlight.html | 1 + layouts/shortcodes/note.html | 8 ++++++++ layouts/shortcodes/output.html | 11 +++++++++++ layouts/shortcodes/readfile.html | 6 ++++++ layouts/shortcodes/tip.html | 8 ++++++++ layouts/shortcodes/warning.html | 8 ++++++++ layouts/shortcodes/yt.html | 11 +++++++++++ 16 files changed, 152 insertions(+) create mode 100644 layouts/shortcodes/articlelist.html create mode 100644 layouts/shortcodes/code.html create mode 100644 layouts/shortcodes/directoryindex.html create mode 100644 layouts/shortcodes/docfile.html create mode 100644 layouts/shortcodes/exfile.html create mode 100644 layouts/shortcodes/exfm.html create mode 100644 layouts/shortcodes/gh.html create mode 100644 layouts/shortcodes/ghrepo.html create mode 100644 layouts/shortcodes/needsexamples.html create mode 100644 layouts/shortcodes/nohighlight.html create mode 100644 layouts/shortcodes/note.html create mode 100644 layouts/shortcodes/output.html create mode 100644 layouts/shortcodes/readfile.html create mode 100644 layouts/shortcodes/tip.html create mode 100644 layouts/shortcodes/warning.html create mode 100644 layouts/shortcodes/yt.html diff --git a/layouts/shortcodes/articlelist.html b/layouts/shortcodes/articlelist.html new file mode 100644 index 000000000..2755b1e2d --- /dev/null +++ b/layouts/shortcodes/articlelist.html @@ -0,0 +1,18 @@ + + + + + + + {{ range $ind, $art := $.Site.Data.articles.article }} + + + + + + {{ end }} + +
Title + Author + Date +
{{$art.title | markdownify }}{{ $art.author | markdownify }}{{ $art.date }}
diff --git a/layouts/shortcodes/code.html b/layouts/shortcodes/code.html new file mode 100644 index 000000000..6df49956a --- /dev/null +++ b/layouts/shortcodes/code.html @@ -0,0 +1,15 @@ +
+ {{- with .Get "file" -}} +
{{.}}
+ {{- end -}} + + {{ if ne (.Get "copy") "false" }} + + {{/* 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}} +
+ {{- .Inner -}} +
+ +
diff --git a/layouts/shortcodes/directoryindex.html b/layouts/shortcodes/directoryindex.html new file mode 100644 index 000000000..37e7d3ad1 --- /dev/null +++ b/layouts/shortcodes/directoryindex.html @@ -0,0 +1,13 @@ +{{- $pathURL := .Get "pathURL" -}} +{{- $path := .Get "path" -}} +{{- $files := readDir $path -}} + + + +{{- range $files }} + + + + +{{- end }} +
Size in bytesName
{{ .Size }} {{ .Name }}
diff --git a/layouts/shortcodes/docfile.html b/layouts/shortcodes/docfile.html new file mode 100644 index 000000000..2f982aae8 --- /dev/null +++ b/layouts/shortcodes/docfile.html @@ -0,0 +1,11 @@ +{{ $file := .Get 0}} +{{ $filepath := $file }} +{{ $syntax := index (split $file ".") 1 }} +{{ $syntaxoverride := eq (len .Params) 2 }} +
+
{{$filepath}}
+ +
{{- readFile $file -}}
+
diff --git a/layouts/shortcodes/exfile.html b/layouts/shortcodes/exfile.html new file mode 100644 index 000000000..226782957 --- /dev/null +++ b/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 }} +
+
{{$filepath}}
+ +
{{- readFile $file -}}
+ Source +
diff --git a/layouts/shortcodes/exfm.html b/layouts/shortcodes/exfm.html new file mode 100644 index 000000000..c0429bbe1 --- /dev/null +++ b/layouts/shortcodes/exfm.html @@ -0,0 +1,13 @@ + +{{ $file := .Get 0}} +{{ $filepath := replace $file "static/" ""}} +{{ $syntax := index (split $file ".") 1 }} +{{ $syntaxoverride := eq (len .Params) 2 }} +
+
{{$filepath}}
+ +
{{- readFile $file -}}
+ Source +
\ No newline at end of file diff --git a/layouts/shortcodes/gh.html b/layouts/shortcodes/gh.html new file mode 100644 index 000000000..0d1a9498e --- /dev/null +++ b/layouts/shortcodes/gh.html @@ -0,0 +1,9 @@ +{{ range .Params }} + {{ if eq (substr . 0 1) "@" }} + {{ . }} + {{ else if eq (substr . 0 2) "0x" }} + {{ substr . 2 6 }} + {{ else }} + #{{ . }} + {{ end }} +{{ end }} \ No newline at end of file diff --git a/layouts/shortcodes/ghrepo.html b/layouts/shortcodes/ghrepo.html new file mode 100644 index 000000000..e9df40d6a --- /dev/null +++ b/layouts/shortcodes/ghrepo.html @@ -0,0 +1 @@ +GitHub repository \ No newline at end of file diff --git a/layouts/shortcodes/needsexamples.html b/layouts/shortcodes/needsexamples.html new file mode 100644 index 000000000..05644fe9e --- /dev/null +++ b/layouts/shortcodes/needsexamples.html @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/layouts/shortcodes/nohighlight.html b/layouts/shortcodes/nohighlight.html new file mode 100644 index 000000000..238234f17 --- /dev/null +++ b/layouts/shortcodes/nohighlight.html @@ -0,0 +1 @@ +
{{ .Inner }}
\ No newline at end of file diff --git a/layouts/shortcodes/note.html b/layouts/shortcodes/note.html new file mode 100644 index 000000000..fcf081bd5 --- /dev/null +++ b/layouts/shortcodes/note.html @@ -0,0 +1,8 @@ + diff --git a/layouts/shortcodes/output.html b/layouts/shortcodes/output.html new file mode 100644 index 000000000..df1a8ae89 --- /dev/null +++ b/layouts/shortcodes/output.html @@ -0,0 +1,11 @@ +{{$file := .Get "file"}} +{{$icon := index (split $file ".") 1 }} +
+
{{$file}}
+ +
+ {{- .Inner -}} +
+
\ No newline at end of file diff --git a/layouts/shortcodes/readfile.html b/layouts/shortcodes/readfile.html new file mode 100644 index 000000000..f777abe26 --- /dev/null +++ b/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/layouts/shortcodes/tip.html b/layouts/shortcodes/tip.html new file mode 100644 index 000000000..0b56ac560 --- /dev/null +++ b/layouts/shortcodes/tip.html @@ -0,0 +1,8 @@ + diff --git a/layouts/shortcodes/warning.html b/layouts/shortcodes/warning.html new file mode 100644 index 000000000..d05057e59 --- /dev/null +++ b/layouts/shortcodes/warning.html @@ -0,0 +1,8 @@ + diff --git a/layouts/shortcodes/yt.html b/layouts/shortcodes/yt.html new file mode 100644 index 000000000..6915cec5f --- /dev/null +++ b/layouts/shortcodes/yt.html @@ -0,0 +1,11 @@ +
+ + {{if (.Get "thumbnail")}} +
+ {{else}} +
+ {{end}} +
+{{ if (.Get "description") }} +
{{ .Get "description" | markdownify }}
+{{ end }} \ No newline at end of file