public void Windows_paths(string toPath, string expectedRelativePath) { // Arrange var configuration = new SiteConfiguration { SourcePath = @"C:\documents\blog\source" }; expectedRelativePath = expectedRelativePath.Replace("\\", Path.DirectorySeparatorChar.ToString()); // Act var relativePath = configuration.GetRelativePath(toPath); // Assert Assert.That(relativePath, Is.EqualTo(expectedRelativePath)); }
public void Unix_paths(string toPath, string expectedRelativePath) { // Arrange var configuration = new SiteConfiguration { SourcePath = @"/home/blog/source" }; expectedRelativePath = expectedRelativePath.Replace("/", Path.DirectorySeparatorChar.ToString()); // Act var relativePath = configuration.GetRelativePath(toPath); // Assert Assert.That(relativePath, Is.EqualTo(expectedRelativePath)); }
public void LoadFile(string contents, SiteConfiguration configuration) { this.Body = contents; this.Permalink = ResolvePermalink(configuration.Permalink); ExtractMetadata(); this.Tags = LoadTags(); }
public string GetDestinationFilePath(SiteConfiguration configuration) { var permalink = this.ResolvePermalink(configuration.Permalink).TrimStart('/'); if (!(permalink.EndsWith(".html") || permalink.EndsWith(".htm"))) { permalink = Path.Combine(permalink, "index.html"); } return permalink; }
public void ExecuteTransformationPipeline(SiteConfiguration configuration) { if (this.Extension == "md" || this.Extension == "markdown") this.TransformMarkdown(); this.RetrieveTitle(); this.ParseTemplate(originalPath); }
public abstract void Init(SiteConfiguration configuration);
public override void Init(SiteConfiguration configuration) { Template.FileSystem = new TemplatesFileSystem(configuration.SourcePath); Template.RegisterFilter(typeof(Filters)); _siteDrop = new SiteDrop(configuration); }