diff --git a/cmd/ssg/site/html.go b/cmd/ssg/site/html.go
index 2374c81..770b3d1 100644
--- a/cmd/ssg/site/html.go
+++ b/cmd/ssg/site/html.go
@@ -5,6 +5,7 @@ import (
"html"
"strings"
+ "git.sr.ht/~ewintr/go-kit/slugify"
"git.sr.ht/~ewintr/shitty-ssg/pkg/adoc"
)
@@ -34,7 +35,7 @@ func FormatBlock(block adoc.BlockElement) string {
}
return fmt.Sprintf("
%s
", text)
case adoc.SubTitle:
- return fmt.Sprintf("%s
", html.EscapeString(block.Text()))
+ return fmt.Sprintf("%s
", slugify.Slugify(block.Text()), html.EscapeString(block.Text()))
case adoc.SubSubTitle:
return fmt.Sprintf("%s
", html.EscapeString(block.Text()))
case adoc.CodeBlock:
diff --git a/cmd/ssg/site/html_test.go b/cmd/ssg/site/html_test.go
index 997e710..0ac3e3d 100644
--- a/cmd/ssg/site/html_test.go
+++ b/cmd/ssg/site/html_test.go
@@ -26,7 +26,7 @@ func TestFormatBlock(t *testing.T) {
{
name: "subtitle",
element: adoc.SubTitle("text"),
- exp: "text
",
+ exp: `text
`,
},
{
name: "subsubtitle",
diff --git a/cmd/ssg/site/post_test.go b/cmd/ssg/site/post_test.go
index 1b66c4a..9760e48 100644
--- a/cmd/ssg/site/post_test.go
+++ b/cmd/ssg/site/post_test.go
@@ -13,9 +13,11 @@ func TestPost(t *testing.T) {
docKind := adoc.KIND_NOTE
siteKind := site.Kind(docKind)
config := &site.SiteConfig{
+ BaseURL: "base_url",
KindMap: map[adoc.Kind]site.Kind{
docKind: siteKind,
},
+ PathsWithKind: true,
}
title := "title thing"
author := "author"
@@ -60,7 +62,7 @@ func TestPost(t *testing.T) {
})
t.Run("full link", func(t *testing.T) {
- test.Equals(t, "https://erikwinter.nl/notes/2020/title-thing/", post.FullLink())
+ test.Equals(t, "base_url/notes/2020/title-thing/", post.FullLink())
})
t.Run("html summary", func(t *testing.T) {
@@ -90,7 +92,7 @@ func TestPost(t *testing.T) {
t.Run("xml post", func(t *testing.T) {
exp := &site.XMLPost{
- Link: "https://erikwinter.nl/notes/2020/title-thing/",
+ Link: "base_url/notes/2020/title-thing/",
Title: "title thing",
DateFormal: "Mon, 28 Dec 2020 07:23:45 +0000",
Content: "one
\ntwo
\n",
diff --git a/pkg/adoc/adoc_test.go b/pkg/adoc/adoc_test.go
index 6611fa6..de4a260 100644
--- a/pkg/adoc/adoc_test.go
+++ b/pkg/adoc/adoc_test.go
@@ -57,11 +57,6 @@ func TestNewKind(t *testing.T) {
input: "article",
exp: adoc.KIND_ARTICLE,
},
- {
- name: "work note",
- input: "work",
- exp: adoc.KIND_WORK,
- },
} {
t.Run(tc.name, func(t *testing.T) {
act := adoc.NewKind(tc.input)