Skip to content

Commit

Permalink
fixing additional space issue while reading ttml
Browse files Browse the repository at this point in the history
  • Loading branch information
Avishek-Gulshan committed Jul 21, 2021
1 parent 24cd423 commit e48e299
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ttml.go
Expand Up @@ -451,7 +451,13 @@ func ReadFromTTML(i io.Reader) (o *Subtitles, err error) {
// New line decoded as a line break. This can happen if there's a "br" tag within the text since
// since the go xml unmarshaler will unmarshal a "br" tag as a line break if the field has the
// chardata xml tag.
for idx, li := range strings.Split(tt.Text, "\\n") {
if strings.TrimSpace(tt.Text) == "\\n" {
s.Lines = append(s.Lines, *l)
l = &Line{}
continue
}
temp := strings.Split(tt.Text, "\\n")
for idx, li := range temp {
// New line
if idx > 0 {
s.Lines = append(s.Lines, *l)
Expand Down

0 comments on commit e48e299

Please sign in to comment.