Compare commits
No commits in common. "2e4e7c4d869bf7eac093a5b41d5502657d2613b0" and "32bbd6a9548630402acbf3586ebd1ef96d59b988" have entirely different histories.
2e4e7c4d86
...
32bbd6a954
|
|
@ -1,20 +0,0 @@
|
||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<profile version="1.0">
|
|
||||||
<option name="myName" value="Project Default" />
|
|
||||||
<inspection_tool class="GoUnhandledErrorResult" enabled="true" level="WARNING" enabled_by_default="true">
|
|
||||||
<methods>
|
|
||||||
<method importPath="hash" receiver="Hash" name="Write" />
|
|
||||||
<method importPath="strings" receiver="*Builder" name="Write" />
|
|
||||||
<method importPath="strings" receiver="*Builder" name="WriteByte" />
|
|
||||||
<method importPath="bytes" receiver="*Buffer" name="WriteRune" />
|
|
||||||
<method importPath="bytes" receiver="*Buffer" name="Write" />
|
|
||||||
<method importPath="bytes" receiver="*Buffer" name="WriteString" />
|
|
||||||
<method importPath="strings" receiver="*Builder" name="WriteString" />
|
|
||||||
<method importPath="bytes" receiver="*Buffer" name="WriteByte" />
|
|
||||||
<method importPath="strings" receiver="*Builder" name="WriteRune" />
|
|
||||||
<method importPath="math/rand" receiver="*Rand" name="Read" />
|
|
||||||
<method importPath="io" receiver="ReadCloser" name="Close" />
|
|
||||||
</methods>
|
|
||||||
</inspection_tool>
|
|
||||||
</profile>
|
|
||||||
</component>
|
|
||||||
1
go.mod
1
go.mod
|
|
@ -3,7 +3,6 @@ module p83.nl/go/weekly
|
||||||
go 1.12
|
go 1.12
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/jinzhu/now v1.1.1
|
|
||||||
github.com/pkg/errors v0.8.1 // indirect
|
github.com/pkg/errors v0.8.1 // indirect
|
||||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 // indirect
|
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 // indirect
|
||||||
p83.nl/go/ekster v0.0.0-20191119211024-4511657daa0b
|
p83.nl/go/ekster v0.0.0-20191119211024-4511657daa0b
|
||||||
|
|
|
||||||
2
go.sum
2
go.sum
|
|
@ -1,5 +1,3 @@
|
||||||
github.com/jinzhu/now v1.1.1 h1:g39TucaRWyV3dwDO++eEc6qf8TVIQ/Da48WmqjZ3i7E=
|
|
||||||
github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
|
||||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
|
|
||||||
19
main.go
19
main.go
|
|
@ -6,10 +6,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/jinzhu/now"
|
|
||||||
"p83.nl/go/ekster/pkg/microsub"
|
|
||||||
"willnorris.com/go/microformats"
|
"willnorris.com/go/microformats"
|
||||||
|
|
||||||
"p83.nl/go/ekster/pkg/jf2"
|
"p83.nl/go/ekster/pkg/jf2"
|
||||||
|
|
@ -34,8 +31,6 @@ func main() {
|
||||||
md := microformats.Parse(resp.Body, u)
|
md := microformats.Parse(resp.Body, u)
|
||||||
items := jf2.SimplifyMicroformatDataItems(md)
|
items := jf2.SimplifyMicroformatDataItems(md)
|
||||||
|
|
||||||
items = filterEntriesAfter(items, now.With(time.Now()).Monday())
|
|
||||||
|
|
||||||
t, err := template.ParseFiles("templates/weekly.html")
|
t, err := template.ParseFiles("templates/weekly.html")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|
@ -46,17 +41,3 @@ func main() {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func filterEntriesAfter(items []microsub.Item, from time.Time) []microsub.Item {
|
|
||||||
var result []microsub.Item
|
|
||||||
for _, item := range items {
|
|
||||||
published, err := time.Parse(time.RFC3339, item.Published)
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if published.After(from) {
|
|
||||||
result = append(result, item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,6 @@
|
||||||
<div class="p-content">{{ .Content.Text }}</div>
|
<div class="p-content">{{ .Content.Text }}</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<time datetime="{{ .Published }}">{{ .Published }}</time>
|
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user