blog/layouts/shortcodes/tikz.html
Bruno BELANYI 491041df09 layouts: tikz: allow using file input
Makes it easier to handle big diagrams.
2024-07-20 17:21:42 +01:00

17 lines
513 B
HTML

<script type="text/tikz">
{{ with .Get "file" }}
{{ if eq (. | printf "%.1s") "/" }}
{{/* Absolute path are from root of site. */}}
{{ $.Scratch.Set "filepath" . }}
{{ else }}
{{/* Relative paths are from page directory. */}}
{{ $.Scratch.Set "filepath" $.Page.File.Dir }}
{{ $.Scratch.Add "filepath" . }}
{{ end }}
{{ $.Scratch.Get "filepath" | readFile }}
{{ else }}
{{.Inner}}
{{ end }}
</script>