Debian Codegraph @

hugo/layouts/shortcodes/show-ex-collapsed.html

raw
1 <!--
2 Highlights file and provides download link, collapsed by default.
3 Argument file = File path below /src/
4 Argument title = Summary text (optional, defaults to filename)
5 -->
6 {{- $src := (.Get "file") }}
7 {{- $title := .Get "title" | default $src }}
8 {{- $lang := .Get "language" | default ("python") }}
9 {{- $opt := .Get "opt" | default ("linenos=table") }}
10 {{- $path := (printf "/static/py/auto/Examples/%s" $src) }}
11 {{- $file := $path | readFile }}
12 <details>
13 <summary>{{ $title }}</summary>
14 {{- highlight (print $file) $lang $opt }}
15 <a class="linktofile"
16 href="{{.Site.Params.url_blob}}/auto/Examples/{{(printf $src)}}"/>auto/Examples/{{$src}}</a>
17 </details>