Esempio n. 1
0
        static void Main(string[] args)
        {
            var rootDirName = DocumentationRoot();
            Console.WriteLine("RootDirName: "+rootDirName);
            var inputdir = rootDirName + "/content/english/book/";
            var pages = new List<BookPage>();

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

            foreach(var file in Directory.GetFiles(inputdir,"*.md"))
            {
                var page = new BookPage(file);
                var outputfile = OutputDir() + Path.GetFileName(Path.GetFileNameWithoutExtension(file))+".html";
                pages.Add(page);
                page.WriteAsHtml(outputfile, tocBuilder);
            }

            foreach (var file in Directory.GetFiles(inputdir, "*").Where(file => Path.GetExtension(file).ToLower()!=".md"))
            {
                var outputfile = Path.Combine(OutputDir(), Path.GetFileName(file));
                Console.WriteLine("outputfile: "+outputfile);
                PathTools.EnsureDirectoryExists(Path.GetDirectoryName(outputfile));
                File.Copy(file, outputfile,true);
            }

            File.Copy(DocumentationRoot() + "/layout/book.css", OutputDir() + "/book.css", true);
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
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);
            }
        }