mirror of
https://github.com/romdo/go-conver.git
synced 2026-02-19 08:16:40 +00:00
wip: start of commit package
This commit is contained in:
21
pkg/commit/parser.go
Normal file
21
pkg/commit/parser.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package commit
|
||||
|
||||
import "bytes"
|
||||
|
||||
const (
|
||||
cr = 13
|
||||
lf = 10
|
||||
)
|
||||
|
||||
func paragraphs(input []byte) [][]byte {
|
||||
cln := bytes.ReplaceAll(input, []byte{cr, lf}, []byte{lf})
|
||||
cln = bytes.ReplaceAll(cln, []byte{cr}, []byte{lf})
|
||||
|
||||
ps := bytes.Split(cln, []byte{lf, lf})
|
||||
|
||||
for i, p := range ps {
|
||||
ps[i] = bytes.Trim(p, "\r\n")
|
||||
}
|
||||
|
||||
return ps
|
||||
}
|
||||
Reference in New Issue
Block a user