Fixed newline shenanigans in rpdata-as2storyimport
the build was successful

This commit is contained in:
2018-07-07 12:53:52 +02:00
parent 0122f64fbb
commit 136302084d
+7 -1
View File
@@ -83,11 +83,17 @@ func main() {
log.Fatalln(err) log.Fatalln(err)
} }
// Change the story title
title := result.Name title := result.Name
if strings.HasPrefix(result.Source, "#") { if strings.HasPrefix(result.Source, "#") {
firstNewline := strings.Index(result.Source, "\n") firstNewline := strings.Index(result.Source, "\n")
title = result.Source[1:firstNewline] result.Name = strings.Replace(result.Source[1:firstNewline], "\r", "", -1)
result.Source = result.Source[firstNewline+1:] result.Source = result.Source[firstNewline+1:]
result.Source = strings.Replace(result.Source, "\r\n", "\n", -1)
if strings.HasPrefix(result.Source, "\r") || strings.HasPrefix(result.Source, "\n") {
result.Source = result.Source[1:]
}
} }
chapter, err := story.AddChapter(title, result.Author, result.Source, publishDate, fictionalDate) chapter, err := story.AddChapter(title, result.Author, result.Source, publishDate, fictionalDate)