Exemplo n.º 1
0
            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));
            }
Exemplo n.º 2
0
            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));
            }
Exemplo n.º 3
0
        public void LoadFile(string contents, SiteConfiguration configuration)
        {
            this.Body = contents;

            this.Permalink = ResolvePermalink(configuration.Permalink);

            ExtractMetadata();
            this.Tags = LoadTags();
        }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
        public void ExecuteTransformationPipeline(SiteConfiguration configuration)
        {
            if (this.Extension == "md" || this.Extension == "markdown")
                this.TransformMarkdown();

            this.RetrieveTitle();

            this.ParseTemplate(originalPath);
        }
Exemplo n.º 6
0
 public abstract void Init(SiteConfiguration configuration);
Exemplo n.º 7
0
 public override void Init(SiteConfiguration configuration)
 {
     Template.FileSystem = new TemplatesFileSystem(configuration.SourcePath);
     Template.RegisterFilter(typeof(Filters));
     _siteDrop = new SiteDrop(configuration);
 }