Commits

Josh Rickmar committed 11c52de

Make the '\.md$' regexp a global to avoid compiling it each time.

  • Participants
  • Parent commits 299c600

Comments (0)

Files changed (1)

 	ignoreRegExp = flag.String(`ignore`, ``, `ignore regexp`)
 	tmplFlag     = flag.String(`tmpl`, ``, `template file`)
 	mdParser     = markdown.NewParser(&markdown.Extensions{Smart: true})
+	mdExtMatch   = regexp.MustCompile(`\.md$`)
 	tmplParser   *template.Template
 )
 
 	parts := strings.Split(path, string(filepath.Separator))
 	parts[0] = parts[0] + `.static`
 	last := &parts[len(parts)-1]
-	re := regexp.MustCompile(`\.md$`)
-	*last = re.ReplaceAllLiteralString(*last, `.html`)
+	*last = mdExtMatch.ReplaceAllLiteralString(*last, `.html`)
 	destPath = strings.Join(parts, string(filepath.Separator))
 	fi, err := os.Stat(path)
 	if err == nil && !fi.IsDir() {