private string createIssuesHtml(IssueDirNode dirNode) { StringBuilder sb = new StringBuilder(); // //sb.AppendLine("<h1 class=\"page-title\">" + dirNode.Name + " issues </h1>"); // sb.AppendLine("<ol>"); foreach(IssueItemNode item in dirNode.ItemNodes) { sb.AppendLine(TAB + "<li>"); // sb.AppendLine(TAB + TAB + "<ul>"); //sb.AppendLine(TAB + TAB + TAB + string.Format("<p><strong>{0}</strong></p>", item.Title)); sb.AppendLine(TAB + TAB + TAB + string.Format("<p><a href=\"{0}\" target=\"_blank\"><strong>{1}</strong></a></p>", item.Link, item.Title)); sb.AppendLine(TAB + TAB + TAB + string.Format("<p><mark>{0}</mark></p>", item.Text)); sb.AppendLine(TAB + TAB + "</ul>"); // sb.AppendLine(TAB + "</li>"); } sb.AppendLine("</ol>"); // return sb.ToString(); }
private void doWriteIssuePages(IssueDirNode dirNode, string parentPath) { string dirNodePath = Path.Combine(parentPath, dirNode.Name); // if (dirNode.ItemNodes.Count > 0) { string pagePath = dirNodePath + ".html"; string contentHtml = this.createIssuesHtml(dirNode); //string pageHtml = contentHtml; // this.processTemplate(contentHtml); //File.WriteAllText(pagePath, pageHtml); Globals.PageTemplateProcessor.WritePageAddH1(pagePath, contentHtml, dirNode.Name + " known issues"); } // if (dirNode.SubNodes.Count > 0) { Directory.CreateDirectory(dirNodePath); // foreach (IssueDirNode subDirNode in dirNode.SubNodes) { doWriteIssuePages(subDirNode, dirNodePath); } } }
// ------------------------------------- // print // ------------------------------------- private void print(IssueDirNode dir, string ind = "") { //Console.WriteLine(string.Format("{0}{1} ({2})", ind, dir.Name, dir.TotalItemsCount())); Console.WriteLine(string.Format("{0}{1}", ind, dir.DisplayName)); // foreach (IssueDirNode subDir in dir.SubNodes) { print(subDir, ind + " "); } // foreach (IssueItemNode item in dir.ItemNodes) { //Console.WriteLine(string.Format("{0} > {1}: {2} {3}", ind, item.Id, item.Title, item.Link)); Console.WriteLine(string.Format("{0} > {1}: {2}", ind, item.Title, item.Link)); } }
private string doGenIssuesNavHtml(IssueDirNode root, string path, string indent = "") { StringBuilder sb = new StringBuilder(); // sb.AppendLine(indent + "<ul>"); // foreach (IssueDirNode subNode in root.SubNodes) { sb.AppendLine(indent + TAB + "<li>"); // //string addr = path + "/" + Path.ChangeExtension(subNode.Name, ".html"); //string tag_a = string.Format("<a href='{1}'>{0}</a>", subNode.DisplayName, addr); //if (subNode.Kind == NavNodeKind.Placeholder) tag_a = string.Format("<span>{0}</span>", subNode.DisplayName); //if (subNode.Kind == NavNodeKind.Dir) tag_a = string.Format("<span class=\"nav-dir\">{0}</span>", subNode.DisplayName); //if (subNode.Kind == NavNodeKind.DirPage) tag_a = string.Format("<a class=\"nav-dir\" href='{1}'>{0}</a>", subNode.DisplayName, addr); string tagClass = (subNode.SubNodes.Count > 0) ? "class=\"nav-dir\"" : ""; string itemTag = string.Format("<span {0}>{1}</span>", tagClass, subNode.DisplayName); if (subNode.ItemNodes.Count > 0) itemTag = string.Format("<a {0} href=\"{1}\">{2}</a>", tagClass, path + "/" + subNode.Name + ".html", subNode.DisplayName); // //if (subNode.SubNodes.Count > 0) itemTag = string.Format("<span class=\"nav-dir\">{0}</span>", subNode.DisplayName); // sb.AppendLine(indent + TAB + TAB + itemTag); // if (subNode.SubNodes.Count > 0) sb.Append(doGenIssuesNavHtml(subNode, path + "/" + subNode.Name, indent + TAB + TAB)); // sb.AppendLine(indent + TAB + "</li>"); } // sb.AppendLine(indent + "</ul>"); // return sb.ToString(); }
public IssueDirNode AddSub(string subName) { IssueDirNode sub = new IssueDirNode() { Name = subName, Parent = this }; this.SubNodes.Add(sub); return sub; }