fix regexp. wrapping long lines
This commit is contained in:
parent
45d98cd506
commit
2d9c504241
9
dict.go
9
dict.go
@ -71,7 +71,7 @@ func main() {
|
||||
ml = 40
|
||||
}
|
||||
|
||||
re := regexp.MustCompile(`\('"„)`)
|
||||
re := regexp.MustCompile(`\\(['"„])`)
|
||||
for i, _ := range right {
|
||||
a := strings.Trim(right[i], `„"`)
|
||||
b := strings.Trim(left[i], `„"`)
|
||||
@ -80,6 +80,13 @@ func main() {
|
||||
if a == "" {
|
||||
continue
|
||||
}
|
||||
if len(a) > ml {
|
||||
if i := strings.LastIndex(a[:ml], " "); i > 0 {
|
||||
fmt.Printf("%*s\n", ml, a[:i])
|
||||
a = a[i:]
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: wrap when len(a) > ml
|
||||
fmt.Printf("%*s → %s\n", ml, a, b)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user