From 022939cc219bf267bd4509ac5265f6685b8a9338 Mon Sep 17 00:00:00 2001
From: berkas1 <berka@berkasimon.com>
Date: Fri, 28 May 2021 21:00:20 +0200
Subject: [PATCH] add csv-table shortcode

---
 layouts/shortcodes/csv-table.html | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 layouts/shortcodes/csv-table.html

diff --git a/layouts/shortcodes/csv-table.html b/layouts/shortcodes/csv-table.html
new file mode 100644
index 0000000..69c187f
--- /dev/null
+++ b/layouts/shortcodes/csv-table.html
@@ -0,0 +1,29 @@
+{{ $caption := .Get "caption" }}
+{{ $useHeaderRow := .Get "header" }}
+{{ $rows := .Inner | transform.Unmarshal }}
+
+
+
+<div class="custom-table-1" >
+<table class="sortable">
+  {{ with $caption }}<caption>{{ . }}</caption>{{ end }}
+  {{ if $useHeaderRow }}
+    {{ $headerRow := index $rows 0 }}
+    {{ $rows = after 1 $rows }}
+    <thead><tr> {{ range $headerRow }} <th>{{ . }}</th> {{ end }} </tr></thead>
+  {{ end }}
+  {{ range $rows }}
+    <tr>
+      {{ range . }}
+        {{ if (findRE "^\\d+$" .) }}
+          <td class="numeric">{{ . }}</td>
+        {{ else }}
+          <td>{{ . }}</td>
+        {{ end }}
+      {{ end }}
+    </tr>
+  {{ end }}
+</table>
+</div>
+
+
-- 
GitLab