Skip to content

Commit

Permalink
Added header
Browse files Browse the repository at this point in the history
  • Loading branch information
LordZero25 committed Jun 30, 2018
1 parent c87993d commit 9d72a5e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/syosetuDownloader/Syousetsu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -257,7 +257,8 @@ public static string GetNovelHeader(HtmlDocument doc, Constants.FileType fileTyp
sb.AppendLine("<hr/>");

return sb.ToString();
}else
}
else
{
return String.Empty;
}
Expand Down Expand Up @@ -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("<img"))
{
Expand All @@ -330,7 +333,8 @@ public static string[] GenerateContents(Syousetsu.Constants details, HtmlDocumen
chapter[1] += "\t<title></title>\n";
chapter[1] += "\t<link href=\"ChapterStyle.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
chapter[1] += "</head>\n";
chapter[1] += "<body>\n";
chapter[1] += "<body>\n ";
chapter[1] += Methods.GetNovelHeader(doc, details.CurrentFileType);
chapter[1] += "\n<h2>" + chapter[0] + "</h2>\n\n";
chapter[1] += Methods.GetNovelBody(doc, details.CurrentFileType);

Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 9d72a5e

Please sign in to comment.