blog/layouts/shortcodes/tikz.html
Bruno BELANYI a6bbb10098 layouts: tikz: allow using file input
Makes it easier to handle big diagrams.
2024-08-10 11:56:04 +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>