implemented webServer, and implemented listPadsImporter

This commit is contained in:
arnaucode
2018-04-15 00:21:36 +02:00
parent 3691547c68
commit 3e0ef09e55
19 changed files with 420 additions and 5 deletions

23
webServer/files.go Normal file
View File

@@ -0,0 +1,23 @@
package main
import (
"io/ioutil"
"github.com/fatih/color"
blackfriday "gopkg.in/russross/blackfriday.v2"
)
func readFile(path string) string {
dat, err := ioutil.ReadFile(path)
if err != nil {
color.Red(path)
}
check(err)
return string(dat)
}
func fileToHTML(path string) (string, error) {
mdcontent := readFile(path)
htmlcontent := string(blackfriday.Run([]byte(mdcontent)))
return htmlcontent, nil
}