{{- /* Shortcode docviewer: Renders a document (e.g. in PDF or ODF format) using client-side webbrowser plugins ; supported formats depends on the browser Named arguments : - path (MANDATORY): the path of the input file, relative to the "static" folder. E.g. use "doc/mydoc.pdf" to render the file "static/doc/mydoc.pdf" - id, class : the HTML class & id attributes for the section; by default : no id and class "docviewer-container" - style: specific style properties; by default : "height: 60vh;" */ -}} {{- /* Check mandatory argument path */ -}} {{- with $path := .Get "path" -}} {{/* Now retrieve other arguments */}} {{- $id := or ($.Get "id") "" -}} {{- $class := or ($.Get "class") "docviewer-container" -}} {{- $style := or ($.Get "style") "height: 60vh;" -}} {{- /* Define attributes map. */ -}} {{- $attrs := dict "class" $class "id" $id "style" $style -}}
{{ else }} {{/* In case of missing path argument */}} {{ errorf "The %q shortcode requires an argument named path. See %s" .Name .Position }} {{ end }}