layouts: tikz: allow using file input
Makes it easier to handle big diagrams.
This commit is contained in:
parent
189cdcf05a
commit
491041df09
|
@ -1,3 +1,16 @@
|
|||
<script type="text/tikz">
|
||||
{{.Inner}}
|
||||
{{ 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>
|
||||
|
|
Loading…
Reference in a new issue