Welcome to mirror list, hosted at ThFree Co, Russian Federation.

code.html « shortcodes « layouts - github.com/vantagedesign/ace-documentation.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5d8a77808eb7e8090d3b349f90dac543127398b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{{ .Scratch.Set "content" "" }}
{{ .Scratch.Set "identifier" "" }}

{{ $identifier := "" }}
{{ $filepath := .Get "file"}}
{{ if ($filepath) }}
    {{ .Scratch.Set "content" ($filepath | readFile) }}
    {{ .Scratch.Set "identifier" (first 10 (md5 (.Scratch.Get "content"))) }}
{{ else }}
    {{ .Scratch.Set "content" .Inner }}
    {{ .Scratch.Set "identifier" (first 10 (md5 .Inner)) }}
{{ end}}

{{ $lang := .Get "lang" }}

<div class="position-relative">
    <div class="position-absolute" style="right:0;">
        <button class="btn btn-light" data-clipboard-target="#{{printf "clipboard_%s" (.Scratch.Get "identifier") }}">
        Copy
        </button>
    </div>
    <div id="{{printf "clipboard_%s" (.Scratch.Get "identifier") }}">
    {{ (print "```" $lang "\n" (.Scratch.Get "content") "\n```") | markdownify }}
    </div>
</div>