Revert "Make syntax highlighting optional"
This reverts commit d597f04562
.
This commit is contained in:
parent
d597f04562
commit
1b46830f95
8
main.go
8
main.go
|
@ -2,13 +2,12 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/dchest/uniuri"
|
||||||
|
"github.com/ewhal/pygments"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/dchest/uniuri"
|
|
||||||
"github.com/ewhal/pygments"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -17,7 +16,6 @@ const (
|
||||||
LENGTH = 4
|
LENGTH = 4
|
||||||
TEXT = "$ <command> | curl -F 'p=<-' lang='python'" + ADDRESS + "\n"
|
TEXT = "$ <command> | curl -F 'p=<-' lang='python'" + ADDRESS + "\n"
|
||||||
PORT = ":8080"
|
PORT = ":8080"
|
||||||
SYNTAX = false
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func check(err error) {
|
func check(err error) {
|
||||||
|
@ -70,12 +68,10 @@ func pasteHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Error(w, err.Error(), 500)
|
http.Error(w, err.Error(), 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
if SYNTAX == true {
|
|
||||||
if param2 != "" {
|
if param2 != "" {
|
||||||
highlight := pygments.Highlight(string(s), param2, "html", "full, style=autumn,linenos=True, lineanchors=True,anchorlinenos=True,", "utf-8")
|
highlight := pygments.Highlight(string(s), param2, "html", "full, style=autumn,linenos=True, lineanchors=True,anchorlinenos=True,", "utf-8")
|
||||||
io.WriteString(w, string(highlight))
|
io.WriteString(w, string(highlight))
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
io.WriteString(w, string(s))
|
io.WriteString(w, string(s))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue