Exemple #1
0
        static void Main(string[] args)
        {
            var rootDirName = DocumentationRoot();

            Console.WriteLine("RootDirName: " + rootDirName);

            var englishinputdir = rootDirName + "/content/english/book";

            foreach (var lang in AvailableLanguages.Get())
            {
                var inputdir = rootDirName + "/content/" + lang + "/book/";
                var pages    = new List <BookPage>();

                var tocBuilder = new TOCBuilder(File.ReadAllText(rootDirName + "/content/toc.yaml"));

                var outputDir = OutputDir(lang);
                foreach (var file in Directory.GetFiles(englishinputdir, "*.md"))
                {
                    var    languagefile = inputdir + "/" + Path.GetFileName(file);
                    string filecontents;
                    bool   usingEnglishAsFallback = !File.Exists(languagefile);

                    string filetouse = usingEnglishAsFallback ? file : languagefile;

                    var page       = new BookPage(filetouse, lang, usingEnglishAsFallback);
                    var outputfile = outputDir + Path.GetFileName(Path.GetFileNameWithoutExtension(file)) + ".html";
                    pages.Add(page);
                    page.WriteAsHtml(outputfile, tocBuilder);
                }

                CopyNonMDFilesFrom(englishinputdir, outputDir);
                CopyNonMDFilesFrom(inputdir, outputDir);

                File.Copy(DocumentationRoot() + "/layout/book.css", outputDir + "/book.css", true);
            }
        }