hugo/layouts/shortcodes/show-ex.html
raw| 1 | <!-- |
| 2 | Highlights file and provides download link. |
| 3 | Argument 1 = File path below /src/ |
| 4 | --> |
| 5 | {{- $src := (.Get "file") }} |
| 6 | {{- $lang := .Get "language" | default ("python") }} |
| 7 | {{- $opt := .Get "opt" | default ("linenos=table") }} |
| 8 | {{- $path := (printf "/static/py/auto/Examples/%s" $src) }} |
| 9 | {{- $file := $path | readFile }} |
| 10 | {{- highlight (print $file) $lang $opt }} |
| 11 | <a class="linktofile" |
| 12 | href="{{.Site.Params.url_blob}}/auto/Examples/{{(printf $src)}}"/>auto/Examples/{{$src}}</a> |