Initial commit

This commit is contained in:
Senad Uka
2023-08-13 19:48:19 +02:00
parent 39a0d3fe00
commit 497338f6fa
2 changed files with 6 additions and 3 deletions

View File

@@ -57,7 +57,7 @@ const html5Template = `
<body>
<header>
<div>
<a href="/">IslamBosna</a>
<a href="/">IslamBosna</a>
</div>
</header>
<content>

View File

@@ -19,12 +19,15 @@ type Post struct {
}
func (p *Post) GemtextPage() string {
return fmt.Sprintf("# %s\n\n", p.Title) + p.GemtextContent.String
return fmt.Sprintf("# %s\n\n", p.Title) + p.GemtextContent.String + "\n\n" + p.Date
}
func (p *Post) HTMLPage() string {
extensions := blackfriday.CommonExtensions | blackfriday.HardLineBreak
return fmt.Sprintf("<h1>%s</h1>\n%s", p.Title, blackfriday.Run([]byte(p.MarkdownContent), blackfriday.WithExtensions(extensions)))
result := fmt.Sprintf("<h1>%s</h1>\n%s", p.Title, blackfriday.Run([]byte(p.MarkdownContent), blackfriday.WithExtensions(extensions)))
result += fmt.Sprintf("%s", p.Date)
return result
}
func GetPost(id int) (*Post, error) {