Пример #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));
            }
Пример #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));
            }
Пример #3
0
        public void LoadFile(string contents, SiteConfiguration configuration)
        {
            this.Body = contents;

            this.Permalink = ResolvePermalink(configuration.Permalink);

            ExtractMetadata();
            this.Tags = LoadTags();
        }
Пример #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;
 }
Пример #5
0
        public void ExecuteTransformationPipeline(SiteConfiguration configuration)
        {
            if (this.Extension == "md" || this.Extension == "markdown")
                this.TransformMarkdown();

            this.RetrieveTitle();

            this.ParseTemplate(originalPath);
        }
Пример #6
0
 public abstract void Init(SiteConfiguration configuration);
Пример #7
0
 public override void Init(SiteConfiguration configuration)
 {
     Template.FileSystem = new TemplatesFileSystem(configuration.SourcePath);
     Template.RegisterFilter(typeof(Filters));
     _siteDrop = new SiteDrop(configuration);
 }