package httpd import ( "html/template" "path" "regexp" "strings" ) var ( preTag = regexp.MustCompile(`]*>`) imgTag = regexp.MustCompile(`]*>`) srcAttr = regexp.MustCompile(`\ssrc="([^"]*)"`) ) // focusableBlocks gives every
 a tab stop. A block wider than its
// column scrolls sideways, and without one a keyboard has no way to reach
// the end of a long line (#232).
func focusableBlocks(h template.HTML) template.HTML {
	return template.HTML(preTag.ReplaceAllStringFunc(string(h), func(m string) string {
		if strings.Contains(m, "tabindex") {
			return m
		}
		return `
= 0 {
				src = src[:i]
			}
			name = path.Base(src)
			name = strings.TrimSuffix(name, path.Ext(name))
			if name == "." || name == "/" {
				name = ""
			}
		}
		return `