diff --git a/src/syosetuDownloader/Syousetsu.cs b/src/syosetuDownloader/Syousetsu.cs index 24892e3..3de52f1 100644 --- a/src/syosetuDownloader/Syousetsu.cs +++ b/src/syosetuDownloader/Syousetsu.cs @@ -239,8 +239,8 @@ public static string GetNovelHeader(HtmlDocument doc, Constants.FileType fileTyp if (fileType == Constants.FileType.Text) { - string s = headerNode.InnerText; - s += Environment.NewLine + "=====" + Environment.NewLine; + string s = headerNode.InnerText.Trim(Environment.NewLine.ToCharArray()); + s += Environment.NewLine + Environment.NewLine + "=====" + Environment.NewLine + Environment.NewLine; return s; } else if (fileType == Constants.FileType.HTML) @@ -257,7 +257,8 @@ public static string GetNovelHeader(HtmlDocument doc, Constants.FileType fileTyp sb.AppendLine("
"); return sb.ToString(); - }else + } + else { return String.Empty; } @@ -311,7 +312,9 @@ public static string[] GenerateContents(Syousetsu.Constants details, HtmlDocumen if (details.CurrentFileType == Constants.FileType.Text) { chapter[0] = Methods.GetChapterTitle(doc).TrimStart().TrimEnd(); - chapter[1] = Methods.GetNovelBody(doc, details.CurrentFileType); + chapter[1] = Methods.GetNovelHeader(doc, details.CurrentFileType); + chapter[1] += chapter[0]; + chapter[1] += Methods.GetNovelBody(doc, details.CurrentFileType); if (doc.DocumentNode.SelectSingleNode("//div[@id='novel_honbun']").InnerHtml.Contains("\n"; chapter[1] += "\n"; - chapter[1] += "\n"; + chapter[1] += "\n "; + chapter[1] += Methods.GetNovelHeader(doc, details.CurrentFileType); chapter[1] += "\n

" + chapter[0] + "

\n\n"; chapter[1] += Methods.GetNovelBody(doc, details.CurrentFileType); @@ -364,10 +368,11 @@ public static void SaveFile(Syousetsu.Constants details, string[] chapter, int c { fileName = String.Format(fileName + ".htm", new object[] { current, chapter[0], details.SeriesCode }); - chapter[0] = String.Empty; File.WriteAllText(Path.Combine(path, "ChapterStyle.css"), "/*chapter css here*/"); } + + chapter[0] = String.Empty; fileName = Path.Combine(path, fileName); File.WriteAllLines(fileName, chapter, Encoding.Unicode); }