Esempio n. 1
0
        public static SiteWriter create(Site site, string outputPath)
        {
            var trackingCode = readTrackingCode(site.TrackingCodeFiles);
            var shortcutIconFilename_ = tryGetShortcutIconFilename(site.ShortcutIcon_);

            return new SiteWriter(site, outputPath, trackingCode, shortcutIconFilename_);
        }
Esempio n. 2
0
        CompiledTemplate resolveModuleTemplate(Site site, string name)
        {
            CompiledTemplate template;
            if (!_moduleTemplates.TryGetValue(name, out template))
            {
                template = loadModuleTemplate(site, name);
                _moduleTemplates.Add(name, template);
            }

            return template;
        }
Esempio n. 3
0
        void copyResources(Site site)
        {
            foreach (var resource in site.Resources)
                copyResource(resource);

            if (site.ShortcutIcon_ != null)
            {
                var name = Path.GetFileName(site.ShortcutIcon_);
                copyResource(new Resource(site.ShortcutIcon_, name));
            }
        }
Esempio n. 4
0
        SiteWriter(Site site, string outputPath, string trackingCode, string shortcutIconFilename_)
        {
            _outputPath = outputPath;
            Site = site;
            TrackingCode = trackingCode;
            ShortcutIconFilename_ = shortcutIconFilename_;

            Journals = site.Journals
                .Select(JournalData.read)
                .ToArray();
        }
Esempio n. 5
0
        CompiledTemplate loadModuleTemplate(Site site, string name)
        {
            IEnumerable<string> modules = site.ModulesDirectories;
            foreach (var dir in modules.Reverse())
            {
                var fn = Path.Combine(dir, name + ".cshtml");
                if (File.Exists(fn))
                    return Template.compile<ModuleContext>(fn);
            }

            throw new Exception("Failed to load module template {0}: no module found".format(name));
        }
Esempio n. 6
0
        void generatePages(Site site)
        {
            var writer = SiteWriter.create(site, _outputPath);

            foreach (var page in site.Pages)
                generatePage(writer, page);

            writer.Journals
                .forEach(j => generateJournalFeed(writer, j));

            writer.Journals
                .forEach(j => generateJournalPages(writer, j));
        }
Esempio n. 7
0
 public void generate(Site site)
 {
     copyResources(site);
     generatePages(site);
 }
		public static Site make(dynamic parameters)
		{
			var commentProvider = new IntenseDebateCommentProvider("9c0758183a14e567cb74c0d8c265f005");
			var searchProvider = new GoogleCustomSearchProvider("005424054565942892879:knukodny3cw");

			var site = new Site("Replicator.org", "www.replicator.org", parameters);
			var homePage = new Page("home", "About");
			var journal = new Journal("journal", "Journal", "Armin's Journal");
			journal
				.comments(commentProvider)
				.search(searchProvider);


			var twitter = new ExternalPage("connect", "Twitter", "http://www.twitter.com/pragmatrix");
			var projects = new Page("projects", "Projects");

			var github = new ExternalPage("github", "Github", "http://www.github.com/pragmatrix");
			var bookmarks = new ExternalPage("bookmarks", "Bookmarks", "https://pinboard.in/u:pragmatrix");
			var xing = new ExternalPage("xing", "Xing", "http://www.xing.com/profile/Armin_Sander");

			var page404 = new Page("404", "Page Not Found, Error 404");

			var feedRef = new ExternalPage("feed", "", "/" + journal.FeedSitePath);
			feedRef.referenceClass("icon-rss");

			var menu = new Menu();
			menu
				.page(homePage)
				.page(projects)
				.page(journal.indexReference("Journal"))
				.page(github)
				.page(twitter)
				.page(xing)
				.page(bookmarks)
				.page(feedRef);

			site
				.page(page404)
				.css("replicator.css")
				// nice header font: Orbitron, but less readable than Audiowide
				.cssRef("https://fonts.googleapis.com/css?family=Questrial|Ubuntu+Mono|Audiowide")
				.slogan("... live programming is next")
				.home(homePage)
				.menu(menu)
				.journal(journal)
				.loadContentFromDirectory("Pages")
				.fontAwesome();
				

			// this should be part of the site generator!

			using (var f = File.Open("Site/moved-permanently", FileMode.Create, FileAccess.Write))
			using (var writer = new StreamWriter(f))
			{
				writer.WriteLine("Redirect permanent /node/feed /journal/feed");
				forwardOldContentPages(writer);
				forwardNodePages(writer);
			}

			return site;
		}