Ejemplo 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);
            }
        }
Ejemplo 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);
            }
        }