Merge pull request #16 from minikomi/master
Use which to find pygmentize
This commit is contained in:
commit
cdc7265c57
@ -70,13 +70,12 @@ func mustReadFile(path string) string {
|
||||
func cachedPygmentize(lex string, src string) string {
|
||||
ensureDir(cacheDir)
|
||||
arg := []string{"-l", lex, "-f", "html"}
|
||||
bin := "/usr/local/bin/pygmentize"
|
||||
cachePath := cacheDir + "/pygmentize-" + strings.Join(arg, "-") + "-" + sha1Sum(src)
|
||||
cacheBytes, cacheErr := ioutil.ReadFile(cachePath)
|
||||
if cacheErr == nil {
|
||||
return string(cacheBytes)
|
||||
}
|
||||
renderBytes := pipe(bin, arg, src)
|
||||
renderBytes := pipe(pygmentizeBin, arg, src)
|
||||
writeErr := ioutil.WriteFile(cachePath, renderBytes, 0600)
|
||||
check(writeErr)
|
||||
return string(renderBytes)
|
||||
|
Loading…
x
Reference in New Issue
Block a user