Exemplo n.º 1
0
    private static void ApplyTemplate(string contentFolder, string siteFolder, FileInfo fi)
    {
        if (Verbose) Console.WriteLine("Processing "+ fi.Extension + " " + fi.Name);

        if (fi.Extension == ".html") {
            HtmlProcessor processor = new HtmlProcessor();
            processor.Consume(contentFolder, siteFolder, fi.Name, fi.Extension);
            FileUtils.WriteFile(processor.SiteFile, processor.Template, processor.Content);
            SearchProcessor.TagSearchFile(processor.Content, contentFolder, siteFolder, fi);
        } else if (fi.Extension == ".xml") {
            string title = BijouUtils.ParsePageTitle(siteFolder+"/bogus.xxx");
            XmlProcessor processor = new XmlProcessor();
            processor.XslArgs = XmlProcessor.BuildXsltArgumentList(title);
            processor.Consume(contentFolder, siteFolder, fi.Name, fi.Extension);
            FileUtils.WriteFile(processor.SiteFile, processor.Content);
        } else if (fi.Extension == ".csv") {
            CsvProcessor processor = new CsvProcessor();
            processor.Consume(contentFolder, siteFolder, fi.Name, fi.Extension);
            FileUtils.WriteFile(processor.SiteFile, processor.Template, processor.Content);
        } else if (fi.Extension == ".md") {
            MdProcessor processor = new MdProcessor();
            processor.Consume(contentFolder, siteFolder, fi.Name, fi.Extension);
            FileUtils.WriteFile(processor.SiteFile, processor.Template, processor.Content);
        } else if (fi.Extension == ".rss") {
            RssProcessor processor = new RssProcessor();
            processor.Consume(contentFolder, siteFolder, fi.Name, fi.Extension);
            FileUtils.WriteFile(processor.SiteFile, processor.Template, processor.Content);
            FileUtils.HtmlClone(contentFolder, siteFolder, fi.Name, fi.Extension, processor.Clone);
        } else if (fi.Extension == ".ics") {
            IcsProcessor processor = new IcsProcessor();
            processor.Consume(contentFolder, siteFolder, fi.Name, fi.Extension);
            FileUtils.WriteFile(processor.SiteFile, processor.Template, processor.Content);
            FileUtils.HtmlClone(contentFolder, siteFolder, fi.Name, fi.Extension, processor.Clone);
        }
    }