summaryrefslogtreecommitdiffstats
path: root/hugolib/site_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-03-05 20:18:17 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-03-05 20:50:53 +0100
commit27f8d8f9631a94c090dfdadcf3e38d2c5e389a4d (patch)
tree7f92a2de0cc87d33b0b08330fc4e54cf78029ae8 /hugolib/site_test.go
parent3c100cc32c49c80a2b45020b4305360782bf2a4c (diff)
Allow URL with extension in frontmatter
Fixes #1923
Diffstat (limited to 'hugolib/site_test.go')
-rw-r--r--hugolib/site_test.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/hugolib/site_test.go b/hugolib/site_test.go
index 482e2f791..66b58aa33 100644
--- a/hugolib/site_test.go
+++ b/hugolib/site_test.go
@@ -419,14 +419,15 @@ THE END.`, refShortcode))},
}
// Issue #939
-func Test404ShouldAlwaysHaveUglyURLs(t *testing.T) {
+// Issue #1923
+func TestShouldAlwaysHaveUglyURLs(t *testing.T) {
hugofs.DestinationFS = new(afero.MemMapFs)
for _, uglyURLs := range []bool{true, false} {
- doTest404ShouldAlwaysHaveUglyURLs(t, uglyURLs)
+ doTestShouldAlwaysHaveUglyURLs(t, uglyURLs)
}
}
-func doTest404ShouldAlwaysHaveUglyURLs(t *testing.T, uglyURLs bool) {
+func doTestShouldAlwaysHaveUglyURLs(t *testing.T, uglyURLs bool) {
viper.Reset()
defer viper.Reset()
@@ -436,11 +437,15 @@ func doTest404ShouldAlwaysHaveUglyURLs(t *testing.T, uglyURLs bool) {
viper.Set("DisableSitemap", false)
viper.Set("DisableRSS", false)
viper.Set("RSSUri", "index.xml")
+ viper.Set("blackfriday",
+ map[string]interface{}{
+ "plainIDAnchors": true})
viper.Set("UglyURLs", uglyURLs)
sources := []source.ByteSource{
- {filepath.FromSlash("sect/doc1.html"), []byte("---\nmarkup: markdown\n---\n# title\nsome *content*")},
+ {filepath.FromSlash("sect/doc1.md"), []byte("---\nmarkup: markdown\n---\n# title\nsome *content*")},
+ {filepath.FromSlash("sect/doc2.md"), []byte("---\nurl: /ugly.html\nmarkup: markdown\n---\n# title\ndoc2 *content*")},
}
s := &Site{
@@ -475,10 +480,12 @@ func doTest404ShouldAlwaysHaveUglyURLs(t *testing.T, uglyURLs bool) {
expected string
}{
{filepath.FromSlash("index.html"), "Home Sweet Home. IsHome=true"},
- {filepath.FromSlash(expectedPagePath), "\n\n<h1 id=\"title:5d74edbb89ef198cd37882b687940cda\">title</h1>\n\n<p>some <em>content</em></p>\n IsHome=false"},
+ {filepath.FromSlash(expectedPagePath), "\n\n<h1 id=\"title\">title</h1>\n\n<p>some <em>content</em></p>\n IsHome=false"},
{filepath.FromSlash("404.html"), "Page Not Found. IsHome=false"},
{filepath.FromSlash("index.xml"), "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n<root>RSS</root>"},
{filepath.FromSlash("sitemap.xml"), "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n<root>SITEMAP</root>"},
+ // Issue #1923
+ {filepath.FromSlash("ugly.html"), "\n\n<h1 id=\"title\">title</h1>\n\n<p>doc2 <em>content</em></p>\n IsHome=false"},
}
for _, p := range s.Pages {