Skip to content

Commit

Permalink
examples/webster1913-convert: Cleaned up leading and trailing whitesp…
Browse files Browse the repository at this point in the history
…ace in parsed dictionary
  • Loading branch information
pgaskin committed Mar 8, 2020
1 parent b6f76da commit 6913bda
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions examples/webster1913-convert/webster1913/parser.go
Expand Up @@ -107,8 +107,8 @@ func Parse(r io.Reader, progress func(i int, w string)) (Dict, error) {
}
// attempt to split into etymology
if spl := strings.SplitN(entry.Info, " Etym: ", 2); len(spl) == 2 {
entry.Info = spl[0]
entry.Etymology = spl[1]
entry.Info = strings.TrimSpace(spl[0])
entry.Etymology = strings.TrimSpace(spl[1])
}
state = StateEntryExtra
default:
Expand Down Expand Up @@ -180,7 +180,10 @@ func Parse(r io.Reader, progress func(i int, w string)) (Dict, error) {
case blankLine:
// ignore
default:
meaning.Example += " " + string(lnt)
if meaning.Example != "" {
meaning.Example += " "
}
meaning.Example += string(lnt)
}
case StateEntrySynonym:
switch {
Expand Down

0 comments on commit 6913bda

Please sign in to comment.