|
|
@ -83,11 +83,17 @@ func main() { |
|
|
|
log.Fatalln(err) |
|
|
|
} |
|
|
|
|
|
|
|
// Change the story title
|
|
|
|
title := result.Name |
|
|
|
if strings.HasPrefix(result.Source, "#") { |
|
|
|
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 = 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) |
|
|
|