Commit 3fd3feef authored by Matthew Holt's avatar Matthew Holt

Add Ext action to template context (closes #844)

parent 62622eb8
......@@ -7,6 +7,7 @@ import (
"net"
"net/http"
"net/url"
"path"
"strings"
"text/template"
"time"
......@@ -158,6 +159,13 @@ func (c Context) StripHTML(s string) string {
return buf.String()
}
// Ext returns the suffix beginning at the final dot in the final
// slash-separated element of the pathStr (or in other words, the
// file extension).
func (c Context) Ext(pathStr string) string {
return path.Ext(pathStr)
}
// StripExt returns the input string without the extension,
// which is the suffix starting with the final '.' character
// but not before the final path separator ('/') character.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment