hugo

Fork of github.com/gohugoio/hugo with reverse pagination support

git clone git://git.shimmy1996.com/hugo.git

code.html (1211B)

    1 {{ $file := .Get "file" }}
    2 {{ $codeLang := "" }}
    3 {{ $suffix := findRE "(\\.[^.]+)$" $file 1 }}
    4 {{ with $suffix }}
    5 {{ $codeLang = (index . 0 | strings.TrimPrefix ".") }}
    6 {{ end }}
    7 {{ with .Get "codeLang" }}{{ $codeLang = . }}{{ end }}
    8 {{ if eq $codeLang "html" }}
    9 {{ $codeLang = "go-html-template" }}
   10 {{ end }}
   11 <div class="code relative" id="{{ $file | urlize }}">
   12 	{{- with $file -}}
   13 		<div class="filename san-serif f6 dib lh-solid pl2 pv2">{{ . }}</div>
   14 	{{- end -}}
   15 
   16 	{{ if ne (.Get "copy") "false" }}
   17 		<button class="needs-js copy bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button">
   18 		</button>
   19 		{{/* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}}
   20 	{{ end }}
   21 	<div class="code-copy-content nt3" {{ with .Get "download" }}id="{{ . }}"{{ end }}>
   22 		{{ $inner := trim .Inner "\n" | safeHTML }}
   23 		{{ if .Get "nocode" }}{{ $inner }}{{ else }}{{ with $codeLang }}{{ highlight $inner . "" }}{{ else }}<pre><code>{{ $inner }}</code></pre>{{ end }}{{ end }}
   24 	</div>
   25 
   26 </div>