Browse Source

Add another example and UAT

Signed-off-by: jolheiser <john.olheiser@gmail.com>
main
jolheiser 2 months ago
parent
commit
abcf07c673
Signed by: jolheiser GPG Key ID: B853ADA5DA7BBF7A
  1. 43
      _example/test.md
  2. 59
      _example/test2.md
  3. 2
      post/post.go
  4. 25
      static/index.tmpl
  5. 32
      static/post.tmpl
  6. 2
      static/sakura.css

43
_example/test.md

@ -5,9 +5,21 @@ date = 2021-10-01
tags = ["test", "example"]
---
# Testing
# H1
## H2
### H3
#### H4
##### H5
###### H6
This is a test
This is a test, and all the ways I learned to test.
* Foo
* Bar
* Baz
* Banana
[Link Home](/)
```go
package main
@ -17,4 +29,31 @@ import "fmt"
func main() {
fmt.Println("Hello, blog!")
}
```
Some **more** text!
```go
package main
import "fmt"
func main() {
fmt.Println("Hello,", "blog!")
}
```
## Okay, moving on
_This_ time ~~we~~ I am going to **test** some emphasis.
```sql
SELECT
username,
age,
email
FROM
users
WHERE
email = 'john.olheiser@gmail.com';
```

59
_example/test2.md

@ -0,0 +1,59 @@
---
title = "Testing"
author = "jolheiser"
date = 2021-08-19
tags = ["foo", "bar"]
---
# H1
## H2
### H3
#### H4
##### H5
###### H6
This is a test, and all the ways I learned to test.
* Foo
* Bar
* Baz
* Banana
[Link Home](/)
```go
package main
import "fmt"
func main() {
fmt.Println("Hello, blog!")
}
```
Some **more** text!
```go
package main
import "fmt"
func main() {
fmt.Println("Hello,", "blog!")
}
```
## Okay, moving on
_This_ time ~~we~~ I am going to **test** some emphasis.
```sql
SELECT
username,
age,
email
FROM
users
WHERE
email = 'john.olheiser@gmail.com';
```

2
post/post.go

@ -64,7 +64,7 @@ func (b *Blog) SortedPosts() []*Post {
posts = append(posts, post)
}
sort.Slice(posts, func(i, j int) bool {
return posts[i].Date.Before(posts[j].Date)
return posts[i].Date.After(posts[j].Date)
})
return posts
}

25
static/index.tmpl

@ -3,17 +3,30 @@
<head>
<meta charset="UTF-8">
<title>Blog</title>
<link rel="icon" href="data:,">
<link rel="stylesheet" href="sakura.css"/>
<style>
.tag {
font-size: .7em;
}
.right {
float: right;
}
.title {
text-align: center;
font-size: 2.5em;
}
</style>
</head>
<body>
<h1>Blog Posts</h1>
{{range .Blog.Posts}}
<p>
<h1 class="title">Blog Posts</h1>
{{range .Blog.SortedPosts}}
<h5>
<a href="{{.Slug}}"><strong>{{.Title}}</strong></a><br/>
<small>@{{.Author}} - <i>{{.Date.Format "01/02/2006"}}</i></small>
</p>
<small>@{{.Author}}</small><span class="right">{{.Date.Format "Jan 2, 2006"}}</span><br/>
{{range .Tags}}<code class="tag">{{.}}</code> {{end}}
</h5>
<hr/>
{{end}}
</body>
</html>

32
static/post.tmpl

@ -2,10 +2,40 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{.Title}}</title>
<title>{{.Post.Title}}</title>
<link rel="icon" href="data:,">
<link rel="stylesheet" href="sakura.css"/>
</head>
<body>
{{.Content}}
</body>
<script>
document.addEventListener('DOMContentLoaded', () => {
for (let level = 1; level <= 4; level++) {
let elems = document.getElementsByTagName("h" + level);
for (let i = 0; i < elems.length; i++) {
let elem = elems[i];
if (elem.id !== "undefined" && elem.id !== "") {
let anchorId = elem.id + "-anchor";
elem.addEventListener("mouseover", () => {
document.getElementById(anchorId).style.display = "initial";
});
elem.addEventListener("mouseout", () => {
document.getElementById(anchorId).style.display = "none";
});
let space = document.createElement("span");
space.innerText = " ";
elem.appendChild(space)
let anchor = document.createElement("a");
anchor.id = anchorId;
anchor.href = "#" + elem.id;
anchor.innerHTML = "<small>&para;</small>";
anchor.style.display = "none";
elem.appendChild(anchor);
}
}
}
});
</script>
</html>

2
static/sakura.css

@ -31,7 +31,7 @@ html {
body {
font-size: 1.8rem;
line-height: 1.618;
max-width: 38em;
max-width: 50%;
margin: auto;
color: var(--color-text);
background-color: var(--color-bg);

Loading…
Cancel
Save