diff --git a/wowchemy/layouts/shortcodes/table.html b/wowchemy/layouts/shortcodes/table.html new file mode 100644 index 00000000..41730879 --- /dev/null +++ b/wowchemy/layouts/shortcodes/table.html @@ -0,0 +1,36 @@ +{{/* Table Shortcode for Wowchemy. */}} +{{/* Load table from page dir falling back back to remote URL */}} +{{/* Supports delimiter separated files. The default delimiter is ',' */}} + +{{ $src := .Get "src" }} +{{ $delimiter := .Get "delimiter" | default "," }} +{{ $useHeaderRow := .Get "header" | default true }} +{{ $caption := .Get "caption" }} + +{{ $is_remote := strings.HasPrefix $src "http" }} +{{ if not $is_remote }} + {{ $src = path.Join "content" $.Page.File.Dir $src }} +{{ end }} +{{ $rows := getCSV $delimiter $src }} + + + {{ if $useHeaderRow }} + {{ $headerRow := index $rows 0 }} + {{ $rows = after 1 $rows }} + {{ range $headerRow }} {{ end }} + {{ end }} + {{ range $rows }} + + {{ range . }} + {{ if (findRE "^\\d+$" .) }} + + {{ else }} + + {{ end }} + {{ end }} + + {{ end }} + {{ if $caption }} + + {{ end }} +
{{ . | markdownify | emojify }}
{{ . }}{{ . | markdownify | emojify }}
{{ $caption | markdownify | emojify }}
\ No newline at end of file