Allow picking a specific file out of a gist

This commit is contained in:
Konstantin Kliakhandler
2016-03-11 08:02:57 -06:00
committed by Bjørn Erik Pedersen
parent 7cd69aaae8
commit e9008b91fa
2 changed files with 5 additions and 1 deletions

View File

@@ -58,7 +58,7 @@ func (t *GoHTMLTemplate) EmbedShortcodes() {
<iframe src="//player.vimeo.com/video/{{ .Get 0 }}" {{ if len .Params | eq 1 }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" {{ end }}webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
{{ end }}`)
t.AddInternalShortcode("gist.html", `<script src="//gist.github.com/{{ index .Params 0 }}/{{ index .Params 1 }}.js"></script>`)
t.AddInternalShortcode("gist.html", `<script src="//gist.github.com/{{ index .Params 0 }}/{{ index .Params 1 }}.js{{if len .Params | eq 3 }}?file={{ index .Params 2 }}{{end}}"></script>`)
t.AddInternalShortcode("tweet.html", `{{ (getJSON "https://api.twitter.com/1/statuses/oembed.json?id=" (index .Params 0)).html | safeHTML }}`)
}