package site import ( "fmt" "html" "strings" "git.sr.ht/~ewintr/go-kit/slugify" "git.sr.ht/~ewintr/shitty-ssg/pkg/adoc" ) type HTMLPost struct { Slug string Title string DateLong string DateShort string Content string } type HTMLSummary struct { Link string Title string Language Language DateShort string DateLong string Summary string } func FormatBlock(block adoc.BlockElement) string { switch block.(type) { case adoc.Paragraph: text := "" for _, inline := range block.(adoc.Paragraph) { text += FormatInline(inline) } return fmt.Sprintf("
%s
", text) case adoc.SubTitle: return fmt.Sprintf("%s
", html.EscapeString(block.Text()))
case adoc.List:
var items []string
for _, item := range block.(adoc.List) {
itemText := ""
for _, inline := range item {
itemText += FormatInline(inline)
}
items = append(items, fmt.Sprintf("%s
", text)
default:
return ""
}
}