extract readlines
This commit is contained in:
parent
bf2c0e032a
commit
16da6101d0
@ -30,6 +30,12 @@ func pipe(bin string, arg []string, src string) string {
|
|||||||
return string(bytes)
|
return string(bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func readLines(path string) []string {
|
||||||
|
srcBytes, err := ioutil.ReadFile(path)
|
||||||
|
check(err)
|
||||||
|
return strings.Split(string(srcBytes), "\n")
|
||||||
|
}
|
||||||
|
|
||||||
var docsPat = regexp.MustCompile("^\\s*(\\/\\/|#)\\s")
|
var docsPat = regexp.MustCompile("^\\s*(\\/\\/|#)\\s")
|
||||||
|
|
||||||
var headerPat = regexp.MustCompile("^\\s*(\\/\\/|#)\\s#+\\s")
|
var headerPat = regexp.MustCompile("^\\s*(\\/\\/|#)\\s#+\\s")
|
||||||
@ -50,9 +56,7 @@ func main() {
|
|||||||
pygmentizePath, err := exec.LookPath("pygmentize")
|
pygmentizePath, err := exec.LookPath("pygmentize")
|
||||||
check(err)
|
check(err)
|
||||||
|
|
||||||
srcBytes, err := ioutil.ReadFile(sourcePath)
|
lines := readLines(sourcePath)
|
||||||
check(err)
|
|
||||||
lines := strings.Split(string(srcBytes), "\n")
|
|
||||||
|
|
||||||
segs := []*seg{}
|
segs := []*seg{}
|
||||||
segs = append(segs, &seg{code: "", docs: ""})
|
segs = append(segs, &seg{code: "", docs: ""})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user