Esempio n. 1
0
        public static void FormatContentFiles(string targetPath)
        {
            //* Construct the Nav Tree
            var navigation       = new NavigationTree(targetPath);
            var rootHeadings     = navigation.GetRootHeadings().ToList();
            var contentFilePaths = Directory.GetFiles(targetPath, "*.html");

            foreach (var currentFilePath in contentFilePaths)
            {
                var newContents = new StringBuilder();

                newContents.Append(GenerateHeader(currentFilePath));
                newContents.Append(GenerateHeaderNavigation(currentFilePath, rootHeadings));
                newContents.Append(GenerateNavigation(currentFilePath, rootHeadings));
                newContents.Append(@"<div class=""main"">
                                        <div style=""float: right; margin: 10px 0px 10px 10px; width: 140px; font-size: 11px;text-align: center"">
                                            <img src=""../../Styles/IntroToRx_Cover.png"" style=""margin: 10px"" />
                                            Lee Campbell<br/>
                                            <a href=""IntroToRx.mobi"" title=""Introduction to Rx as .mobi file (for Kindle)"">Introduction to Rx<br/>Kindle edition</a> (2012)
                                        </div>");

                newContents.Append(GenerateBody(currentFilePath));
                newContents.Append(GenerateFooterNavigation(currentFilePath, rootHeadings));
                newContents.Append("</div>");
                newContents.Append(GenerateFooter());

                newContents.ToString()
                .ParseXmlDoc()
                .WriteToFile(currentFilePath);
            }
        }
Esempio n. 2
0
        public static void FormatContentFiles(string targetPath)
        {
            //* Construct the Nav Tree
            var navigation = new NavigationTree(targetPath);
            var rootHeadings = navigation.GetRootHeadings().ToList();
            var contentFilePaths = Directory.GetFiles(targetPath, "*.html");

            foreach (var currentFilePath in contentFilePaths)
            {
                var newContents = new StringBuilder();

                newContents.Append(GenerateHeader(currentFilePath));
                newContents.Append(GenerateHeaderNavigation(currentFilePath, rootHeadings));
                newContents.Append(GenerateNavigation(currentFilePath, rootHeadings));
                newContents.Append(@"<div class=""main"">
                                        <div style=""float: right; margin: 10px 0px 10px 10px; width: 140px; font-size: 11px;text-align: center"">
                                            <img src=""../../Styles/IntroToRx_Cover.png"" style=""margin: 10px"" />
                                            Lee Campbell<br/>
                                            <a href=""IntroToRx.mobi"" title=""Introduction to Rx as .mobi file (for Kindle)"">Introduction to Rx<br/>Kindle edition</a> (2012)
                                        </div>");

                newContents.Append(GenerateBody(currentFilePath));
                newContents.Append(GenerateFooterNavigation(currentFilePath, rootHeadings));
                newContents.Append("</div>");
                newContents.Append(GenerateFooter());

                newContents.ToString()
                    .ParseXmlDoc()
                    .WriteToFile(currentFilePath);
            }
        }
Esempio n. 3
0
        private static string FileContents(string contentRoot)
        {
            var links = new NavigationTree(contentRoot).GetRootHeadings();

            var sb = new StringBuilder();

            foreach (var link in links)
            {
                sb.AppendLine("<div style=\"margin-top:1em;\">");
                sb.AppendFormat("<b><a href='{0}'>{1}</a></b>", link.Href, link.Name);
                sb.AppendLine();
                sb.Append(ProcessLevel1Link(link.SubLinks));
                sb.AppendLine("</div>");
            }
            return(sb.ToString());
        }
Esempio n. 4
0
        private static string FileContents(string contentRoot)
        {
            var links = new NavigationTree(contentRoot).GetRootHeadings();

            var sb = new StringBuilder();

            foreach (var link in links)
            {
                sb.AppendLine("<div style=\"margin-top:1em;\">");
                sb.AppendFormat("<b><a href='{0}'>{1}</a></b>", link.Href, link.Name);
                sb.AppendLine();
                sb.Append(ProcessLevel1Link(link.SubLinks));
                sb.AppendLine("</div>");
            }
            return sb.ToString();
        }