diff options
author | Oezguer Kesim <oec@codeblau.de> | 2015-07-28 10:41:44 +0200 |
---|---|---|
committer | Oezguer Kesim <oec@codeblau.de> | 2015-07-28 10:41:44 +0200 |
commit | 2d9c5042414a2280eaa5d0bad28a2865a9797499 (patch) | |
tree | 829eb51dadde9cc6302e1b4b60179f5b1845cac2 | |
parent | 45d98cd506926c3131ae91b2a79fc9976c7529b6 (diff) |
fix regexp. wrapping long lines
-rw-r--r-- | dict.go | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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) } |