Load presets from front matter + allow both bundled and global bergamot files
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
parent
dee7579b29
commit
3a281dfa8a
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
window.addEventListener('load', function() {
|
||||
window.Bergamot.renderPresets['{{ .name }}'] =
|
||||
{{ readFile (printf "static/bergamot/rendering/%s" .file) }};
|
||||
{{ .file }};
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -63,10 +63,18 @@
|
|||
{{ partial "defercss.html" (dict "url" $bergamotStyle.Permalink "extra" "") }}
|
||||
{{ if .Params.bergamot.render_presets }}
|
||||
{{ range $name, $rulefile := .Params.bergamot.render_presets }}
|
||||
{{ partial "bergamotrenderpreset.html" (dict "name" $name "file" $rulefile) }}
|
||||
{{ $file := default (resources.Get $rulefile) (page.Resources.Get $rulefile) }}
|
||||
{{ partial "bergamotrenderpreset.html" (dict "name" $name "file" $file.Content) }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ partial "bergamotrenderpreset.html" (dict "name" "default" "file" "minimal.bergamot") }}
|
||||
{{ partial "bergamotrenderpreset.html" (dict "name" "default" "file" (resources.Get "bergamot/rendering/minimal.bergamot").Content) }}
|
||||
{{ end }}
|
||||
{{ if .Params.bergamot.presets }}
|
||||
{{ range $name, $preset := .Params.bergamot.presets }}
|
||||
{{ $file := default (resources.Get $preset.file) (page.Resources.Get $preset.file) }}
|
||||
{{ $info := dict "name" $name "prompt" $preset.prompt "query" $preset.query "file" $file.Content "renderPreset" $preset.render_preset }}
|
||||
{{ partial "bergamotpreset.html" $info }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user