1
0
mirror of https://github.com/actix/actix-website synced 2025-01-23 00:25:55 +01:00
actix-website/layouts/shortcodes/include-example.html

8 lines
371 B
HTML
Raw Normal View History

2018-05-23 21:28:12 +02:00
{{$example := .Get "example"}}
{{$file := .Get "file" | default "main.rs"}}
{{$section := .Get "section"}}
{{$source := readFile (printf "examples/%s/src/%s" $example $file)}}
{{$source := index (findRE (printf "(?ms)// <%s>$(.*?)// </%s>" $section $section) $source) 0 }}
{{$source := trim (replaceRE "// <[^>]+>" "" $source) "\n" }}
{{- highlight $source "rust" "" -}}